Insights

Insights and sleep sessions

Read your sleep scores, metrics and nights, and rate nights good or bad.

Get sleep insights returns your sleep data as the Orion app shows it. Rate nights marks nights good or bad.

Insights are always your own. A key cannot read another person's insights.

What insights return

GET /v1/insights

For each period (a day, a week or a month) you get:

  • a score and a rating;
  • metrics: total sleep, efficiency, sleep stages, sleep debt, consistency, breathing, heart rate, heart rate variability (HRV) and more;
  • comparisons with the period before.

For days, the answer also carries the sleep sessions of the anchor day. A sleep session is one stretch of sleep in the bed, usually one night. Each session has:

  • the time you fell asleep (onset) and the time you woke;
  • sleep stages, heart rate, breath rate and HRV per epoch;
  • a session_id, which Rate nights takes.

An epoch is a fixed slice of the night. Each session's epoch_seconds gives its length, usually 30 seconds, so a value at index 10 covers seconds 300 to 330 of the session. Nightly averages, minimums and maximums come with the series. There is no per-second data.

The response is keyed by granularity:

{
	"user_id": "9b2e4f10-5a7c-4d3b-8e61-0c9d2a4b7f33",
	"timezone": "America/Los_Angeles",
	"granularities": {
		"day": {},
		"week": {},
		"month": {}
	}
}
JSON

Each granularity holds its periods, with their scores, metrics and sessions. The reference page lists the fields.

Choose the window

Three query parameters pick which periods come back:

ParameterWhat it doesDefault
granularityThe period size: day, week or month.The default bundle (below)
anchorA date, YYYY-MM-DD, inside the last period to return.Today
countHow many periods to return, ending at the anchor. 1 to 60.14 days, 8 weeks or 6 months

Leave out granularity for the default bundle: the last 14 days, this week and last week, and this month and last month.

The last four weeks, up to the week of 30 November 2026:

curl "https://api.orionsleep.com/v1/insights?granularity=week&anchor=2026-11-30&count=4" \
  -H "Authorization: Bearer $ORION_API_KEY"
Shell

Every night's sessions

By default only the anchor day carries its sessions. Add include_all_sessions=true to get the sessions, with their per-epoch series, of every day in the window. It needs granularity=day and returns at most 31 days per call. For a longer range, make several calls with consecutive anchors.

curl "https://api.orionsleep.com/v1/insights?granularity=day&count=7&include_all_sessions=true" \
  -H "Authorization: Bearer $ORION_API_KEY"
Shell

Rate nights

Rate nights marks your own nights good or bad. Send one session_id, or several in session_ids, with one rating.

POST /v1/sleep-sessions/ratings
{
	"rating": "good",
	"session_ids": ["5d0b7c3e-91a2-4f6d-b8e4-2c7a1f9e0d36", "a8e3f512-6c4b-4d97-9e20-7b1d5c3f8a64"]
}
JSON

Each id gets its own result. One failing does not stop the others:

{
	"results": [
		{ "session_id": "5d0b7c3e-91a2-4f6d-b8e4-2c7a1f9e0d36", "ok": true, "status": "rated" },
		{ "session_id": "a8e3f512-6c4b-4d97-9e20-7b1d5c3f8a64", "ok": false, "status": "not_found" }
	]
}
JSON
StatusMeaning
ratedThe rating was saved.
not_foundThe id is not one of your nights.
deletedThe night was deleted.
errorSaving failed. Try again.