REST API Endpoints

Our full OpenAPI spec is available at: https://github.com/tryterra/openapi/blob/master/v5.yaml

🕸️ API info

Get list of available integrations

get

Retrieve a list of all available provider integrations on the API.

Responses
200

Returns list of all available integrations on the API

application/json
get
/integrations
200

Returns list of all available integrations on the API

Get detailed list of integrations

get

Retrieve a detailed list of supported integrations, optionally filtered by the developer's enabled integrations and the requirement for SDK usage.

Query parameters
sdkbooleanOptional

If true, allows SDK integrations to be included in the response.

Responses
200

Successful response containing a list of integrations.

application/json
get
/integrations/detailed
200

Successful response containing a list of integrations.

🔌 Authentication

Generate an authentication link

post

Creates a login link that allows end users to connect their fitness tracking account

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
resourcestringRequired

Provider resource identifier (e.g., 'FITBIT', 'GARMIN', 'OURA'). See "Get detailed list of integrations" for available providers

Example: FITBIT
Header parameters
dev-idstringRequired

your developer ID

Example: testingTerra
Body
languagestringOptional
reference_idstringOptional
auth_success_redirect_urlstringOptional
auth_failure_redirect_urlstringOptional
Responses
200

Returned when authentication link could be successfully generated

application/json
post
/auth/authenticateUser

Generates an authentication token for the Terra mobile SDKs

post

Creates a token to be used with initConnection() functions in the Terra mobile SDKs in order to create a user record for Apple Health or Samsung Health (or equivalent)

Authorizations
x-api-keystringRequired

Your API key for authentication

Responses
200

200

application/json
post
/auth/generateAuthToken

Generate an authentication link, using the Terra Authentication Widget

post

Generates a link to redirect an end user to for them to select an integration and log in with their fitness data provider

Authorizations
x-api-keystringRequired

Your API key for authentication

Body
providersstringOptional

Comma separated list of providers to display on the device selection page. This overrides your selected sources on your dashboard

Example: GARMIN,FITBIT,OURA,WITHINGS,SUUNTO
languagestringOptional

Display language of the widget

Example: en
reference_idstringOptional

Identifier of the end user on your system, such as a user ID or email associated with them

Example: [email protected]
auth_success_redirect_urlstringOptional

URL the user is redirected to upon successful authentication

Example: https://myapp.com/success
auth_failure_redirect_urlstringOptional

URL the user is redirected to upon unsuccessful authentication

Example: https://myapp.com/failure
Responses
200

Returned when authentication link could be successfully generated

application/json
post
/auth/generateWidgetSession

Deauthenticates a user and deletes any cached data for them

delete

Deletes all records of the user on Terra's end, revoking Terra's access to their data

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
user_idstringRequired

Terra user ID (UUID format) to deauthenticate and remove from Terra system

Responses
200

Returned when user is successfully deauthenticated and data is deleted

application/json
delete
/auth/deauthenticateUser

💁‍♂️ User info

Get information for a single user ID or multiple users by reference ID

get

Used to query for information on one Terra user ID, or to query for all registered Terra User objects under one reference ID

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
user_idstringOptional

user ID to query for

reference_idstringOptional

reference ID to query for

Responses
200

Returned when the provided resources are found

application/json
Responseone of
or
get
/userInfo

Get all Terra User IDs

get

Used to query for information for all Terra User IDs. Supports optional pagination via page and per_page. If page is not provided, it returns all users in one go (backwards compatibility).

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
pageintegerOptional

Zero-based page number. If omitted, results are not paginated.

Example: 0
per_pageintegerOptional

Number of results per page (default is 500).

Example: 500
Responses
200

Returned upon a successful request

application/json
Responseone of
or
get
/subscriptions

Get information for multiple user IDs

post

Used to query for information for multiple Terra User IDs

Authorizations
x-api-keystringRequired

Your API key for authentication

Bodystring[]
string[]Optional

List of user IDs to get information for

Responses
200

Returned upon successful request

application/json
post
/bulkUserInfo

Retrieve user profile info for a given user ID

get

Fetches relevant profile info such as first & last name, birth date etc. for a given user ID

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
user_idstringRequired

Terra user ID (UUID format) to retrieve data for

to_webhookbooleanOptional

Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)

Responses
200

Returned upon successful data request

application/json
Responseone of
or
or
get
/athlete

⏳ Historical Data retrieval

Retrieve activity data for a given user ID

get

Fetches completed workout sessions, with a defined start and end time and activity type (e.g. running, cycling, etc.)

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
user_idstringRequired

Terra user ID (UUID format) to retrieve data for

start_dateone ofRequired

Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)

integerOptional
or
string · dateOptional
end_dateone ofOptional

End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)

integerOptional
or
string · dateOptional
to_webhookbooleanOptional

Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)

with_samplesbooleanOptional

Boolean flag specifying whether to include detailed samples in the returned payload (default: false)

Responses
200

Returned upon successful data request

application/json
Responseone of
or
or
or
or
or
get
/activity

Retrieve body metrics for a given user ID

get

Fetches body metrics such as weight, height, body fat percentage etc. for a given user ID

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
user_idstringRequired

Terra user ID (UUID format) to retrieve data for

start_dateone ofRequired

Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)

integerOptional
or
string · dateOptional
end_dateone ofOptional

End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)

integerOptional
or
string · dateOptional
to_webhookbooleanOptional

Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)

with_samplesbooleanOptional

Boolean flag specifying whether to include detailed samples in the returned payload (default: false)

Responses
200

