> 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/faq/help-topics/data-api-sdk/mobile-sdk-setup-permissions-and-crashes/mobile-only-sources-need-sdk-not-web-or-rest.md).

# 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**](https://docs.tryterra.co/health-and-fitness-api/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](https://docs.tryterra.co/health-and-fitness-api/getting-started) from your backend, with the [widget](https://docs.tryterra.co/health-and-fitness-api/user-authentication/implementation-terra-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:

{% stepper %}
{% step %}
Detect the resource in the callback (e.g. `resource=APPLE`).
{% endstep %}

{% step %}
**Call the mobile SDK's `initConnection()`** to trigger the native permissions flow and create the user.
{% endstep %}

{% step %}
Retrieve data via the SDK's data functions (`getDaily`, `getBody`, `getSleep`, etc.).
{% endstep %}
{% endstepper %}

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tryterra.co/faq/help-topics/data-api-sdk/mobile-sdk-setup-permissions-and-crashes/mobile-only-sources-need-sdk-not-web-or-rest.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
