> ## Documentation Index
> Fetch the complete documentation index at: https://foreverbetter.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Wearables

> Connect WHOOP over OAuth, sync Android sources through ForeverBetter Connect and Google Health Connect, and analyze wearable signals.

The API exposes one generic `wearables` surface. Two connection models sit behind it:

| Provider                                      | Connection           | What works                                                                      |
| --------------------------------------------- | -------------------- | ------------------------------------------------------------------------------- |
| WHOOP                                         | Server OAuth         | Auth URL, token exchange, sync, and analysis                                    |
| Google Health Connect + ForeverBetter Connect | Consumer Android app | Reads multiple Android sources on-device, pushes normalized data, then analysis |

Google Health Connect is an on-device Android aggregator. It can surface data
from Fitbit, Samsung Health, Google Fit, and many other Android apps in one
place, which makes it the widest-coverage connection.

## WHOOP (server OAuth)

Build an authorization URL, redirect the user, then exchange the returned code.

```bash theme={null}
curl -s "$HEALTH_API/connections/wearables/start" \
  -H "authorization: Bearer $TOKEN" \
  -H "content-type: application/json" \
  -d '{
    "user_id": "customer_001",
    "organization_id": "org_001",
    "source_provider": "whoop",
    "client_id": "<provider-client-id>",
    "redirect_uri": "https://app.example.com/oauth/callback"
  }'
```

The response includes `connection_type: "oauth"` and an `authorization_url`.
After the user authorizes, complete the connection at
`POST /connections/wearables/callback` with the `code`.

## Google Health Connect through ForeverBetter Connect

ForeverBetter Connect is the consumer Android app that reads Google Health
Connect and uploads data to the user's ForeverBetter account. Health Connect
can combine Fitbit, Samsung Health, Google Fit, and other Android sources. This
path has no server OAuth redirect.

Health Connect is built into Android 14 and newer. On Android 13 and lower,
[install Google's Health Connect app from Google Play](https://play.google.com/store/apps/details?id=com.google.android.apps.healthdata)
before opening ForeverBetter Connect.

Consumer setup:

1. Install and open **ForeverBetter Connect** from the current ForeverBetter
   beta or Google Play distribution.
2. Sign in with the same ForeverBetter account as the dashboard or agent key.
3. Select **Google Health Connect** in the app.
4. Grant read permissions for the health data types to sync.
5. Start background sync in ForeverBetter Connect and wait for the first sync.

Installing Google's Health Connect app alone does not upload data to
ForeverBetter. ForeverBetter Connect performs the authenticated sync.

```bash theme={null}
curl -s "$HEALTH_API/connections/wearables/start" \
  -H "authorization: Bearer $TOKEN" \
  -H "content-type: application/json" \
  -d '{
    "user_id": "customer_001",
    "organization_id": "org_001",
    "source_provider": "health_connect"
  }'
```

The response includes `connection_type: "mobile_bridge"`, the supported
`data_types`, and an `ingestion` contract. ForeverBetter Connect handles this
contract internally. Teams embedding their own Android app then:

1. Requests Health Connect read permissions for the data types you need.
2. Reads the latest records on-device.
3. Pushes readings to `POST /connections/wearables/sync`, or to
   `POST /imports/file` with `category: "wearables"` and
   `provider: "health_connect"`.

Health Connect record names (e.g. `Steps`, `OxygenSaturation`,
`HeartRateVariabilityRmssd`, `BloodPressure`, `Weight`, `BodyFat`,
`BloodGlucose`) are mapped to canonical metric ids automatically.

## Sync wearable data

```bash theme={null}
curl -s "$HEALTH_API/connections/wearables/sync" \
  -H "authorization: Bearer $TOKEN" \
  -H "content-type: application/json" \
  -d '{
    "user_id": "customer_001",
    "organization_id": "org_001",
    "provider_user_id": "<upstream-user-id>",
    "start": "2026-06-01",
    "end": "2026-06-08",
    "async": true
  }'
```

Read queued sync status with `GET /connections/wearables/jobs/{id}`. Stored
sources always carry `provider: "wearables"`; customers never see the upstream
hub.

## Analyze wearable data

Call `POST /wearables/analyze` with one or more wearable source IDs. The route
rejects biomarker and genetic sources so the output stays focused. Normalized
signals span sleep and recovery, cardiovascular recovery (HRV, resting heart
rate, SpO2, respiratory rate), activity and training, rhythm and consistency,
continuous glucose (mean glucose, time in range, variability), body composition
(body fat, waist, BMI), and vitals (blood pressure).
