Introduction
A profile usually has more than one source of health data: a phone, a watch, a ring, a connected cloud account. Sahha tells you which of them is behind each value, so you can tell a night of sleep recorded by a watch from one estimated from phone use, or Garmin data read through Apple Health from Garmin data fetched from Garmin’s cloud.
Every record carries a sources list. Each entry is the same source object wherever it appears.
| Where | What sources holds |
|---|---|
| Biomarker | Every source whose data fed the value. The source the value is stored under comes first. |
| Score factor | The sources of the biomarker behind the factor. |
| Score | Every source behind its factors, each once. |
| Tag | The one source that sent the tag. |
| Profile | Every source the profile has received data from, in the order first seen. |
sources is returned by the API for all five, and in webhooks for biomarkers, scores and score factors.
The source object
Source
Each entry in a sources list follows this structure:
id UUID Stable id of this source within the profile
identifier string The source exactly as it reached Sahha: a bundle id, package name, provider key, sensor name, or the string your backend sent
channel string nullable How the data reached Sahha. See Channels below
provider string nullable Whose app or device recorded the data, such as apple, google, samsung, garmin, oura, whoop, fitbit, polar, withings or sahha
deviceType string nullable Kind of device that recorded the data. See Device types below
deviceModel string nullable Exact model of the recording device, such as Watch7,19. Null when not reported
{
"id": "5b1c2f4e-8d3a-5e71-9c0b-2a6f4d8e1b37",
"identifier": "com.apple.health.38DCF2B6-9397-45C6-A993-0F2D1CD19AF9",
"channel": "apple_health",
"provider": "apple",
"deviceType": "watch",
"deviceModel": "Watch7,19"
} id and identifier are always set. The other four fields are null when Sahha does not know the answer. They are never a guess.
Channels
channel says how the data reached Sahha.
| Value | Meaning |
|---|---|
apple_health | Read from Apple Health by the Sahha SDK |
health_connect | Read from Health Connect by the Sahha SDK |
samsung_health | Read from Samsung Health by the Sahha SDK |
phone_sensors | Read by the Sahha SDK from the phone’s own sensors, with no health app involved |
provider_cloud | Fetched from the provider’s cloud through a Sahha integration |
api_upload | Posted straight to the Sahha API by you, outside the SDK and the integrations |
sahha_estimate | Estimated by Sahha where no device measured the value |
sahha_sample | Demo data on a sandbox sample profile |
The channel is the route the data took, not the device that recorded it. Steps an iPhone counts are stored in Apple Health, so they arrive as apple_health. phone_sensors covers only what the Sahha SDK reads from the sensors itself.
Not returned yet
samsung_health and api_upload are part of the contract but are not returned yet. Until they are, data read from Samsung Health and data you post to the API has a null channel, or the channel Sahha infers from the device model sent with it. Those sources will change to the right channel when support ships.
Device types
deviceType is one of phone, tablet, watch, ring, band, scale, chest_strap, cgm, bp_monitor, earbuds, exercise_equipment or other. It is null when unknown, or when one source records from more than one kind of device.
deviceModel is only set when the source reports an exact model. Apple devices do. Android and cloud sources report a kind of device and no model, so expect null there.
Recording method
Biomarkers and score factors also carry recordingMethod, which says how the data behind the value was captured:
| Value | Meaning |
|---|---|
automatic | Recorded by a device or app without the user typing it in. Sessions the user starts, such as a workout, count as automatic |
manual | Entered by hand, for example steps or weight typed into Apple Health |
mixed | Built from both automatic and manual data |
null | Unknown: the source did not say, or the biomarker does not report it yet |
Values Sahha computes take the method of the data they were computed from. Sleep debt from automatically recorded nights is automatic, and so is an active energy estimate made from automatically counted steps. A score factor has the same method as the biomarker it reads.
Not filled everywhere yet
Oxygen saturation, blood glucose, blood pressure, respiratory rate, VO2 max, body and skin temperature, and the app session biomarkers return null for now. Records stored before this release also stay null until they are recalculated.
Sahha’s own sources
Some values are produced by Sahha, not measured by a device. They are listed as sources like any other, with provider set to sahha and an identifier under ai.sahha.
| Identifier | Channel | What it is |
|---|---|---|
ai.sahha.estimate.sleep | sahha_estimate | Sleep estimated from phone use, for nights with no device sleep data |
ai.sahha.estimate.active_energy | sahha_estimate | Active energy estimated for days no device reported it |
ai.sahha.estimate.resting_energy | sahha_estimate | Resting energy estimated for days no device reported it |
ai.sahha.sample | sahha_sample | Demo data on a sandbox sample profile |
A value Sahha combined or estimated lists every source it used, the estimator included. Filter on channel to separate measured values from estimated ones.
ai.sahha is reserved
You cannot upload data under a source that begins with ai.sahha. A data log upload that uses one is rejected with a 400. A tag that uses one is skipped and listed in the response Warnings with code reserved_source.
Building on sources
A few rules keep an integration working as Sahha adds sources and improves how it recognises them.
- Accept values you have not seen. New
channel,provideranddeviceTypevalues will be added. Treat an unknown one as you wouldother. - Expect details to be filled in later. Sahha recognises more apps and devices over time, and re-checks sources it already holds. A source’s
channel,provider,deviceTypeordeviceModelcan go fromnullto a value, or be corrected. Itsidandidentifiernever change. - Group by provider and device type, not by identifier. Apple Health and Health Connect give each installation its own identifier, so a user who moves to a new phone gets new sources.
provideranddeviceTypestay the same across installs. - Older records can have an empty list. Biomarkers and score factors stored before sources were recorded return
"sources": [].
Deprecated fields
These fields are still returned, so existing integrations keep working. New work should use sources.
| Field | Use instead |
|---|---|
source on a tag | sources[0].identifier |
dataSources on a profile | sources |
dataSources on a score is a different field and is not deprecated. It lists the biomarker categories the score used, such as sleep or activity.
Support
Need help? Contact support@sahha.ai or join the Slack Community.