> 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/webhooks-as-primary-source-best-practice.md).

# How do I make production sync reliable?

**Use** [**webhooks**](https://docs.tryterra.co/health-and-fitness-api/managing-user-health-data/receiving-data-updates) **as your primary data source.** Terra polls the provider and fires a webhook on new or updated data, so you do not need your own polling. (Background syncs cannot be disabled, but you can choose not to process events and instead pull via the API on your own schedule.)

Key behaviours:

* Provider data is eventually consistent (sleep and readiness finalise hours later, daily totals accumulate), so you will receive multiple webhooks for the same date. **Always overwrite** rather than treating the first delivery as final.
* [Historical data](https://docs.tryterra.co/health-and-fitness-api/managing-user-health-data/requesting-historical-data) is not pulled automatically on connect; request specific date ranges via REST for backfill.

On a first cloud-provider connect, an empty `GET` array is expected because Terra fetches in the background. Do not poll the read endpoint in a loop. Instead:

{% stepper %}
{% step %}
Listen for the [auth-success webhook](https://docs.tryterra.co/health-and-fitness-api/user-authentication/handling-authentication-events) (`type` auth, `status` success) carrying `user_id`.
{% endstep %}

{% step %}
Immediately call the `GET` endpoint with a `start_date`, a window of 28 days or less, and `to_webhook=false` to get it synchronously.
{% endstep %}
{% endstepper %}

A nightly REST pull for the previous day is a reasonable safety net, but most customers do fine with webhooks alone.
