For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

A user'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
Data flows from the provider through Terra to your backend

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.

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.

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 and the OpenAPI spec. 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

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

2. Add a destination

Tell Terra where to send data: a webhook, a database, cloud storage, or a queue.

3. Authenticate users

Open the Terra widget from your app and store the user_id from the auth event.

4. Receive data

Handle data events as they arrive, and backfill history for new users.

5. Add mobile sources

Only if you need Apple Health, Health Connect, or Samsung Health.

Some providers need extra setup: your own developer keys for a provider are covered in Dedicated source API keys, and letting each end user bring their own OAuth app is covered in Per-user OAuth apps. If data stops arriving, start with Troubleshooting.

spinner

Next steps

Last updated

Was this helpful?