Docs

Insights

Get sleep insights

Your sleep insights as the app shows them: per period (day, week or month) a score and rating with metrics (total sleep, efficiency, stages, sleep debt, consistency, breathing, heart rate, HRV and more) and comparisons to the prior period.

GET
/v1/insights

For days, the anchor day (or every day, with include_all_sessions) carries its sessions: onset and wake, sleep stages and heart rate / breath rate / HRV per epoch (each session's epoch_seconds gives the length, usually 30 s), and each session_id (for rate_sleep_sessions). Omit granularity for the default bundle (14 days, this and last week, this and last month).

Request parameters

Headers
Authorization string required

Your API key as a bearer token: Bearer os_…. Make one on the API keys page; see Authentication.

Query parameters
  • granularity enum<string>

    Period size. Omit for the default bundle.

    Possible values: day week month

  • anchor string pattern ^\d{4}-\d{2}-\d{2}$

    YYYY-MM-DD inside the last period to return. Defaults to today.

  • count integer min 1max 60

    Periods to return, ending at the anchor (1–60). Defaults: day 14, week 8, month 6.

  • include_all_sessions boolean

    Day granularity only: every day's sessions with their per-epoch arrays, not just the anchor day's. At most 31 days with this on.

Response parameters

200 OK application/json
  • user_id string required
  • timezone string required
  • granularities record<string, object> required

    Per granularity (day / week / month): periods with scores, metrics and sessions

Errors

Every error answers { "error": { "code", "message" } }.

StatusCodeMeaning
400invalidInvalid input.
401unauthorizedMissing or unsupported API key.
403forbiddenNot allowed on this device or user.
429rate_limitedRate limit exceeded.
503unavailableNot available for this account.
Also an MCP tool: get_insights