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