> 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/data-model-fields-and-units/hypnogram-single-timestamp-reconstruction.md).

# How do I build sleep stage charts from hypnogram samples?

**Yes, you can build a sleep stage chart from single-timestamp hypnogram samples.** Each sample carries a single start timestamp and forms a continuous series, where the start of each sample is the end of the previous one.

To reconstruct stage intervals (and build an Apple-style sleep stage chart):

{% stepper %}
{% step %}
**Treat consecutive sample timestamps as segment boundaries.**
{% endstep %}

{% step %}
Run the final sleep stage from its start timestamp to the sleep session's metadata `end_time`.
{% endstep %}
{% endstepper %}

The `end_time` marks the end of the whole session and may include trailing awake time, denoted by a final awake hypnogram sample.

For the sleep payload structure, see the [data models reference](https://docs.tryterra.co/reference/health-and-fitness-api/data-models).


---

# 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/data-model-fields-and-units/hypnogram-single-timestamp-reconstruction.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.
