For the complete documentation index, see llms.txt. This page is also available as Markdown.

How do I dedupe sleep webhooks with the same start time?

Use the summary_id field under metadata to uniquely identify and update sleep records, rather than the start_time/end_time pair.

Use the summary_id field under metadata to uniquely identify and update sleep records, rather than the start_time/end_time pair. A sleep session can be re-sent with an extended end time but the same summary_id, which is why the timestamp pair breaks dedup.

Recommended approach:

  • Match on summary_id first, falling back to start/end times only when summary_id is absent.

  • Sleep payloads return one record per session.

  • For daily summaries (where steps, distance, calories, and temperature delta live), query /v2/daily with to_webhook=false and with_samples=false.

  • To compute a day's total sleep, use the session whose end_time falls in the morning of the target date (filtering naps via the is_nap flag), rather than summing overlapping sessions. This matches how providers report nightly sleep.

Last updated

Was this helpful?