> For the complete documentation index, see [llms.txt](https://docs.tryterra.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tryterra.co/faq/help-topics/data-api-sdk/webhooks-dedup-and-sync-reliability/sleep-dedup-summary-id.md).

# 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. 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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tryterra.co/faq/help-topics/data-api-sdk/webhooks-dedup-and-sync-reliability/sleep-dedup-summary-id.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
