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

Can I connect Apple Health from a web app?

Apple Health, Samsung Health, Health Connect, and Google Fit (via Health Connect) are on-device, mobile-only sources with no web API.

Apple Health, Samsung Health, Health Connect, and Google Fit (via Health Connect) are on-device, mobile-only sources with no web API. They can only be connected through the Terra mobile SDK embedded in a native app (iOS, Android, Flutter, React Native). They do not support REST API data requests, the web widget alone, or a standalone companion app.

All other wearables (Garmin, Fitbit, Oura, Polar, Whoop, etc.) have web APIs and should be integrated through Terra's Health and Fitness API from your backend, with the widget handling user auth. Enable them in the dashboard, no mobile config needed. (API + SDK on the dashboard means a provider is reachable through one of those two paths, not both.)

The widget can present mobile-only sources but cannot complete the connection. When a user picks Apple or Samsung Health it redirects back to your app via auth_success_redirect_url. Showing 'success' and returning is expected, not a failure, and a null user_id in the callback means the SDK step has not run yet.

To finish the connection:

1

Detect the resource in the callback (e.g. resource=APPLE).

2

Call the mobile SDK's initConnection() to trigger the native permissions flow and create the user.

3

Retrieve data via the SDK's data functions (getDaily, getBody, getSleep, etc.).

A 'not connected to Health Connect' error appears when REST is attempted against a mobile-only connection. For Android deep-link redirects, add an intent-filter with your custom scheme (matching auth_success_redirect_url) to the main activity and wire the React Native Linking API (getInitialURL plus a url event subscription).

Last updated

Was this helpful?