API v2
...
Metrics
API Version 2 (V2)

Sleep

You can retrieve user sleep data by user_id and filter by date range


Get a sleep data by user_id
GET
Request
Query Parameters
user_id
String
required
User ID returned by add integration request. This key should be stored in your database against the user and used for all interactions with the Spike API.
start_date
String
required
Date from in YYYY-MM-DD format
end_date
String
required
Date to in YYYY-MM-DD format
Header Parameters
authorizationtoken
String
optional
Client access token (deprecated)
x-spike-auth
String
required
Client access token
Python
Node.js
Ruby
Java
Curl
Responses
200


On older Apple devices that don't support sleep phases, unknown phase appears. It returns "inBed" or "asleepUnspecified" status.



Fields

Sleep.date

  • Type: String
  • Format: YYYY-MM-DD
  • Example: 2021-05-01

The date when the sleep period ended

Sleep.bedtime_start

  • Type: String
  • Format: Date time, YYYY-MM-DDThh:mm:ss
  • Example: 2021-05-01T01:12:13

Local time when the sleep period started

Sleep.bedtime_end

  • Type: String
  • Format: Date time, YYYY-MM-DDThh:mm:ss
  • Example: 2021-05-01T09:36:13

Local time when the sleep period ended

Sleep.timezone_offset

  • Type: Int
  • Unit: Seconds
  • Example: 2400

Time zone offset from UTC as seconds

Sleep.bedtime_duration

  • Type: Int
  • Unit: Seconds
  • Example: 28000

Total duration of the sleep period (duration = bedtime_end - bedtime_start)

Sleep.total_sleep

  • Type: Int
  • Unit: Seconds
  • Example: 26000

Total amount of sleep registered during the sleep period (total = rem + light + deep)

Sleep.awake

  • Type: Int
  • Unit: Seconds
  • Example: 2800

Total amount of awake time registered during the sleep period

Sleep.light

  • Type: Int
  • Unit: Seconds
  • Example: 18000

Total amount of light sleep registered during the sleep period

Sleep.rem

  • Type: Int
  • Unit: Seconds
  • Example: 5000

Total amount of rem sleep registered during the sleep period

Sleep.deep

  • Type: Int
  • Unit: Seconds
  • Example: 3000

Total amount of deep sleep registered during the sleep period

Sleep.hr_lowest

  • Type: Int
  • Unit: Beats per minute
  • Example: 50

The lowest heart rate (5 minutes sliding average) registered during the sleep period

Sleep.hr_average

  • Type: Int
  • Unit: Beats per minute
  • Example: 55

The average heart rate registered during the sleep period

Sleep.efficiency

  • Type: Float
  • Range: 0.0 - 1.0
  • Example: 0.9

Sleep efficiency is the coefficient of the sleep period spent asleep (total_sleep / bedtime_duration)

Sleep.latency

  • Type: Int
  • Unit: Seconds
  • Example: 758

Detected latency from bedtime_start to the beginning of the first five minutes of persistent sleep

Sleep.temperature_delta

  • Type: Float
  • Unit: Celcius
  • Example: -0.1

Skin temperature deviation from the long-term temperature average

Sleep.average_hrv

  • Type: Int
  • Unit: Milliseconds
  • Example: 78

The average HRV(Heart Rate Variability) calculated with rMSSD method

Sleep.respiratory_rate

  • Type: Float
  • Unit: Breaths per minute
  • Example: 14

Average respiratory rate

Sleep.standardized_sleep_score

  • Type: Int
  • Range: 0-100
  • Example: 88

Standardized sleep score

Sleep.source_specific_sleep_score

  • Type: Int
  • Range: 0-100
  • Example: 88

Specific sleep score by data provider

Sleep.levels.date_time

  • Type: String
  • Format: Date time, YYYY-MM-DDThh:mm:ss
  • Example: 2021-05-01T01:52:13

Date and time the user started in sleep level

Sleep.levels.level

  • Type: String
  • Values: deep | light | rem | awake

The sleep level the user entered

Sleep.levels.seconds

  • Type: Int
  • Unit: Seconds
  • Example: 320

The length of time the user was in the sleep level