Sleep resources are segments of sleep that occur during a specific period of time.
Get a list of sleeps the user has
Returns a single sleep
|id||String||The id of the resource.|
|userId||String||[deprecated - use humanId]|
|humanId||String||Unique user identifier|
|day||Date||The day the sleep was recorded|
|startTime||Date||The original start date and time of the sleep segment in UTC time|
|endTime||Date||The original end date and time of the sleep segment in UTC time|
|tzOffset||String||The offset from UTC time in +/-hh:mm (e.g. -04:00)|
|source||String||The source service for the measurement, where it was created|
|mainSleep||Boolean||A boolean value indicating if this sleep was the main sleep of the day (default true when not specified by source)|
|timeAsleep||Number||The time asleep during the segment (in minutes)|
|timeAwake||Number||The time awake during the segment (in minutes)|
|efficiency||Number||The efficiency score|
|timeToFallAsleep||Number||The number of minutes it took to fall asleep|
|timeAfterWakeup||Number||The number of minutes in bed after waking up|
|timeInBed||Number||The total number of minutes spent in bed|
|numberOfWakeups||Number||The number of times the user woke up while in bed|
|updatedAt||Date||The time the measurement was updated on the Human API server|
|createdAt||Date||The time the measurement was created on the Human API server|
|timeSeries||Object||Time series data for the sleep, such as quality. See below for details|
Add time_series=true to get time series data for sleeps. See below for details.
|time_series||Add time_series=true to get time series data for sleeps. See below for details|
Time Series Object
The timeSeries object can have multiple embedded objects. In the example below there is one object called “quality”, some services might provide other properties such as “heartRate” or “breathing” etc.
The embedded objects have the following properties:
|type||Type of data, indexed with fixed time interval (See intervalInMillis) or timestamped.|
|intervalInMillis||If the type is indexed this indicates the number of milliseconds between each value.|
|values||The array of values, single values (indexed) or key-value pairs* (timestamped).|
Timestamp represents the number of seconds from startTime.
Some series have standardized values across sources. Standard series are listed below.
|state||0: wide awake, 1: awake, 2: light sleep, 3: regular sleep, 4: deep sleep, 5: REM sleep|