September 3, 2026 · 3 min read

Time in bed

How it is merged from in-bed, stage, and awake records, why it is the one sleep field every source can supply, and what to build.

What sleep_in_bed_duration measures

sleep_in_bed_duration is the number of minutes in the sleep day covered by any in-bed, asleep, stage, or awake record from the night’s source, with overlaps merged. It is the widest sleep measure and the one that every source, including the phone estimate, can supply.

Fieldsleep_in_bed_duration
UnitMinutes
ReportedDaily, one value per night
Window6pm to 6pm, profile local time. Dated by the morning the window ends.
Wearable requiredNo
APIGET /api/v1/profile/biomarker/{externalId}?categories=sleep&types=sleep_in_bed_duration plus a date range
WebhookBiomarkerCreatedIntegrationEvent. Entries update in place, upsert on id.

Data sources

The same sources and ranking as sleep duration. What differs is which records contribute:

Source typeIn-bed time is built from
Stages plus in-bed (watches, rings)The union of in-bed, light, deep, REM, and awake records
Asleep plus in-bedThe union of asleep, awake, and in-bed records
In-bed only, including the phone estimateThe in-bed window itself
Totals-only providers (WHOOP)The provider’s in-bed total

How Sahha calculates sleep_in_bed_duration

  1. Collect every in-bed, stage, asleep, and awake record from the night’s winning source that falls in the 6pm to 6pm window.
  2. Merge overlapping and touching records into runs, so a source that reports both a coarse in-bed period and fine stages over the same hours is counted once.
  3. Sum the runs. Gaps between runs, where the user was up, are not counted.
  4. If the source has no timestamped records but reports an in-bed total, use that.

Absence means no sleep record from any source and no qualifying phone estimate.

Interpreting the value

It is an upper bound on sleep. Duration can never exceed it. The gap between the two is the user’s awake-in-bed time.

For phone-only users it is the whole story. With no stages, in-bed and duration are equal, and this field is the honest one to show, labelled as time in bed rather than sleep.

Naps widen it. A 40-minute afternoon nap recorded by a watch adds 40 minutes here and to duration, but not to bed or wake times.

Time in bed is not a score factor and has no trend or comparison. It feeds sleep efficiency as the denominator.

Use cases

The phone-only sleep tile. Show time in bed with an “estimated” label for users whose source is the phone estimate, instead of showing sleep duration that happens to equal it.

GET /api/v1/profile/biomarker/{externalId}?categories=sleep&types=sleep_in_bed_duration&startDateTime=2026-08-26&endDateTime=2026-09-02

Awake-in-bed minutes. In-bed minus duration, for wearable users, as the plain-language version of efficiency.

Limitations

  • Includes naps and split sleep anywhere in the window.
  • Source runs can be inflated by a Sleep schedule. An iPhone Sleep Focus schedule writes in-bed for the scheduled window whether or not the user was in bed, when no Watch is present to correct it.
  • Absence is not zero.

Related