API reference
Sleep
{ "name" "get user sleep data", "method" "get", "url" "https //app api spikeapi com/v3/queries/sleeps", "description" "endpoint retrieves user sleep data including, but not limited to sleep interruptions, breathing rate or heart rates over the night sleep stages total summed durations are also available, but if detailed breakdown of sleep stages is required you should use sleep records by id endpoint \n\nspike sleep score is part of the premium spike analytics package which is available for customers starting with tier 2 sandbox customers looking to to evaluate spike analytics can contact the spike team for testing access \n", "tab" "examples", "examples" { "languages" \[ { "id" "co nququth xyjnpwxess", "language" "curl", "code" "curl request get \\\\\n url https //app api spikeapi com/v3/queries/sleeps \\\\\n header 'accept application/json, application/problem+json' \\\\\n header 'authorization bearer eyjhbgcioijiuzi1niisinr5cci6ikpxvcj9 eyjpc3mioii5otk5osisinn1yii6ime5zju3odazmgixythkywuifq djhtpuc7gakk03rtfqxufjzrbnpfwjgvjnfu7yuy4a4'", "customlabel" "" } ], "selectedlanguageid" "co nququth xyjnpwxess" }, "results" { "languages" \[ { "id" "qfu6epz 8pp15gg8ebsdx", "language" "200", "code" "{\n \\"from\\" \\"2025 04 28t00 00 00z\\",\n \\"to\\" \\"2025 05 01t00 00 00z\\",\n \\"timezone\\" \\"local\\",\n \\"sleeps\\" \[\n {\n \\"record id\\" \\"0134ff3c 3f60 8c46 8e4e c0dd218c4e3a\\",\n \\"modified at\\" \\"2025 04 30t12 00 26z\\",\n \\"start at timestamp\\" \\"2025 04 28t17 30 00z\\",\n \\"end at timestamp\\" \\"2025 04 29t03 34 00z\\",\n \\"duration\\" 36240000,\n \\"user time offset minutes\\" 180,\n \\"input method\\" \\"device\\",\n \\"metrics\\" {\n \\"heartrate max\\" 104,\n \\"heartrate min\\" 47,\n \\"heartrate\\" 56,\n \\"hrv sdnn\\" 40,\n \\"spo2\\" 95 75,\n \\"spo2 max\\" 98,\n \\"spo2 min\\" 92,\n \\"sleep duration\\" 56280000,\n \\"sleep duration deep\\" 3600000,\n \\"sleep duration light\\" 15870000,\n \\"sleep duration rem\\" 6450000,\n \\"sleep duration awake\\" 3480000,\n \\"sleep interruptions\\" 6,\n \\"sleep breathing rate\\" 17 21,\n \\"sleep breathing rate min\\" 14 5,\n \\"sleep breathing rate max\\" 20 5,\n \\"skin temperature\\" 36 01,\n \\"skin temperature max\\" 36 01,\n \\"skin temperature min\\" 36 01\n },\n \\"provider source\\" \\"apple healthkit sleep aggregation\\",\n \\"provider source type\\" \\"activity\\",\n \\"provider slug\\" \\"apple\\",\n \\"source\\" {},\n \\"sleep id\\" \\"2327f03a 80e1 5f96 ac8b abb2da42fa67\\",\n \\"score\\" 39\n },\n {\n \\"record id\\" \\"0134ff3d a81b 8446 8bd5 b924158b39ad\\",\n \\"modified at\\" \\"2025 04 30t12 00 26z\\",\n \\"start at timestamp\\" \\"2025 04 29t18 30 00z\\",\n \\"end at timestamp\\" \\"2025 04 30t04 02 00z\\",\n \\"duration\\" 34320000,\n \\"user time offset minutes\\" 180,\n \\"input method\\" \\"device\\",\n \\"metrics\\" {\n \\"heartrate max\\" 100,\n \\"heartrate min\\" 52,\n \\"heartrate\\" 62,\n \\"hrv sdnn\\" 45,\n \\"spo2\\" 96 3333,\n \\"spo2 max\\" 98,\n \\"spo2 min\\" 95,\n \\"sleep duration\\" 56700000,\n \\"sleep duration deep\\" 3060000,\n \\"sleep duration light\\" 17040000,\n \\"sleep duration rem\\" 5700000,\n \\"sleep duration awake\\" 1140000,\n \\"sleep interruptions\\" 5,\n \\"sleep breathing rate\\" 16 28,\n \\"sleep breathing rate min\\" 13 5,\n \\"sleep breathing rate max\\" 19,\n \\"skin temperature\\" 36 05,\n \\"skin temperature max\\" 36 05,\n \\"skin temperature min\\" 36 05\n },\n \\"provider source\\" \\"apple healthkit sleep aggregation\\",\n \\"provider source type\\" \\"activity\\",\n \\"provider slug\\" \\"apple\\",\n \\"source\\" {},\n \\"sleep id\\" \\"021e61f0 021d 5af3 9b44 0faf83ad9198\\",\n \\"score\\" 40\n }\n ]\n}", "customlabel" "" } ], "selectedlanguageid" "qfu6epz 8pp15gg8ebsdx" }, "request" { "pathparameters" \[], "queryparameters" \[ { "name" "from", "kind" "required", "type" "string", "description" "the start date of the query based on the user timezone; inclusive", "" "required" }, { "name" "providers", "kind" "optional", "type" "array", "description" "allowed values\ health connect; fitbit; garmin; huawei; whoop; suunto; apple; oura; polar; withings", "" "allowed values\ health connect; fitbit; garmin; huawei; whoop; suunto; apple; oura; polar; withings" }, { "name" "timezone", "kind" "optional", "type" "string", "description" "the timezone to use for responses, it would convert the internal timestamp from utc to this timezone; if you leave empty it would use the user's timezone\nexample america/new york", "" "the timezone to use for responses, it would convert the internal timestamp from utc to this timezone; if you leave empty it would use the user's timezone\nexample america/new york" }, { "name" "to", "kind" "required", "type" "string", "description" "the end date of the query based on the user timezone; non inclusive\n", "" "required" } ], "headerparameters" \[ { "name" "authorization", "kind" "required", "type" "string", "description" "provide your bearer token in the authorization header when making requests to protected resources ", "" "authorization" } ], "bodydataparameters" \[], "formdataparameters" \[] }, "currentnewparameter" { "label" "query parameter", "value" "queryparameters" }, "hastryitout" false, "response" \[ { "name" "from", "kind" "optional", "type" "string", "description" "" }, { "name" "sleeps", "kind" "optional", "type" "object", "description" "", "children" \[ { "name" "duration", "kind" "optional", "type" "string", "description" "" }, { "name" "end at timestamp", "kind" "optional", "type" "string", "description" "" }, { "name" "input method", "kind" "optional", "type" "string", "description" "" }, { "name" "is source aggregated", "kind" "optional", "type" "boolean", "description" "" }, { "name" "metrics", "kind" "optional", "type" "object", "description" "" }, { "name" "modified at", "kind" "optional", "type" "string", "description" "" }, { "name" "provider slug", "kind" "optional", "type" "string", "description" "" }, { "name" "provider source", "kind" "optional", "type" "string", "description" "" }, { "name" "provider source type", "kind" "optional", "type" "string", "description" "" }, { "name" "record id", "kind" "optional", "type" "string", "description" "" }, { "name" "source", "kind" "optional", "type" "object", "description" "", "children" \[ { "name" "device manufacturer", "kind" "optional", "type" "string", "description" "" }, { "name" "device model", "kind" "optional", "type" "string", "description" "" }, { "name" "device product", "kind" "optional", "type" "string", "description" "" }, { "name" "device version", "kind" "optional", "type" "string", "description" "" }, { "name" "source bundle identifier", "kind" "optional", "type" "string", "description" "" }, { "name" "source os version", "kind" "optional", "type" "string", "description" "" }, { "name" "source product", "kind" "optional", "type" "string", "description" "" }, { "name" "source version", "kind" "optional", "type" "string", "description" "" } ] }, { "name" "score", "kind" "optional", "type" "integer", "description" "" }, { "name" "sleep id", "kind" "optional", "type" "string", "description" "" }, { "name" "stages", "kind" "optional", "type" "object", "description" "", "children" \[ { "name" "duration", "kind" "optional", "type" "integer", "description" "" }, { "name" "end at", "kind" "optional", "type" "string", "description" "" }, { "name" "metrics", "kind" "optional", "type" "object", "description" "" }, { "name" "samples", "kind" "optional", "type" "object", "description" "", "children" \[ { "name" "durations", "kind" "optional", "type" "array", "description" "" }, { "name" "offsets", "kind" "optional", "type" "array", "description" "" }, { "name" "values", "kind" "optional", "type" "object", "description" "" } ] }, { "name" "stage", "kind" "optional", "type" "string", "description" "" }, { "name" "start at", "kind" "optional", "type" "string", "description" "" } ] } ] }, { "name" "timezone", "kind" "optional", "type" "string", "description" "", "children" \[] }, { "name" "to", "kind" "optional", "type" "string", "description" "", "children" \[] } ] }