Apple Health Integration

Apple Health integration guide

With our Apple Health Integration you can access Activity, Athlete, Body, Daily, Sleep data, all within one single integration to Terra 🎉
Below are key steps to integrate with Apple Health

1. What you need to integrate with Apple Health

  • Terra API Key
    • Once you sign up, we will provide you with an API key used to access our API
  • Developer ID
    • We will provide you with a Developer ID, which allows Terra to identify users that belong to you, and associate API traffic to you.
  • Callback/Webhook URL
    • You will need to set up a server (or use a testing environment like that accepts POST requests from Terra
  • iOS app
    • You will need to use our SDK) within your iOS app to pull user data and send it to Terra for normalization.

2. Data format

All data is sent to your webhook in JSON format in the form of 5 different types of payloads: Activity, Athlete, Body, Daily, Sleep; depending on your needs, you may select a subset of the aforementioned, and request less data from your users.
Examples of data payloads can be found here. If you would only like to receive specific fields out of the ones available, you may also select only the ones relevant to your needs and omit the rest. The following is an example of the data payload you may expect from an activity coming from Terra.


3. Receiving data for your Apple Health integration - WEBHOOKS webhooks

Our infrastructure revolves around webhooks. When setting up your Terra account, you will be prompted to provide a callback URL, to which Terra may send PUSH data using POST requests.

Your Apple Health integration with Terra supports delivery of data without needing to periodically request it yourself. We query Apple Health for new data every 20 minutes, and POST normalized data to your webhook whenever data is available.

4. Front end - End User Experience

We provide a front end solution for your end users to authenticate with Terra and be linked back to your callback URL through your Terra developer ID.

In order to use the widget integration, simply open a WebView within your app pointing to with ?X-API-Key=YOUR_API_KEY&dev-id=YOUR_DEVELOPER_ID as query parameters. Additional configuration parameters can be passed into the widget for customization options.

Any user following through with authentication using the above will be linked back to your Terra account.