Skip to main content

Overview

This guide walks you through the complete flow of integrating Open Wearables with your application, from creating a user to fetching their health data.

Step 1: Create a User

First, create a user in Open Wearables to represent your application’s user.
Use external_user_id to map Open Wearables users to your application’s user IDs for easy lookup later.
Response:
Save the id - you’ll need it for all subsequent API calls.
Open Wearables allows duplicate email addresses. If you need uniqueness, check for existing users first using GET /api/v1/users?search=user@example.com which returns a paginated list.

Step 2: Connect to a Provider

Initiate OAuth to connect the user to their wearable provider.
Response:
Redirect the user to authorization_url. After they authorize, they’ll be redirected back to your redirect_uri.
redirect_uri must be allowed by the instance: its origin must be FRONTEND_URL or one of CORS_ORIGINS, or it must be listed in OAUTH_REDIRECT_ALLOWLIST (comma-separated; web URLs match by origin, app schemes such as myapp://oauth/callback match exactly). Any other value gets a 400. The user comes back with provider, status (success or error) and, on error, message in the query, replacing any parameters of the same name. Errors land there too, so check status rather than assuming the connection succeeded.
Provider names must be lowercase: garmin, polar, suunto, apple
authorize needs a credential: your API key, or a token scoped to that one user. Calls without one get 401.

Frontend Example

Keep the API key on your backend. Have it mint a connect token for the user, and let the browser use that instead:
The token works only on authorize and only for the user it was minted for (another user_id gets 403). It expires after CONNECT_TOKEN_EXPIRE_DAYS (default 7). To let someone connect without building any UI, send them pair_url from the same response. It opens the Open Wearables pairing page, where they pick a provider and sign in. Links without a token are refused, so mint a new one when it expires. The dashboard’s Copy pairing link button does the same.

Step 3: Sync Data

After OAuth completes, an initial sync is triggered automatically. For subsequent syncs or to fetch historical data:
For Garmin, including summary_start_time and summary_end_time is recommended to specify the date range for data retrieval.

Step 4: Fetch Data

Now you can fetch the user’s health data.

Timeseries Data (Heart Rate, Steps, etc.)

Workouts

Sleep Sessions

Menstrual Cycles

Complete JavaScript Example

Next Steps

Provider Setup

Provider-specific configuration and requirements

Data Types

Available metrics, workout types, and data formats