openapi: 3.0.3 info: version: '2.0' title: Withings developer documentation answers sleep API description: These webservices allows you to get user's answers from surveys servers: - url: https://wbsapi.withings.net/ tags: - name: sleep x-displayName: Sleep description: 'Returns data related to user sleep activities, wether they are captured by an Activity Tracker or a Sleep Monitor. The data are only available once a synchronization occured between the device and Withings servers (which might include synchronizing with Withings mobile application or via Withings Mobile SDK).' paths: https://wbsapi.withings.net/v2/sleep: post: tags: - sleep description: ' Returns sleep data captured at high frequency, including sleep stages.

**Notes** If your input ```startdate``` and ```enddate``` are separated by more than 24h, only the first 24h after ```startdate``` will be returned.

**IMPORTANT**: Please refer to this [page](https://developer.withings.com/developer-guide/v3/data-api/all-available-health-data/#sleep) to check the availability of metrics based on the sleep tracking device used. Some data types are regulated in the EU and US and may not be available in your region.' summary: Sleep v2 - Get operationId: sleepv2-get parameters: - name: action in: query required: true schema: type: string description: Service action name. Must take the string value ```get```. - name: startdate in: query required: true schema: type: integer description: Data start date as a unix timestamp. format: timestamp - name: enddate in: query required: true schema: type: integer description: Data end date as a unix timestamp. format: timestamp - name: data_fields in: query required: false schema: type: string description: 'List of requested data fields, separated by a comma.
Available data fields are listed below.
Ex: data_fields=hr,rr,snoring

hr
> Heart Rate (beats per minute).

rr
> Respiration Rate (breaths per minute).

snoring
> Total snoring time (seconds).

sdnn_1
> Heart rate variability - Standard deviation of the NN over 1 minute (in miliseconds).

rmssd
> Heart rate variability - Root mean square of the successive differences over "a few seconds" (in miliseconds).

hrv_quality
> Heart rate variability - quality score.

mvt_score
> Track the intensity of movement in bed on a minute-by-minute basis. The score ranges from 0 to 255, representing the intensity of movement. This metric is only available for Sleep Analyzer devices in the EU and prescription-based devices in the US (Sleep Rx).

chest_movement_rate
> Chest movement rate (events per minute).

withings_index
> Withings Sleep Rx (FDA Cleared) allows to estimate gaps in breathing sounds and to generate an index. This index corresponds to the number of breathing events per hour.
ValueDescription
0-15 (events per hour on average)No/Mild
15-30 (events per hour on average)Moderate
> 30 (events per hour on average)Severe
Note: 5 hours of sleep are required in order to calculate the Withings Index.

breathing_sounds
> Total time when breathing sounds were tracked. (seconds)

' - name: meastypes in: query required: false schema: type: list of integers description: 'List of requested measure types (separated by a comma).
Ex: meastypes=1,4,12' - name: Authorization in: header required: true schema: type: string description: 'Used to pass your access token. Must take value: ```Bearer {your access_token}``` Replace {your access_token} with the access_token' responses: 200: description: ' (Click to unfold)' content: application/json: schema: type: object properties: status: type: integer description: Response status. See Status section for details. body: type: object description: Response data. properties: model: type: integer description: The source for sleep data. Value can be 16 for a tracker or 32 for a Sleep Monitor. example: 32 series: type: object properties: startdate: type: integer description: The starting datetime for the sleep state data. format: timestamp example: 1594159200 enddate: type: integer description: The end datetime for the sleep data. A single call can span up to 7 days maximum. To cover a wider time range, you will need to perform multiple calls. format: timestamp example: 1594202400 state: type: integer description: 'The state of sleeping. Values can be: | Value | Description| |---|---| |0 | Sleep state awake| |1 | Sleep state light| |2 | Sleep state deep| |3 | Sleep state rem| |4 | Sleep manual| |5 | Sleep unspecified| |15 | Sleep out of bed (require a specific plan, contact-us)| ' example: 1 model: type: string description: 'Device model. Value can be: | Value | Description| |---|---| |Aura Dock | Sleep Monitor| |Aura Sensor | Sleep Monitor| |Aura Sensor V2 | Sleep Monitor| |Pulse | Activity Tracker| |Activite | Activity Tracker| |Activite (Pop, Steel) | Activity Tracker| |Withings Go | Activity Tracker| |Activite Steel HR | Activity Tracker| |Activite Steel HR Sport Edition | Activity Tracker| |Pulse HR | Activity Tracker| |Move | Activity Tracker| |Move ECG | Activity Tracker| |ScanWatch | Activity Tracker| |ScanWatch 2 | Activity Tracker| |ScanWatch Light | Activity Tracker| ' example: Aura Sensor V2 model_id: type: integer description: ' | Value | Description| |---|---| |60 | Aura Dock| |61 | Aura Sensor| |63 | Aura Sensor V2| |51 | Pulse| |52 | Activite| |53 | Activite (Pop, Steel)| |54 | Withings Go| |55 | Activite Steel HR| |59 | Activite Steel HR Sport Edition| |58 | Pulse HR| |90 | Move| |91 | Move ECG| |92 | Move ECG| |93 | ScanWatch| |94 | ScanWatch 2| |95 | ScanWatch Light| ' example: 63 hr: type: object description: Heart Rate (beats per minute). *(Use 'data_fields' to request this data.)* properties: $timestamp: type: integer description: $timestamp represents the epoch value of the heart rate data, value of this key will be the heart rate data rr: type: object description: Respiration Rate (breaths per minute). *(Use 'data_fields' to request this data.)* properties: $timestamp: type: integer description: $timestamp represents the epoch value of the respiration rate data, value of this key will be the respiration rate data snoring: type: object description: Total snoring time (seconds). properties: $timestamp: type: integer sdnn_1: type: object description: Heart rate variability - Standard deviation of the NN over 1 minute (in miliseconds). properties: $timestamp: type: integer rmssd: type: object description: Heart rate variability - Root mean square of the successive differences over "a few seconds" (in miliseconds). properties: $timestamp: type: integer hrv_quality: type: object description: Heart rate variability - quality score. properties: $timestamp: type: integer mvt_score: type: object description: Track the intensity of movement in bed on a minute-by-minute basis. The score ranges from 0 to 255, representing the intensity of movement. This metric is only available for Sleep Analyzer devices in the EU and prescription-based devices in the US (Sleep Rx). properties: $timestamp: type: integer chest_movement_rate: type: object description: Chest movement rate (events per minute). *(Use 'data_fields' to request this data.)* properties: $timestamp: type: integer withings_index: type: object description: 'Withings Sleep Rx (FDA Cleared) allows to estimate gaps in breathing sounds and to generate an index. This index corresponds to the number of breathing events per hour.
ValueDescription
0-15 (events per hour on average)No/Mild
15-30 (events per hour on average)Moderate
> 30 (events per hour on average)Severe
Note: 5 hours of sleep are required in order to calculate the Withings Index.' properties: $timestamp: type: integer breathing_sounds: type: object description: Total time when breathing sounds were tracked. (seconds) *(Use 'data_fields' to request this data.)* properties: $timestamp: type: integer x-codeSamples: - lang: PHP source: " 'get',\n\t'startdate' => 'startdate',\n\t'enddate' => 'enddate',\n\t'data_fields' => 'data_fields',\n\t'meastypes' => 'meastypes'\n]));\n\n$rsp = curl_exec($ch);\ncurl_close($ch);\n\nvar_dump($rsp);\n\n?>" - lang: CURL source: 'curl --header "Authorization: Bearer YOUR_ACCESS_TOKEN" --data "action=get&startdate=startdate&enddate=enddate&data_fields=data_fields&meastypes=meastypes" ''https://wbsapi.withings.net/v2/sleep''' 'https://wbsapi.withings.net/v2/sleep ': post: tags: - sleep description: 'Returns sleep activity summaries, which are an aggregation of all the data captured at high frequency during the sleep activity.

Use the [Sleep v2 - Get](#operation/sleepv2-get) service to get the high frequency data used to build these summaries.

**IMPORTANT**: Please refer to this [page](https://developer.withings.com/developer-guide/v3/data-api/all-available-health-data/#sleep) to check the availability of metrics based on the sleep tracking device used. Some data types are regulated in the EU and US and may not be available in your region. ' summary: Sleep v2 - Getsummary operationId: sleepv2-getsummary parameters: - name: action in: query required: true schema: type: string description: Service action name. Must take the string value ```getsummary```. - name: startdateymd in: query required: true schema: type: string description: 'DO NOT USE WITH FOLLOWING PARAMS: [lastupdate]
Start date. Required if no lastupdate.' format: Y-m-d - name: enddateymd in: query required: true schema: type: string description: 'DO NOT USE WITH FOLLOWING PARAMS: [lastupdate]
End date. Required if startdateymd is provided.' format: Y-m-d - name: lastupdate in: query required: true schema: type: integer description: 'DO NOT USE WITH FOLLOWING PARAMS: [startdateymd, enddateymd]
Timestamp for requesting data that were updated or created after this date.
Useful for data synchronization between systems.
Use this instead of startdateymd + enddateymd.' - name: data_fields in: query required: false schema: type: string description: "List of requested data fields, separated by a comma.
Available data fields are listed below.
Ex: data_fields=total_timeinbed,total_sleep_time,asleepduration

Standard sleep medicine metrics

total_timeinbed
> Total time spent in bed (seconds).

total_sleep_time
> Total time spent asleep. Sum of light, deep and rem durations (seconds).

asleepduration
> Duration of sleep when night comes from external source (seconds).
Light, Deep and Rem sleep durations are null in this case.

lightsleepduration
> Duration in state light sleep (seconds).

remsleepduration
> Duration in state REM sleep (seconds).

deepsleepduration
> Duration in state deep sleep (seconds).

sleep_efficiency
> Ratio of the total sleep time over the time spent in bed.

sleep_latency
> Time spent in bed before falling asleep (seconds).

wakeup_latency
> Time spent in bed after waking up (seconds).

wakeupduration
> Time spent awake (seconds).

wakeupcount
> Number of times the user woke up while in bed. Does not include the number of times the user got out of bed.

waso
> Time spent awake in bed after falling asleep for the 1st time during the night (seconds).

nb_rem_episodes
> Count of the REM sleep phases.


Sleep apnea and breathing disturbances

breathing_disturbances_intensity
> Intensity of breathing disturbances.
Available for all Sleep and Sleep Analyzer devices (wellness metric).

apnea_hypopnea_index
> Medical grade AHI. Average number of hypopnea and apnea episodes per hour, that occured during sleep time.
Only available for devices purchased in Europe and Australia, with the sleep apnea detection feature activated.

withings_index
> Withings Sleep Rx (FDA Cleared) allows to estimate gaps in breathing sounds and to generate an index. This index corresponds to the number of breathing events per hour.\n\n\n
ValueDescription
0-15 (events per hour on average)No/Mild
15-30 (events per hour on average)Moderate
> 30 (events per hour on average)Severe
\n\n\nNote: 5 hours of sleep are required in order to calculate the Withings Index.


Other sleep datapoints and vitals

durationtosleep
> Time to sleep (seconds). (deprecated)

durationtowakeup
> Time to wake up (seconds). (deprecated)

out_of_bed_count
> Number of times the user got out of bed during the night.

hr_average
> Average heart rate. (beats per minute).

hr_min
> Minimal heart rate (beats per minute).

hr_max
> Maximal heart rate (beats per minute)..

rr_average
> Average respiration rate (breaths per minute).

rr_min
> Minimal respiration rate (breaths per minute).

rr_max
> Maximal respiration rate (breaths per minute).

breathing_quality_assessment
> Intensity of breathing disturbances.
Available for all Sleep and Sleep Analyzer devices (wellness metric).

snoring
> Total snoring time (seconds).

snoringepisodecount
> Numbers of snoring episodes of at least one minute.

sleep_score
> Sleep score

night_events
> Summary of sleep events that happened during the sleep activity.\n\nIt is structured as a dictionary, where keys are the type of event, and the value is an array of timestamps relative to the activity startdate.\n\nTypes of events can be one of the following : \n\n
ValueDescription
1got in bed
2fell asleep
3woke up
4got out of bed
5start of asleep period that was manually input
6start of awake period that was manually input
\n\n

mvt_score_avg
> Track the average movement score in bed throughout the night. The score ranges from 0 to 255, representing the intensity of movement. This metric is only available for Sleep Analyzer devices in the EU and prescription-based devices in the US (Sleep Rx).

mvt_active_duration
> Track the duration (in seconds) of movement in bed. Only available for Sleep Analyzer devices (EU) and devices under prescriptions in the US (Sleep Rx)

rmssd_start_avg
> Heart rate variability - Start average

rmssd_end_avg
> Heart rate variability - End average

chest_movement_rate_wellness_average
> Average respiration rate (breaths per minute).

chest_movement_rate_wellness_min
> Minimal respiration rate (breaths per minute).

chest_movement_rate_wellness_max
> Maximal respiration rate (breaths per minute).

breathing_sounds
> Total time when breathing sounds were tracked. (seconds)

breathing_sounds_episode_count
> Numbers of breathing sounds episodes of at least one minute.

chest_movement_rate_average
> Average chest movement rate (events per minute).

chest_movement_rate_min
> Minimal chest movement rate (events per minute).

chest_movement_rate_max
> Maximal chest movement rate (events per minute).

core_body_temperature_min
> Minimal core body temperature (in celsius degrees).

core_body_temperature_max
> Maximal core body temperature (in celsius degrees).

core_body_temperature_avg
> Avenage core body temperature (in celsius degrees).

core_body_temperature_status
> Status of the temperature. *(Use 'data_fields' to request this data)* Value can be: 'unknown', 'usual' or 'elevated'.\n

" - name: Authorization in: header required: true schema: type: string description: 'Used to pass your access token. Must take value: ```Bearer {your access_token}``` Replace {your access_token} with the access_token' responses: 200: description: ' (Click to unfold)' content: application/json: schema: type: object properties: status: type: integer description: Response status. See Status section for details. body: type: object description: Response data. properties: series: type: array items: $ref: '#/components/schemas/sleep_summary_object' more: type: boolean description: To know if there is more data to fetch or not. offset: type: integer description: Offset to use to retrieve the next data. x-codeSamples: - lang: PHP source: " 'getsummary',\n\t'startdateymd' => '2020-07-01',\n\t'enddateymd' => '2020-07-02'\n]));\n\n$rsp = curl_exec($ch);\ncurl_close($ch);\n\nvar_dump($rsp);\n\n?>" - lang: CURL source: 'curl --header "Authorization: Bearer YOUR_ACCESS_TOKEN" --data "action=getsummary&startdateymd=2020-07-01&enddateymd=2020-07-02" ''https://wbsapi.withings.net/v2/sleep ''' components: schemas: sleep_summary_object: type: object properties: id: type: integer example: 12345 timezone: type: string description: Timezone for the date. example: Europe/Paris model: type: integer description: The source for sleep data. Value can be 16 for a tracker or 32 for a Sleep Monitor. example: 16 model_id: type: integer description: ' | Value | Description| |---|---| |60 | Aura Dock| |61 | Aura Sensor| |63 | Aura Sensor V2| |51 | Pulse| |52 | Activite| |53 | Activite (Pop, Steel)| |54 | Withings Go| |55 | Activite Steel HR| |59 | Activite Steel HR Sport Edition| |58 | Pulse HR| |90 | Move| |91 | Move ECG| |92 | Move ECG| |93 | ScanWatch| |94 | ScanWatch 2| |95 | ScanWatch Light| ' example: 51 startdate: type: integer description: The starting datetime for the sleep state data. format: timestamp example: 1594245600 enddate: type: integer description: The end datetime for the sleep data. A single call can span up to 7 days maximum. To cover a wider time range, you will need to perform multiple calls. format: timestamp example: 1594257200 date: type: string description: Date at which the measure was taken or entered. example: '2020-07-09' created: type: integer format: timestamp example: 1594257200 modified: type: integer description: The timestamp of the last modification. format: timestamp example: 1594257200 hash_deviceid: type: string description: 'ID of device that tracked the data. To retrieve information about this device, refer to : User v2 - Getdevice.' example: 892359876fd8805ac45bab078c4828692f0276b1 completed: type: boolean example: true data: type: object description: Details of sleep. properties: total_timeinbed: type: integer description: Total time spent in bed (seconds). *(Use 'data_fields' to request this data.)* total_sleep_time: type: integer description: Total time spent asleep. Sum of light, deep and rem durations (seconds). *(Use 'data_fields' to request this data.)* asleepduration: type: integer description: Duration of sleep when night comes from external source (seconds).
Light, Deep and Rem sleep durations are null in this case. *(Use 'data_fields' to request this data.)* lightsleepduration: type: integer description: Duration in state light sleep (seconds). *(Use 'data_fields' to request this data.)* remsleepduration: type: integer description: Duration in state REM sleep (seconds). *(Use 'data_fields' to request this data.)* deepsleepduration: type: integer description: Duration in state deep sleep (seconds). *(Use 'data_fields' to request this data.)* sleep_efficiency: type: number description: Ratio of the total sleep time over the time spent in bed. *(Use 'data_fields' to request this data.)* sleep_latency: type: integer description: Time spent in bed before falling asleep (seconds). *(Use 'data_fields' to request this data.)* wakeup_latency: type: integer description: Time spent in bed after waking up (seconds). *(Use 'data_fields' to request this data.)* wakeupduration: type: integer description: Time spent awake (seconds). *(Use 'data_fields' to request this data.)* wakeupcount: type: integer description: Number of times the user woke up while in bed. Does not include the number of times the user got out of bed. *(Use 'data_fields' to request this data.)* waso: type: integer description: Time spent awake in bed after falling asleep for the 1st time during the night (seconds). *(Use 'data_fields' to request this data.)* nb_rem_episodes: type: integer description: Count of the REM sleep phases. *(Use 'data_fields' to request this data.)* durationtosleep: type: integer description: Time to sleep (seconds). (deprecated) *(Use 'data_fields' to request this data.)* durationtowakeup: type: integer description: Time to wake up (seconds). (deprecated) *(Use 'data_fields' to request this data.)* out_of_bed_count: type: integer description: Number of times the user got out of bed during the night. *(Use 'data_fields' to request this data.)* hr_average: type: integer description: Average heart rate. (beats per minute).*(Use 'data_fields' to request this data.)* hr_min: type: integer description: Minimal heart rate (beats per minute). *(Use 'data_fields' to request this data.)* hr_max: type: integer description: Maximal heart rate (beats per minute).. *(Use 'data_fields' to request this data.)* rr_average: type: integer description: Average respiration rate (breaths per minute). *(Use 'data_fields' to request this data.)* rr_min: type: integer description: Minimal respiration rate (breaths per minute). *(Use 'data_fields' to request this data.)* rr_max: type: integer description: Maximal respiration rate (breaths per minute). *(Use 'data_fields' to request this data.)* breathing_quality_assessment: type: integer description: 'Intensity of breathing disturbances.
Available for all Sleep and Sleep Analyzer devices (wellness metric). ' breathing_disturbances_intensity: type: integer description: 'Intensity of breathing disturbances.
Available for all Sleep and Sleep Analyzer devices (wellness metric). ' snoring: type: integer description: Total snoring time (seconds). snoringepisodecount: type: integer description: Numbers of snoring episodes of at least one minute. sleep_score: type: integer description: Sleep score night_events: type: array description: "Summary of sleep events that happened during the sleep activity.\n\nIt is structured as a dictionary, where keys are the type of event, and the value is an array of timestamps relative to the activity startdate.\n\nTypes of events can be one of the following : \n\n
ValueDescription
1got in bed
2fell asleep
3woke up
4got out of bed
5start of asleep period that was manually input
6start of awake period that was manually input
\n\n" apnea_hypopnea_index: type: integer description: 'Medical grade AHI. Average number of hypopnea and apnea episodes per hour, that occured during sleep time.
Only available for devices purchased in Europe and Australia, with the sleep apnea detection feature activated. ' mvt_score_avg: type: integer description: Track the average movement score in bed throughout the night. The score ranges from 0 to 255, representing the intensity of movement. This metric is only available for Sleep Analyzer devices in the EU and prescription-based devices in the US (Sleep Rx). mvt_active_duration: type: integer description: Track the duration (in seconds) of movement in bed. Only available for Sleep Analyzer devices (EU) and devices under prescriptions in the US (Sleep Rx) rmssd_start_avg: type: number description: Heart rate variability - Start average rmssd_end_avg: type: number description: Heart rate variability - End average chest_movement_rate_wellness_average: type: integer description: Average respiration rate (breaths per minute). *(Use 'data_fields' to request this data.)* chest_movement_rate_wellness_min: type: integer description: Minimal respiration rate (breaths per minute). *(Use 'data_fields' to request this data.)* chest_movement_rate_wellness_max: type: integer description: Maximal respiration rate (breaths per minute). *(Use 'data_fields' to request this data.)* withings_index: type: integer description: 'Withings Sleep Rx (FDA Cleared) allows to estimate gaps in breathing sounds and to generate an index. This index corresponds to the number of breathing events per hour.
ValueDescription
0-15 (events per hour on average)No/Mild
15-30 (events per hour on average)Moderate
> 30 (events per hour on average)Severe
Note: 5 hours of sleep are required in order to calculate the Withings Index.' breathing_sounds: type: integer description: Total time when breathing sounds were tracked. (seconds) *(Use 'data_fields' to request this data.)* breathing_sounds_episode_count: type: integer description: Numbers of breathing sounds episodes of at least one minute. *(Use 'data_fields' to request this data.)* chest_movement_rate_average: type: integer description: Average chest movement rate (events per minute). *(Use 'data_fields' to request this data.)* chest_movement_rate_min: type: integer description: Minimal chest movement rate (events per minute). *(Use 'data_fields' to request this data.)* chest_movement_rate_max: type: integer description: Maximal chest movement rate (events per minute). *(Use 'data_fields' to request this data.)* core_body_temperature_min: type: number description: Minimal core body temperature (in celsius degrees). *(Use 'data_fields' to request this data.)* core_body_temperature_max: type: number description: Maximal core body temperature (in celsius degrees). *(Use 'data_fields' to request this data.)* core_body_temperature_avg: type: number description: Avenage core body temperature (in celsius degrees). *(Use 'data_fields' to request this data.)* core_body_temperature_status: type: string description: "Status of the temperature. *(Use 'data_fields' to request this data)* Value can be: 'unknown', 'usual' or 'elevated'.\n \n\n| Value|\n|---|\n|unknown|\n|usual|\n|elevated|\n" x-tagGroups: - name: Api Reference Content tags: - oauth2 - dropshipment - order - user - measure - heart - stetho - sleep - notify - survey - answers - signature - rawdata - device - models - response_status - Glossary - nudge - nudgecampaign