> 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/unified-api/getting-started.md).

# Overview

How the Unified API gets your users' wearable and health app data to your backend, and the steps to build on it.

The Unified API connects your app to your users' wearables, sensors, and health apps through one integration. Terra handles each provider's authentication, API, and data model, normalises the data into one schema, and pushes it to your backend as it arrives. You integrate once and get Garmin, Fitbit, Oura, Apple Health, and 500+ other sources.

<figure><img src="https://464213908-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVGMJVuZnZyOtvV4b53cY%2Fuploads%2Fgit-blob-e50ceaf6229172c5da05658cc12ea8cb917e9380%2Funified-api-data-flow.png?alt=media" alt="A user&#x27;s wearable syncs to its provider, Terra fetches and normalises the data, and sends it to your backend, which serves your mobile and web frontends" width="563"><figcaption><p>Data flows from the provider through Terra to your backend</p></figcaption></figure>

## How it works

1. **A user connects a source.** Your app opens the Terra widget, an embeddable flow where the user picks their provider and logs in. Terra returns a `user_id` for that connection and keeps the provider tokens refreshed from then on.
2. **Terra normalises the data.** Whatever the provider's format, you receive the same JSON schema for every source, so you code against one set of models.
3. **Terra pushes it to your destination.** As soon as the provider makes new data available, Terra sends it backend to backend to the destination you configured: a webhook, a SQL database, MongoDB, Firestore, cloud storage on S3, GCS, or Azure, or a queue on SQS or Kafka.

The API is event based, so you do not poll for updates. You request data in one case: to backfill history from before the user connected, for example to establish baselines or train a model on a new user's past months. See [Historical data requests](/unified-api/requesting-historical-data.md).

### Delivery and security

Data is encrypted in transit, and every webhook is signed so you can check it came from Terra. If your server is down, Terra retries, and you can see every delivery attempt in the dashboard. See [Webhooks](/destinations/webhooks.md).

## What you receive

| Data type    | What it covers                                                                                      |
| ------------ | --------------------------------------------------------------------------------------------------- |
| Activity     | A workout: heart rate, distance, route, pace, power, calories, and strength sets.                   |
| Sleep        | A night's sleep or a nap: stages, heart rate, HRV, breathing, and sleep scores.                     |
| Daily        | The day so far: steps, calories, active minutes, stress, and daily scores. Updated through the day. |
| Body         | Body readings: weight, body fat, blood pressure, glucose, ECG, and temperature.                     |
| Nutrition    | Meals and drinks logged, with calories, macros, and micronutrients.                                 |
| Menstruation | Cycle tracking: phase, day in cycle, flow, and fertility window.                                    |
| Hormone      | Hormone levels from at-home tests: LH, E3G, PdG, hCG, and FSH.                                      |
| Athlete      | The user's profile at the provider: name, sex, date of birth, and location.                         |

Every field is listed in the [data models reference](https://docs.tryterra.co/reference/health-and-fitness-api/data-models) and the [OpenAPI spec](https://github.com/tryterra/openapi). All fields are nullable: a field the provider does not supply is `null`, so the shape is the same for every source.

## Web sources and mobile-only sources

| Source type | Examples                                                                                                                                          | How it connects                                                                                                                                                         |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Web         | Garmin, Fitbit, Oura, Strava, and [500+ more](https://docs.tryterra.co/reference/health-and-fitness-api/supported-integrations#integrations-list) | Terra reads the provider's cloud API. Nothing extra to build.                                                                                                           |
| Mobile-only | Apple Health, Samsung Health, Health Connect                                                                                                      | These have no cloud API for third parties, so your mobile app reads them with the [Terra mobile SDKs](/mobile-sdks/mobile-only-sources.md) and sends the data to Terra. |

Either way, the data reaches your destination in the same format. Only add the SDK if you need one of those three sources.

Terra has no rate limits of its own. Providers do, and Terra handles retries and backoff for you.

## Build on the Unified API

Most apps build in this order. The [Quickstart](/unified-api/quickstart.md) runs through the same steps from the dashboard in a few minutes.

| Step                   | What you do                                                                                           | Pages                                                                                                                                                                           |
| ---------------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1. Set up your account | Pick an environment, then choose the providers your users can connect and the data types Terra sends. | [Environments](/unified-api/understanding-terra-environments.md), [Data sources and data types](/unified-api/setting-up-data-sources.md)                                        |
| 2. Add a destination   | Tell Terra where to send data: a webhook, a database, cloud storage, or a queue.                      | [Destinations](/destinations/setting-up-data-destinations.md), [Webhooks](/destinations/webhooks.md)                                                                            |
| 3. Authenticate users  | Open the Terra widget from your app and store the `user_id` from the auth event.                      | [User authentication](/unified-api/authentication-flow.md), [Terra authentication widget](/unified-api/implementation-terra-widget.md)                                          |
| 4. Receive data        | Handle data events as they arrive, and backfill history for new users.                                | [Health data events](/unified-api/receiving-data-updates.md), [Historical data requests](/unified-api/requesting-historical-data.md), [Event delivery](/destinations/events.md) |
| 5. Add mobile sources  | Only if you need Apple Health, Health Connect, or Samsung Health.                                     | [Mobile SDKs](/mobile-sdks/mobile-only-sources.md)                                                                                                                              |

Some providers need extra setup: your own developer keys for a provider are covered in [Dedicated source API keys](/unified-api/dedicated-data-source-api-keys.md), and letting each end user bring their own OAuth app is covered in [Per-user OAuth apps](/unified-api/per-user-oauth-apps.md). If data stops arriving, start with [Troubleshooting](/unified-api/debugging-faq.md).

{% @storylane/embed subdomain="app" url="<https://app.storylane.io/share/8qriif1vn3mf>" linkValue="8qriif1vn3mf" %}

## Next steps

* [Quickstart](/unified-api/quickstart.md): connect a wearable and see its data arrive.
* [Destinations](/destinations/setting-up-data-destinations.md): choose where Terra sends data.
* [Pricing](/unified-api/pricing.md): how Unified API credits work.