Returned upon successful data request

application/json
Responseone of
or
or
or
or
or
get
/body

Retrieve daily activity summaries for a given user ID

get

Fetches daily summaries of activity metrics such as steps, distance, calories burned etc. for a given user ID

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
user_idstringRequired

Terra user ID (UUID format) to retrieve data for

start_dateone ofRequired

Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)

integerOptional
or
string · dateOptional
end_dateone ofOptional

End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)

integerOptional
or
string · dateOptional
to_webhookbooleanOptional

Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)

with_samplesbooleanOptional

Boolean flag specifying whether to include detailed samples in the returned payload (default: false)

Responses
200

Returned upon successful data request

application/json
Responseone of
or
or
or
or
or
get
/daily

Retrieve menstruation data for a given user ID

get

Fetches menstruation data such as cycle length, period length, ovulation date etc. for a given user ID

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
user_idstringRequired

Terra user ID (UUID format) to retrieve data for

start_dateone ofRequired

Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)

integerOptional
or
string · dateOptional
end_dateone ofOptional

End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)

integerOptional
or
string · dateOptional
to_webhookbooleanOptional

Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)

with_samplesbooleanOptional

Boolean flag specifying whether to include detailed samples in the returned payload (default: false)

Responses
200

Returned upon successful data request

application/json
Responseone of
or
or
or
or
or
get
/menstruation

Retrieve nutrition log data for a given user ID

get

Fetches nutrition log data such as meal type, calories, macronutrients etc. for a given user ID

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
user_idstringRequired

Terra user ID (UUID format) to retrieve data for

start_dateone ofRequired

Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)

integerOptional
or
string · dateOptional
end_dateone ofOptional

End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)

integerOptional
or
string · dateOptional
to_webhookbooleanOptional

Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)

with_samplesbooleanOptional

Boolean flag specifying whether to include detailed samples in the returned payload (default: false)

Responses
200

Returned upon successful data request

application/json
Responseone of
or
or
or
or
or
get
/nutrition

Retrieve sleep sessions for a given user ID

get

Fetches sleep data such as sleep duration, sleep stages, sleep quality etc. for a given user ID, for sleep sessions with a defined start and end time

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
user_idstringRequired

Terra user ID (UUID format) to retrieve data for

start_dateone ofRequired

Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)

integerOptional
or
string · dateOptional
end_dateone ofOptional

End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)

integerOptional
or
string · dateOptional
to_webhookbooleanOptional

Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)

with_samplesbooleanOptional

Boolean flag specifying whether to include detailed samples in the returned payload (default: false)

Responses
200

Returned upon successful data request

application/json
Responseone of
or
or
or
or
or
get
/sleep

Retrieve workout plans for a given user ID

get

Used to get workout plans the user has registered on their account. This can be strength workouts (sets, reps, weight lifted) or cardio workouts (warmup, intervals of different intensities, cooldown etc)

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
user_idstringRequired

Terra user ID (UUID format) to retrieve data for

start_dateone ofRequired

Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)

integerOptional
or
string · dateOptional
end_dateone ofOptional

End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)

integerOptional
or
string · dateOptional
to_webhookbooleanOptional

Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)

Responses
200

Returned upon successful data request

application/json
Responseone of
or
or
get
/plannedWorkout

✏️ Writing data

Post activity data to a provider

post

Used to post activity data to a provider. This endpoint only works for users connected via Wahoo. Returns error for other providers.

Authorizations
x-api-keystringRequired

Your API key for authentication

Body
Responses
post
/activity

Post nutrition logs to a provider

post

Used to post nutrition logs to a provider. This endpoint only works for users connected via Fitbit. Returns error for other providers.

Authorizations
x-api-keystringRequired

Your API key for authentication

Body
Responses
post
/nutrition

Post body data to a provider

post

Used to post body data to a provider. This endpoint only works for users connected via Google Fit. Returns error for other providers.

Authorizations
x-api-keystringRequired

Your API key for authentication

Body
Responses
post
/body

Post workout plans to a provider

post

Used to post workout plans users can follow on their wearable. This can be strength workouts (sets, reps, weight lifted) or cardio workouts (warmup, intervals of different intensities, cooldown etc)

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
user_idstringRequired

Terra user ID (UUID format) to retrieve data for

Body
Responses
post
/plannedWorkout

Delete nutrition logs for a given user ID

delete

Used to delete nutrition logs the user has registered on their account

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
user_idstringRequired

Terra user ID (UUID format) to retrieve data for

Body
datastring[]Optional

List of identifiers for nutrition entries to be deleted

Responses
200

Returned when all records were deleted successfully

application/json
delete
/nutrition

Delete body metrics for a given user ID

delete

Used to delete Body metrics the user has registered on their account

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
user_idstringRequired

Terra user ID (UUID format) to retrieve data for

Body
log_idsstring[]Optional

List of identifiers for body metrics entries to be deleted

Responses
200

Returned when all records were deleted successfully

application/json
delete
/body

Delete workout plans for a given user ID

delete

Used to delete workout plans the user has registered on their account. This can be strength workouts (sets, reps, weight lifted) or cardio workouts (warmup, intervals of different intensities, cooldown etc)

Authorizations
x-api-keystringRequired

Your API key for authentication

Query parameters
user_idstringRequired

Terra user ID (UUID format) to retrieve data for

Body
datastring[]Optional

List of identifiers for planned workout entries to be deleted

Responses
200

Returned when all records were deleted successfully

application/json
delete
/plannedWorkout

Last updated

Was this helpful?