> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stealthera.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Wellness — Overview, Sleep, Heart Health, Pressure (Stress)

> Returns wellness metrics for a device in a single response. Triggers **two** parallel reads (`healthData` history + `live_devices` fallback for the overview snapshot).

**Replaces individual endpoints:** `/overview`, `/sleep`, `/hearthealth`, `/pressure`

**Response shape:**
```json
{
  "deviceId": "string",
  "overview":    { "deviceId", "date", "steps", "distance", "calories", "heartRate", "bloodOxygen", "bodyTemp", "sleepHours", "bloodPressure" },
  "sleep":       { "deviceId", "date", "startTime", "endTime", "totalMinutes", "series", "deepSleepMinutes", "lightSleepMinutes", "remSleepMinutes", "awakeTimes", "sleepHeartRate", "apneaRisk", "sleepScore" },
  "hearthealth": { "deviceId", "date", "diagnosis", "afibRisk", "hrvScore", "series" },
  "pressure":    { "deviceId", "date", "series", "average", "level" }
}
```

**Sub-field details:**
| Sub-object | Field | Type | Description |
|---|---|---|---|
| `overview` | `steps` | number | Step count |
| `overview` | `distance` | number | Distance in metres |
| `overview` | `calories` | number | Calories burned (kcal) |
| `overview` | `heartRate` | number | BPM |
| `overview` | `bloodOxygen` | number | SpO2 % |
| `overview` | `bodyTemp` | number | °C |
| `overview` | `sleepHours` | number | Total sleep hours |
| `overview` | `bloodPressure` | object | `{ systolic, diastolic }` mmHg |
| `sleep` | `startTime` / `endTime` | string | Sleep window start / end (IST) |
| `sleep` | `series` | array | `[{ time, stage }]` — 0=awake, 1=light, 2=deep |
| `sleep` | `deepSleepMinutes` / `lightSleepMinutes` / `remSleepMinutes` | number | Minutes in each stage |
| `sleep` | `awakeTimes` | number | Number of awakenings |
| `sleep` | `sleepHeartRate` | number | Average heart rate during sleep (BPM) |
| `sleep` | `apneaRisk` | number | Sleep apnea risk indicator |
| `sleep` | `sleepScore` | number | Score 0–100 |
| `hearthealth` | `afibRisk` | string | `Low` / `Medium` / `High` |
| `hearthealth` | `hrvScore` | number | HRV score 0–100 |
| `pressure` | `series` | array | `[{ time, value }]` — stress index 0–100 |
| `pressure` | `level` | string | `Low` / `Normal` / `High` |



## OpenAPI

````yaml /openapi.yaml get /api/device/{deviceId}/wellness
openapi: 3.0.0
info:
  title: Stealthera API
  description: >-
    ## System Architecture


    ```

    ┌──────────────┐        ┌───────────────────┐       
    ┌────────────────┐        ┌─────────────────────┐

    │              │        │                   │        │               
    │        │                     │

    │   Wearable   │──────▶ │  Stealthera Cloud │──────▶ │ Stealthera API
    │──────▶ │  Client Platform    │

    │   Device     │        │                   │        │               
    │        │                     │

    └──────────────┘        └───────────────────┘       
    └────────────────┘        └─────────────────────┘
         Stealthera Device          Cloud Ingestion              REST Endpoints          Hospital Apps / HIS /
           Smartwatch                  Backend                  (This Document)         EMR / Cloud Infra
    ```


    Stealthera exposes standardized APIs which can be consumed by hospital
    applications, HIS platforms, EMR systems, or client-hosted cloud
    infrastructure.


    ---


    ## Overview


    The Stealthera API exposes normalized health, safety, and device data
    collected from Stealthera smartwatches. It is a **pull-based** API: a client
    is issued a base URL, an API key, and this document, then calls the
    endpoints below to retrieve data for the devices assigned to them.


    **Base URL:** `https://api.stealthera.in`


    **Device ID Example:** `863758060992848`


    ## Authentication


    Every request must include the API key in the `X-API-Key` header. Keys are
    issued per client. Requests without a valid key receive `401 Unauthorized`.


    ## Data Organization


    The watch pushes all of its data to the Stealthera Cloud through a small set
    of collective upload channels. Stealthera normalizes that data and
    re-exposes it as **logically grouped read endpoints**, so a client retrieves
    related metrics in a single call instead of one request per metric:


    - `/vitals` returns heart rate, blood pressure, blood oxygen, and body
      temperature together.

    - `/wellness` returns overview, sleep, heart health (ECG/AF summary), and
      stress together.

    - `/diagnostics` returns ECG records.

    - `/safety` returns location tracks and device alarms together.


    Per-reading metabolic values (blood sugar, blood ketone, uric acid, blood
    potassium, body composition) are exposed individually under **More Metrics**
    because they are measured on demand rather than continuously.


    ## Data Freshness & Resolution


    - The device list (`/api/health-data`) and the `overview` block return the
      **latest** values from the most recent upload.

    - Time-series metrics return per-day history. Resolution follows the device
      sampling cadence (typically per-minute where supported; blood pressure is
      reported as 24 hourly points). Sampling and upload intervals are
      configurable per deployment.

    - `lastSeen` / `updateTime` reflect the time of the most recent upload
    (IST).

    - All timestamps are India Standard Time (UTC+05:30), formatted
      `YYYY-MM-DD HH:mm:ss`.


    ## Responses & Errors


    All endpoints return `application/json` unless noted. Standard status codes:


    | Code | Meaning |

    |---|---|

    | `200` | Success (may include empty results) |

    | `401` | Missing or invalid API key |

    | `404` | Unknown `deviceId` |

    | `500` | Internal server error |


    Error responses use the shape `{ "error": "string" }`. **Empty states are
    not errors:** a metric with no data for the requested day returns an empty
    array (`[]`) for list fields and `null` for summary values, with `200`.


    ---


    ### Endpoint Groups

    - **Watch Upload** — binary data posted by the watch firmware

    - **Health Data** — aggregated live device list

    - **Grouped Device** — per-device health metrics returned in grouped batches
      (one read per group, used by the dashboard frontend)

    - **More Metrics** — individual per-device endpoints for blood sugar, blood
      ketone, uric acid, and blood potassium (separate reads)

    - **Device Info** — per-device hardware and network metadata

    - **SOS** — SOS events and call log history

    - **Alarms** — event / alert log


    ---


    ## Migration Note


    In v1.1 the ten individual device-detail endpoints (`/overview`,
    `/heartrate`, `/sleep`, `/bloodpressure`, `/bloodoxygen`, `/bodytemp`,
    `/hearthealth`, `/ecg`, `/pressure`, `/locationtrack`) were consolidated
    into four grouped endpoints to reduce round-trips and read costs. If you
    were calling any of those legacy paths, migrate to the grouped equivalents
    below.


    ---


    ## Note


    This document represents the current **v1.1 API specification**.


    Future versions will include:

    - Enhanced authentication and authorization

    - Device-to-patient mapping workflows

    - Expanded monitoring and audit capabilities

    - Advanced integration and interoperability features
  version: 1.1.0
