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

Property

Type

Description

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 id of the originating service

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

📘

Time Series

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

Query Parameters

Parameter

Description

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:

Property

Description

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.

Standard Series

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

Series

Values

state

0: wide awake, 1: awake, 2: light sleep, 3: regular sleep, 4: deep sleep, 5: REM sleep

Language
Response
Click Try It! to start a request and see the response here!