Multiple Sleep Documents
curl --location --request GET 'https://api.ouraring.com/v2/usercollection/sleep?start_date=2021-11-01&end_date=2021-12-01&fields=day,score' \--header 'Authorization: Bearer <token>'import requestsurl = 'https://api.ouraring.com/v2/usercollection/sleep'params={ 'start_date': '2021-11-01', 'end_date': '2021-12-01', 'fields': 'day,score'}headers = { 'Authorization': 'Bearer <token>'}response = requests.request('GET', url, headers=headers, params=params)print(response.text)var myHeaders = new Headers();myHeaders.append('Authorization', 'Bearer <token>');var requestOptions = { method: 'GET', headers: myHeaders,};fetch('https://api.ouraring.com/v2/usercollection/sleep?start_date=2021-11-01&end_date=2021-12-01&fields=day,score', requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));OkHttpClient client = new OkHttpClient().newBuilder() .build();Request request = new Request.Builder() .url("https://api.ouraring.com/v2/usercollection/sleep?start_date=2021-11-01&end_date=2021-12-01&fields=day,score") .method("GET", null) .addHeader("Authorization", "Bearer <token>") .build();Response response = client.newCall(request).execute();Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Responses
Section titled “Responses”Successful Response
object
object
Unique identifier of the object.
Bedtime end of the sleep.
Bedtime start of the sleep.
Day that the sleep belongs to.
Object defining a recorded sample.
object
Interval in seconds between the sampled items.
Recorded sample items.
Timestamp when the sample recording started.
Object defining a recorded sample.
object
Interval in seconds between the sampled items.
Recorded sample items.
Timestamp when the sample recording started.
Flag indicating if a low battery alert occurred.
ECore sleep period identifier.
Object defining readiness.
object
Contributors of the readiness score.
object
Oura Sleep Staging Algorithms. v1 = original aka legacy aka OSSA 1.0, v2 = latest sleep algorithm
Possible sleep analysis reasons.
Duration spent in bed in seconds.
Possible sleep period types. ‘deleted’ = deleted sleep by user. ‘sleep’ = user confirmed sleep / nap, min 15 minutes, max 3 hours, contributes to daily scores ‘late_nap’ = user confirmed sleep / nap, min 15 minutes, ended after sleep day change (6 pm), contributes to next days daily scores ‘long_sleep’ = sleep that is long enough (>3h) to automatically contribute to daily scores ‘rest’ = Falsely detected sleep / nap, rejected in confirm prompt by user
Example
{ "data": [ { "sleep_algorithm_version": "v1", "sleep_analysis_reason": "foreground_sleep_analysis", "type": "deleted" } ]}Client Exception
Unauthorized access exception. Usually means the access token is expired, malformed or revoked.
Access forbidden. Usually means the user’s subscription to Oura has expired and their data is not available via the API.
Validation Error
object
object
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ]}Request Rate Limit Exceeded.