> 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/historical-data-and-backfill/sdk-backfill-historical-retrieval.md).

# Can the SDK retrieve historical data, and over what period?

**SDK-provider data can flow automatically once a user connects, if the scheduler is on.** When you call `initConnection` with `schedulerOn = true` (the default), the Android SDK uses WorkManager to periodically fetch new data and send it to your webhook automatically (default intervals: activity every 20 minutes, daily/body/sleep/nutrition every 8 hours; configurable server-side). With `schedulerOn = false`, no automatic fetch happens and your app must call the getter functions itself.

To backfill specific historical ranges on demand, **call the SDK retrieval functions (`getDaily`, `getActivity`, `getSleep`, `getBody`, `getNutrition`) with a `startDate` and `endDate`** and `toWebhook = true` to send results to your destination (returns a reference ID), or `toWebhook = false` to receive the full payload in the completion callback.

The available lookback depends on the route and what the platform exposes:

* **Health Connect** (including Samsung and Google Fit read via Health Connect): 30 days into the past, and not before the moment the user granted permission.
* The **Samsung direct** route depends on what Samsung Health exposes on-device.

Large REST historical responses are split into chunks (at most 10MB or 10 objects each, whichever hits first), all sharing one `terra-reference` header. See the [SDK references](https://docs.tryterra.co/reference/health-and-fitness-api/sdk-references) and [requesting historical data](https://docs.tryterra.co/health-and-fitness-api/managing-user-health-data/requesting-historical-data).


---

# 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/historical-data-and-backfill/sdk-backfill-historical-retrieval.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.
