Sleep resources are segments of sleep that occur during a specific period of time.

Get a list of sleeps the user has
GET https://api.humanapi.co/v1/human/sleeps

Returns a single sleep
GET https://api.humanapi.co/v1/human/sleeps/{id}

Response Properties

PropertyTypeDescription
idStringThe id of the resource.
userIdString[deprecated - use humanId]
humanIdStringUnique user identifier
dayDateThe day the sleep was recorded
startTimeDateThe original start date and time of the sleep segment in UTC time
endTimeDateThe original end date and time of the sleep segment in UTC time
tzOffsetStringThe offset from UTC time in +/-hh:mm (e.g. -04:00)
sourceStringThe id of the originating service
mainSleepBooleanA boolean value indicating if this sleep was the main sleep of the day (default true when not specified by source)
timeAsleepNumberThe time asleep during the segment (in minutes)
timeAwakeNumberThe time awake during the segment (in minutes).
**Property unavailable for iHealth. Will return 0 as default value
efficiencyNumberThe efficiency score
**Property unavailable for Apple Health. Will return 0 as default value
timeToFallAsleepNumberThe number of minutes it took to fall asleep.
**Property unavailable for Apple Health, iHealth. Will return 0 as default value
timeAfterWakeupNumberThe number of minutes in bed after waking up.
**Property unavailable for Apple Health, iHealth. Will return 0 as default value
timeInBedNumberThe total number of minutes spent in bed.
**Property unavailable for iHealth. Will return 0 as default value
numberOfWakeupsNumberThe number of times the user woke up while in bed.
**Property unavailable for iHealth. Will return 0 as default value
updatedAtDateThe time the measurement was updated on the Human API server
createdAtDateThe time the measurement was created on the Human API server
timeSeriesObjectTime series data for the sleep, such as quality. See below for details.

📘

Time Series

Add time_series=true to get time series data for sleeps. See below for details.

Query Parameters

ParameterDescription
time_seriesAdd 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:

PropertyDescription
typeType of data, indexed with fixed time interval (See intervalInMillis) or timestamped.
intervalInMillisIf the type is indexed this indicates the number of milliseconds between each value.
valuesThe array of values, single values (indexed) or key-value pairs* (timestamped).

🚧

Timestamp represents the number of seconds from startTime.

Standard Series

Some series have standardized values across sources. Standard series are listed below.

SeriesValues
state0: wide awake, 1: awake, 2: light sleep, 3: regular sleep, 4: deep sleep, 5: REM sleep
Language
Click Try It! to start a request and see the response here!