servers:
  - url: https://api.stealthera.in
security:
  - apiKey: []
tags:
  - name: Health Check
  - name: Watch Upload
  - name: Health Data
  - name: Grouped Device
    description: >-
      Grouped endpoints — each call triggers one history read and returns all
      metrics for that group. Used by the dashboard frontend to minimise
      round-trips.
  - name: More Metrics
    description: >-
      Individual per-reading endpoints for blood sugar, blood ketone, uric acid,
      blood potassium, and body composition. Each triggers its own read and is
      used by the "More" tabs in the dashboard.
  - name: Device Info
    description: Per-device hardware and network metadata.
  - name: SOS
    description: SOS events and call log history.
  - name: Alarms
paths:
  /api/device/{deviceId}/wellness:
    get:
      tags:
        - Grouped Device
      summary: Wellness — Overview, Sleep, Heart Health, Pressure (Stress)
      description: >-
        Returns wellness metrics for a device in a single response. Triggers
        **two** parallel reads (`healthData` history + `live_devices` fallback
        for the overview snapshot).


        **Replaces individual endpoints:** `/overview`, `/sleep`,
        `/hearthealth`, `/pressure`


        **Response shape:**

        ```json

        {
          "deviceId": "string",
          "overview":    { "deviceId", "date", "steps", "distance", "calories", "heartRate", "bloodOxygen", "bodyTemp", "sleepHours", "bloodPressure" },
          "sleep":       { "deviceId", "date", "startTime", "endTime", "totalMinutes", "series", "deepSleepMinutes", "lightSleepMinutes", "remSleepMinutes", "awakeTimes", "sleepHeartRate", "apneaRisk", "sleepScore" },
          "hearthealth": { "deviceId", "date", "diagnosis", "afibRisk", "hrvScore", "series" },
          "pressure":    { "deviceId", "date", "series", "average", "level" }
        }

        ```


        **Sub-field details:**

        | Sub-object | Field | Type | Description |

        |---|---|---|---|

        | `overview` | `steps` | number | Step count |

        | `overview` | `distance` | number | Distance in metres |

        | `overview` | `calories` | number | Calories burned (kcal) |

        | `overview` | `heartRate` | number | BPM |

        | `overview` | `bloodOxygen` | number | SpO2 % |

        | `overview` | `bodyTemp` | number | °C |

        | `overview` | `sleepHours` | number | Total sleep hours |

        | `overview` | `bloodPressure` | object | `{ systolic, diastolic }` mmHg
        |

        | `sleep` | `startTime` / `endTime` | string | Sleep window start / end
        (IST) |

        | `sleep` | `series` | array | `[{ time, stage }]` — 0=awake, 1=light,
        2=deep |

        | `sleep` | `deepSleepMinutes` / `lightSleepMinutes` / `remSleepMinutes`
        | number | Minutes in each stage |

        | `sleep` | `awakeTimes` | number | Number of awakenings |

        | `sleep` | `sleepHeartRate` | number | Average heart rate during sleep
        (BPM) |

        | `sleep` | `apneaRisk` | number | Sleep apnea risk indicator |

        | `sleep` | `sleepScore` | number | Score 0–100 |

        | `hearthealth` | `afibRisk` | string | `Low` / `Medium` / `High` |

        | `hearthealth` | `hrvScore` | number | HRV score 0–100 |

        | `pressure` | `series` | array | `[{ time, value }]` — stress index
        0–100 |

        | `pressure` | `level` | string | `Low` / `Normal` / `High` |
      parameters:
        - name: deviceId
          in: path
          schema:
            type: string
          required: true
          description: Device IMEI
          example: '863758060992848'
      responses:
        '200':
          description: Wellness group
          content:
            application/json:
              schema:
                type: object
                properties:
                  deviceId:
                    type: string
                  overview:
                    type: object
                  sleep:
                    type: object
                  hearthealth:
                    type: object
                  pressure:
                    type: object
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: Per-client API key issued by Stealthera.

````