# 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

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[],"paths":{"/integrations":{"get":{"summary":"Get list of available integrations","tags":["Integrations"],"operationId":"Integrations_Fetch","description":"Retrieve a list of all available provider integrations on the API.","responses":{"200":{"description":"Returns list of all available integrations on the API","content":{"application/json":{"schema":{"type":"object","properties":{"providers":{"type":"array","items":{"type":"string"}},"sdk_resource":{"type":"array","items":{"type":"string"}},"status":{"enum":["success","error"],"type":"string","default":"success"}}}}}}}}}}}
```

## Get detailed list of integrations

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[],"paths":{"/integrations/detailed":{"get":{"tags":["Integrations"],"operationId":"Integrations_DetailedFetch","summary":"Get detailed list of integrations","description":"Retrieve a detailed list of supported integrations, optionally filtered by the developer's enabled integrations and the requirement for SDK usage.","parameters":[{"in":"query","name":"sdk","required":false,"schema":{"type":"boolean"},"description":"If `true`, allows SDK integrations to be included in the response."}],"responses":{"200":{"description":"Successful response containing a list of integrations.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationsResponse"}}}}}}}},"components":{"schemas":{"IntegrationsResponse":{"type":"object","properties":{"status":{"type":"string","description":"Status of the API response"},"providers":{"type":"array","description":"List of integration providers with their details","items":{"$ref":"#/components/schemas/IntegrationProvider"}}}},"IntegrationProvider":{"type":"object","properties":{"provider":{"type":"string","description":"Identifier for the provider"},"name":{"type":"string","description":"Display name of the integration"},"icon":{"type":"string","description":"URL for the provider's icon image"},"setup":{"type":"string","description":"Indicates how the integration is set up"},"enabled":{"type":"boolean","description":"Whether the integration is enabled"},"types":{"type":"object","description":"Indicates the types of data available through the provider","properties":{"activity":{"type":"boolean"},"body":{"type":"boolean"},"nutrition":{"type":"boolean"},"daily":{"type":"boolean"},"sleep":{"type":"boolean"},"menstruation":{"type":"boolean"}}}}}}}}
```

## 🔌 Authentication

## Generate an authentication link

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}}},"paths":{"/auth/authenticateUser":{"post":{"summary":"Generate an authentication link","description":"Creates a login link that allows end users to connect their fitness tracking account","tags":["Authentication"],"operationId":"Authentication_AuthenticateUser","parameters":[{"name":"resource","in":"query","description":"Provider resource identifier (e.g., 'FITBIT', 'GARMIN', 'OURA'). See \"Get detailed list of integrations\" for available providers","schema":{"type":"string"},"required":true},{"name":"dev-id","in":"header","description":"your developer ID","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"language":{"type":"string"},"reference_id":{"type":"string"},"auth_success_redirect_url":{"type":"string"},"auth_failure_redirect_url":{"type":"string"}}}}},"required":false},"responses":{"200":{"description":"Returned when authentication link could be successfully generated","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"],"description":"indicates that the request was successful"},"user_id":{"description":"User ID for the user being created","type":"string"},"auth_url":{"type":"string","description":"authentication URL the user must be redirected to in order to link their account"}}}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. resource)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["success","error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Generates an authentication token for the Terra mobile SDKs

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}}},"paths":{"/auth/generateAuthToken":{"post":{"tags":["Authentication"],"summary":"Generates an authentication token for the Terra mobile SDKs","description":"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)","operationId":"Authentication_GenerateAuthToken","responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"token":{"type":"string"},"expires_in":{"type":"integer","default":0}}}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}}}}}}},"deprecated":false}}}}
```

## Generate an authentication link, using the Terra Authentication Widget

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"WidgetSessionParams":{"type":"object","properties":{"providers":{"type":"string","description":"Comma separated list of providers to display on the device selection page. This overrides your selected sources on your dashboard"},"language":{"type":"string","description":"Display language of the widget"},"reference_id":{"type":"string","description":"Identifier of the end user on your system, such as a user ID or email associated with them"},"auth_success_redirect_url":{"type":"string","description":"URL the user is redirected to upon successful authentication"},"auth_failure_redirect_url":{"type":"string","description":"URL the user is redirected to upon unsuccessful authentication"}}}}},"paths":{"/auth/generateWidgetSession":{"post":{"summary":"Generate an authentication link, using the Terra Authentication Widget","description":"Generates a link to redirect an end user to for them to select an integration and log in with their fitness data provider","tags":["Authentication"],"operationId":"Authentication_GenerateWidgetSession","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WidgetSessionParams"}}},"required":true},"responses":{"200":{"description":"Returned when authentication link could be successfully generated","content":{"application/json":{"schema":{"type":"object","properties":{"session_id":{"description":"Session ID for the widget authentication session","type":"string"},"url":{"type":"string","description":"the widget URL the user must be redirected to in order to link their account"},"status":{"type":"string","enum":["success","error"],"description":"indicates that the request was successful (value is success)"},"expires_in":{"type":"number","description":"a number in seconds depicting how long the url is valid for"}}}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Deauthenticates a user and deletes any cached data for them

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}}},"paths":{"/auth/deauthenticateUser":{"delete":{"summary":"Deauthenticates a user and deletes any cached data for them","description":"Deletes all records of the user on Terra's end, revoking Terra's access to their data","tags":["Authentication"],"operationId":"Authentication_DeauthenticateUser","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (UUID format) to deauthenticate and remove from Terra system","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Returned when user is successfully deauthenticated and data is deleted","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"enum":["success","error"],"description":"indicates that the deauthentication was successful (value is success)","type":"string"}}}}}},"404":{"description":"Returned when the user_id is not existent","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["success","error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## 💁‍♂️ User info

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

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]}}},"paths":{"/userInfo":{"get":{"tags":["User"],"operationId":"User_GetInfoForUserID","description":"Used to query for information on one Terra user ID, or to query for all registered Terra User objects under one reference ID","summary":"Get information for a single user ID or multiple users by reference ID","parameters":[{"name":"user_id","in":"query","description":"user ID to query for","schema":{"type":"string"},"required":false},{"name":"reference_id","in":"query","description":"reference ID to query for","schema":{"type":"string"},"required":false}],"responses":{"200":{"description":"Returned when the provided resources are found","content":{"application/json":{"schema":{"oneOf":[{"description":"User information for one connection (single User object)","type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"status":{"type":"string","enum":["success","error"],"default":"success"},"is_authenticated":{"type":"boolean"}}},{"description":"List of multiple User objects the reference_id is associated to","type":"array","items":{"$ref":"#/components/schemas/TerraUser"}}]}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Get all Terra User IDs

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]}}},"paths":{"/subscriptions":{"get":{"tags":["User"],"operationId":"User_GetAllUserIDs","description":"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).","summary":"Get all Terra User IDs","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer"},"description":"Zero-based page number. If omitted, results are not paginated."},{"name":"per_page","in":"query","required":false,"schema":{"type":"integer"},"description":"Number of results per page (default is 500)."}],"responses":{"200":{"description":"Returned upon a successful request","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"users":{"type":"array","items":{"$ref":"#/components/schemas/TerraUser"}}}},{"type":"object","properties":{"data":{"type":"object","properties":{"next":{"type":["integer","null"],"description":"The next page number, or null if there is no next page"},"max_page":{"type":"integer","description":"The maximum page index"},"results":{"type":"array","items":{"$ref":"#/components/schemas/TerraUser"}}}}}}]}}}},"400":{"description":"Returned when one or more parameters are malformed","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"A detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"Indicates that an error occurred (value is `error`)"}}}}}}}}}}}
```

## Get information for multiple user IDs

> Used to query for information for multiple Terra User IDs

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]}}},"paths":{"/bulkUserInfo":{"post":{"tags":["User"],"operationId":"User_GetInfoForMultipleUserIDs","description":"Used to query for information for multiple Terra User IDs","summary":"Get information for multiple user IDs","requestBody":{"content":{"application/json":{"schema":{"type":"array","description":"List of user IDs to get information for","items":{"type":"string"}}}},"required":true},"responses":{"200":{"description":"Returned upon successful request","content":{"application/json":{"schema":{"description":"List of User objects","type":"array","items":{"$ref":"#/components/schemas/TerraUser"}}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Retrieve user profile info for a given user ID

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"AthleteCollection":{"type":"object","properties":{"athlete":{"description":"Object containing the user's information","type":"object","allOf":[{"$ref":"#/components/schemas/Athlete"}]},"type":{"type":"string","nullable":true},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"Athlete":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Athlete.yaml","type":"object","properties":{"age":{"type":"integer","description":"User's age."},"country":{"type":"string","description":"User's country of residence."},"bio":{"type":"string","description":"User's bio - a short description they display on their profile."},"state":{"type":"string","description":"User's state of residence."},"last_name":{"type":"string","description":"User's last name."},"sex":{"type":"string","description":"User's sex."},"city":{"type":"string","description":"User's city of residence."},"email":{"type":"string","description":"User's email."},"date_of_birth":{"type":"string","description":"User's date of birth, in ISO8601 format."},"first_name":{"type":"string","description":"User's first name."},"gender":{"type":"string","description":"User's gender."},"joined_provider":{"type":"string","description":"User's account creation date."},"devices":{"type":"array","items":{"$ref":"#/components/schemas/DeviceData"},"description":"Array of devices associated with the user's account."}}},"DeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceData.yaml","type":"object","properties":{"activation_timestamp":{"type":"string","description":"Activation timestamp of the device, if applicable."},"data_provided":{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"},"description":"Data provided by the device, as enumerated types."},"hardware_version":{"type":"string","description":"Hardware version of the device."},"last_upload_date":{"type":"string","description":"Last upload date from the device."},"manufacturer":{"type":"string","description":"Device manufacturer name."},"name":{"type":"string","description":"Device name - note that this can also be the name of the application/package which the data comes from, if coming from a data aggregator such as Google Fit."},"other_devices":{"type":"array","items":{"$ref":"#/components/schemas/OtherDeviceData"},"description":"Data pertaining to other devices which may have contributed data for this workout."},"sensor_state":{"type":"string","description":"Sensor state of the device."},"serial_number":{"type":"string","description":"Device Serial Number."},"software_version":{"type":"string","description":"Device Software Version."}}},"DeviceDataType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceDataType.yaml","oneOf":[{"type":"string","const":"STEPS","description":"Count of steps taken by the user.","title":"Steps"},{"type":"string","const":"ACTIVE_MINUTES","description":"Duration of time the user spent in physical activity.","title":"Active Minutes"},{"type":"string","const":"BMR","description":"User's basal metabolic rate - calories burned at rest.","title":"Basal Metabolic Rate"},{"type":"string","const":"CALORIES","description":"Calories burned by the user during activity.","title":"Calories"},{"type":"string","const":"DISTANCE","description":"Distance traveled by the user during activity.","title":"Distance"},{"type":"string","const":"HEART_RATE","description":"User's heart rate measurements.","title":"Heart Rate"},{"type":"string","const":"OXYGEN_SATURATION","description":"Blood oxygen saturation level (SpO2) of the user.","title":"Oxygen Saturation"},{"type":"string","const":"SLEEP_TYPE","description":"Classification of user's sleep stages or types.","title":"Sleep Classification"},{"type":"string","const":"SPEED","description":"User's movement speed during activity.","title":"Speed"},{"type":"string","const":"CADENCE","description":"Rate of movement repetition during activity (steps per minute).","title":"Cadence"}],"description":"Represents data types that a certain device contributed to."},"OtherDeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OtherDeviceData.yaml","type":"object","properties":{"manufacturer":{"type":"string","description":"Device manufacturer name."},"hardware_version":{"type":"string","description":"Hardware version of the device."},"serial_number":{"type":"string","description":"Device Serial Number."},"name":{"type":"string","description":"Device name - note that this can also be the name of the application/package which the data comes from, if coming from a data aggregator such as Google Fit."},"software_version":{"type":"string","description":"Device Software Version."},"activation_timestamp":{"type":"string","description":"Activation timestamp of the device, if applicable."},"data_provided":{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"},"description":"Data provided by the device, as enumerated types."},"last_upload_date":{"type":"string","description":"Last upload date from the device."}}},"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]},"NoDataReturned":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"message":{"type":"string"},"type":{"type":["string","null"]},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"DataSentToWebhook":{"type":"object","properties":{"reference":{"type":"string","description":"Payload reference, tying the request to the webhook payload which will be received","nullable":true},"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}}}},"paths":{"/athlete":{"get":{"summary":"Retrieve user profile info for a given user ID","description":"Fetches relevant profile info such as first & last name, birth date etc. for a given user ID","tags":["Athlete"],"operationId":"Athlete_Fetch","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (UUID format) to retrieve data for","schema":{"type":"string"},"required":true},{"name":"to_webhook","in":"query","description":"Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)\n","schema":{"type":"boolean"},"required":false}],"responses":{"200":{"description":"Returned upon successful data request","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/AthleteCollection"},{"$ref":"#/components/schemas/NoDataReturned"},{"$ref":"#/components/schemas/DataSentToWebhook"}]}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"401":{"description":"Returned when credentials (dev ID and API key) are invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"An error message","type":"string"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## ⏳ Historical Data retrieval

## Retrieve activity data for a given user ID

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]},"Activity":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Activity.yaml","type":"object","properties":{"active_durations_data":{"$ref":"#/components/schemas/ActiveDurationsData","description":"Number of minutes spent at various intensities during the workout, as reported by the Fitness Data provider."},"calories_data":{"$ref":"#/components/schemas/CaloriesData","description":"Object containing calorie-related information for the user during the specific workout."},"cheat_detection":{"type":"number","description":"Cheat detection flag."},"data_enrichment":{"$ref":"#/components/schemas/DataEnrichment","description":"Object containing Terra Scores."},"device_data":{"$ref":"#/components/schemas/DeviceData","description":"Object containing information on the device which recorded the specific workout."},"distance_data":{"$ref":"#/components/schemas/DistanceData","description":"Object containing information related to distance covered during the associated workout."},"energy_data":{"$ref":"#/components/schemas/EnergyData","description":"Object containing information on the energy expended by the user during the workout."},"heart_rate_data":{"$ref":"#/components/schemas/HeartRateData","description":"Object containing heartrate-related information for the workout."},"lap_data":{"$ref":"#/components/schemas/LapData","description":"Object containing information on data for each lap performed by the user - mostly relates to track & field running activities, and swimming activities."},"MET_data":{"$ref":"#/components/schemas/METData","description":"Object containing information on the Metabolic Equivalent of Task for the workout."},"metadata":{"$ref":"#/components/schemas/ActivityMetadata","description":"Object containing workout metadata."},"movement_data":{"$ref":"#/components/schemas/MovementData","description":"Object containing information on the user's movement throughout the workout."},"oxygen_data":{"$ref":"#/components/schemas/OxygenData","description":"Object containing information on oxygen-related metrics for the workout."},"polyline_map_data":{"$ref":"#/components/schemas/PolylineMapData","description":"Object containing polyline-representation map data, plotting the user's trajectory throughout the workout."},"position_data":{"$ref":"#/components/schemas/PositionData","description":"Object containing information on the user's position throughout the workout."},"power_data":{"$ref":"#/components/schemas/PowerData","description":"Object containing information on the power generated by the user during the workout."},"strain_data":{"$ref":"#/components/schemas/StrainData","description":"Object containing information on the cardiovascular strain imposed on the user during the workout."},"TSS_data":{"$ref":"#/components/schemas/TSSData","description":"Object containing information on the stress put on the user's body from a workout."},"work_data":{"$ref":"#/components/schemas/WorkData","description":"Object containing information on the work output of the user during the workout."}},"required":["metadata"]},"ActiveDurationsData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActiveDurationsData.yaml","type":"object","properties":{"activity_levels_samples":{"type":"array","items":{"$ref":"#/components/schemas/ActivityLevelSample"},"description":"Array of detailed samples of the intensity the user was in at various points during the workout."},"activity_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in an active state during the workout."},"inactivity_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in an inactive state during the workout."},"low_intensity_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in a low intensity state during the workout."},"moderate_intensity_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in a moderate intensity state during the workout."},"num_continuous_inactive_periods":{"type":"integer","minimum":0,"description":"Maximum number of continuous periods spent in an inactive state during the workout."},"rest_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent resting during the workout."},"vigorous_intensity_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in a state of vigorous intensity during the workout."},"standing_hours_count":{"type":"number"},"standing_seconds":{"type":"number"}}},"ActivityLevelSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityLevelSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"level":{"$ref":"#/components/schemas/ActivityLevel"}}},"ActivityLevel":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityLevel.yaml","oneOf":[{"type":"number","const":0,"description":"Activity level is unknown or could not be determined.","title":"Unknown"},{"type":"number","const":1,"description":"User is at rest, with minimal to no physical activity.","title":"Rest"},{"type":"number","const":2,"description":"User is awake but inactive or sedentary.","title":"Inactive"},{"type":"number","const":3,"description":"User is engaged in light physical activity such as casual walking.","title":"Low Intensity"},{"type":"number","const":4,"description":"User is engaged in moderate physical activity such as brisk walking or light exercise.","title":"Medium Intensity"},{"type":"number","const":5,"description":"User is engaged in vigorous physical activity such as running or intense exercise.","title":"High Intensity"}],"description":"Intensity of the user's activity at an instant in time"},"CaloriesData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CaloriesData.yaml","type":"object","properties":{"BMR_calories":{"type":"number","description":"Basal Metabolic Rate calories - calories burned at rest."},"calorie_samples":{"type":"array","items":{"$ref":"#/components/schemas/CalorieSample"},"description":"Array of calorie data samples recorded throughout the time period."},"net_activity_calories":{"type":"number","description":"Net calories burned through activity (excluding BMR)."},"net_intake_calories":{"type":"number","description":"Net calories consumed through food and drink intake."},"total_burned_calories":{"type":"number","description":"Total calories burned including BMR and activity."}}},"CalorieSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CalorieSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"calories":{"type":"number","description":"Number of calories burned at the given timestamp."},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"DataEnrichment":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DataEnrichment.yaml","type":"object","properties":{"stress_score":{"type":"integer","description":"User's stress score."}}},"DeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceData.yaml","type":"object","properties":{"activation_timestamp":{"type":"string","description":"Activation timestamp of the device, if applicable."},"data_provided":{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"},"description":"Data provided by the device, as enumerated types."},"hardware_version":{"type":"string","description":"Hardware version of the device."},"last_upload_date":{"type":"string","description":"Last upload date from the device."},"manufacturer":{"type":"string","description":"Device manufacturer name."},"name":{"type":"string","description":"Device name - note that this can also be the name of the application/package which the data comes from, if coming from a data aggregator such as Google Fit."},"other_devices":{"type":"array","items":{"$ref":"#/components/schemas/OtherDeviceData"},"description":"Data pertaining to other devices which may have contributed data for this workout."},"sensor_state":{"type":"string","description":"Sensor state of the device."},"serial_number":{"type":"string","description":"Device Serial Number."},"software_version":{"type":"string","description":"Device Software Version."}}},"DeviceDataType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceDataType.yaml","oneOf":[{"type":"string","const":"STEPS","description":"Count of steps taken by the user.","title":"Steps"},{"type":"string","const":"ACTIVE_MINUTES","description":"Duration of time the user spent in physical activity.","title":"Active Minutes"},{"type":"string","const":"BMR","description":"User's basal metabolic rate - calories burned at rest.","title":"Basal Metabolic Rate"},{"type":"string","const":"CALORIES","description":"Calories burned by the user during activity.","title":"Calories"},{"type":"string","const":"DISTANCE","description":"Distance traveled by the user during activity.","title":"Distance"},{"type":"string","const":"HEART_RATE","description":"User's heart rate measurements.","title":"Heart Rate"},{"type":"string","const":"OXYGEN_SATURATION","description":"Blood oxygen saturation level (SpO2) of the user.","title":"Oxygen Saturation"},{"type":"string","const":"SLEEP_TYPE","description":"Classification of user's sleep stages or types.","title":"Sleep Classification"},{"type":"string","const":"SPEED","description":"User's movement speed during activity.","title":"Speed"},{"type":"string","const":"CADENCE","description":"Rate of movement repetition during activity (steps per minute).","title":"Cadence"}],"description":"Represents data types that a certain device contributed to."},"OtherDeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OtherDeviceData.yaml","type":"object","properties":{"manufacturer":{"type":"string","description":"Device manufacturer name."},"hardware_version":{"type":"string","description":"Hardware version of the device."},"serial_number":{"type":"string","description":"Device Serial Number."},"name":{"type":"string","description":"Device name - note that this can also be the name of the application/package which the data comes from, if coming from a data aggregator such as Google Fit."},"software_version":{"type":"string","description":"Device Software Version."},"activation_timestamp":{"type":"string","description":"Activation timestamp of the device, if applicable."},"data_provided":{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"},"description":"Data provided by the device, as enumerated types."},"last_upload_date":{"type":"string","description":"Last upload date from the device."}}},"DistanceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceData.yaml","type":"object","properties":{"detailed":{"$ref":"#/components/schemas/DistanceDataDetailed","description":"Object containing detailed distance information - this may included second-by-second samples."},"summary":{"$ref":"#/components/schemas/DistanceDataSummary","description":"Object containing summary information related to distance covered throughout the workout."}}},"DistanceDataDetailed":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceDataDetailed.yaml","type":"object","properties":{"distance_samples":{"type":"array","items":{"$ref":"#/components/schemas/DistanceSample"},"description":"Array of detailed samples of distance covered throughout the workout."},"elevation_samples":{"type":"array","items":{"$ref":"#/components/schemas/ElevationSample"},"description":"Array of detailed samples of elevation throughout the workout."},"floors_climbed_samples":{"type":"array","items":{"$ref":"#/components/schemas/FloorsClimbedSample"},"description":"Array of detailed samples of floors climbed throughout the workout, as determined by the fitness data provider."},"step_samples":{"type":"array","items":{"$ref":"#/components/schemas/StepSample"},"description":"Array of detailed samples of steps performed throughout the workout."}}},"DistanceSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"distance_meters":{"type":"number","description":"Cumulative distance covered up to associated timestamp, since the start of the payload"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"ElevationSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ElevationSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"elev_meters":{"type":"number","description":"User's altitude at a given point in time, in meters above sea level."},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"FloorsClimbedSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/FloorsClimbedSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"floors_climbed":{"type":"integer","description":"Cumulative number of elevation gain measured in floors climbed up to associated timestamp, since the start of the payload"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"StepSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StepSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"steps":{"type":"integer","description":"Cumulative number of steps taken up to associated timestamp, since the start of the payload"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"DistanceDataSummary":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceDataSummary.yaml","type":"object","properties":{"distance_meters":{"type":"integer","description":"Total distance covered by the user throughout the workout."},"elevation":{"$ref":"#/components/schemas/ElevationData","description":"Object containing information on the elevation of the user throughout the workout."},"floors_climbed":{"type":"integer","description":"Total number of elevation gain in floors climbed equivalent throughout the workout, as determined by the fitness data provider."},"steps":{"type":"integer","description":"Total number of steps performed during the workout."},"swimming":{"$ref":"#/components/schemas/SwimmingData","description":"Summary information of the user's swimming statistics for the workout, if applicable."}}},"ElevationData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ElevationData.yaml","type":"object","properties":{"avg_meters":{"type":"number","description":"Average elevation of the user throughout the workout."},"gain_actual_meters":{"type":"number","minimum":0,"description":"Actual elevation gain of the user throughout the workout - this includes all elevation gain, and does _not_ represent net gain."},"gain_planned_meters":{"type":"number","minimum":0,"description":"Planned elevation gain for the workout."},"loss_actual_meters":{"type":"number","minimum":0,"description":"Elevation loss of the user throughout the workout."},"max_meters":{"type":"number","description":"Maximum elevation of the user during the workout."},"min_meters":{"type":"number","description":"Minimum elevation of the user during the workout."}}},"SwimmingData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SwimmingData.yaml","type":"object","properties":{"num_laps":{"type":"integer","minimum":0,"description":"Total number of swimming laps performed during the day."},"num_strokes":{"type":"integer","minimum":0,"description":"Total number of swimming strokes performed during the day."},"pool_length_meters":{"type":"integer","minimum":0,"description":"Pool length for associated with the day."}}},"EnergyData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/EnergyData.yaml","type":"object","properties":{"energy_kilojoules":{"type":"number","description":"Total number of kiloJoules expended during the workout"},"energy_planned_kilojoules":{"type":"number","description":"Total number of kiloJoules planned to be expended during the workout - represents the user's predefined goal for the workout"}}},"HeartRateData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateData.yaml","type":"object","properties":{"detailed":{"$ref":"#/components/schemas/HeartRateDataDetailed","description":"Object containing detailed heart rate information for the associated workout."},"summary":{"$ref":"#/components/schemas/HeartRateDataSummary","description":"Object containing summary heart rate information for the associated workout."}}},"HeartRateDataDetailed":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataDetailed.yaml","type":"object","properties":{"hr_samples":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateDataSample"},"description":"Array of HeartRate data samples recorded for the user during the workout."},"hrv_samples_rmssd":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleRMSSD"},"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using RMSSD."},"hrv_samples_sdnn":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleSDNN"},"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using SDNN."}}},"HeartRateDataSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"bpm":{"type":"number","description":"User's heart rate in bpm"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"},"context":{"$ref":"#/components/schemas/HeartRateContext","description":"Represents the context in which heart rate was measured."}}},"HeartRateContext":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateContext.yaml","oneOf":[{"type":"number","const":0,"description":"Heart rate measurement context is not specified.","title":"Not Set"},{"type":"number","const":1,"description":"Heart rate was measured during physical activity or exercise.","title":"Active"},{"type":"number","const":2,"description":"Heart rate was measured during rest or non-active periods.","title":"Not Active"}],"description":"Represents the context in which heart rate was measured."},"HeartRateVariabilityDataSampleRMSSD":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleRMSSD.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hrv_rmssd":{"type":"number","description":"User's Heart Rate Variability, computed using RMSSD"}}},"HeartRateVariabilityDataSampleSDNN":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleSDNN.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hrv_sdnn":{"type":"number","description":"User's Heart Rate Variability, computed using SDNN"}}},"HeartRateDataSummary":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSummary.yaml","type":"object","properties":{"avg_hr_bpm":{"type":"number","minimum":0,"description":"Average HeartRate of the user during the workout."},"avg_hrv_rmssd":{"type":"number","description":"Average HeartRate Variability of the user during the workout, computed using RMSSD."},"avg_hrv_sdnn":{"type":"number","description":"Average HeartRate Variability of the user during the workout, computed using SDNN."},"hr_zone_data":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateZoneData"},"description":"Array of time spent in various HR zones throughout the workout."},"max_hr_bpm":{"type":"number","minimum":0,"description":"Maximum HeartRate of the user during the workout."},"min_hr_bpm":{"type":"number","minimum":0,"description":"Minimum HeartRate of the user during the workout."},"resting_hr_bpm":{"type":"number","minimum":0,"description":"Resting HeartRate of the user, as determined by the fitness data provider."},"user_max_hr_bpm":{"type":"number","description":"User's maximum HeartRate based on their age, and other factors as determined by the fitness data provider."}}},"HeartRateZoneData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZoneData.yaml","type":"object","properties":{"zone":{"$ref":"#/components/schemas/HeartRateZone","description":"Heart rate zone designation"},"start_percentage":{"type":"number","minimum":0,"maximum":100,"description":"Start percentage (based off user's max HR) of the HR zone"},"end_percentage":{"type":"number","minimum":0,"maximum":100,"description":"End percentage (based off user's max HR) of the HR zone"},"name":{"type":"string","description":"Name of the associated heart rate zone"},"duration_seconds":{"type":"number","description":"Duration spent in the heart rate zone"}}},"HeartRateZone":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZone.yaml","oneOf":[{"type":"number","const":0,"description":"Resting heart rate zone.","title":"Zone 0"},{"type":"number","const":1,"description":"Very light activity zone.","title":"Zone 1"},{"type":"number","const":2,"description":"Light activity zone.","title":"Zone 2"},{"type":"number","const":3,"description":"Moderate activity zone.","title":"Zone 3"},{"type":"number","const":4,"description":"Hard activity zone.","title":"Zone 4"},{"type":"number","const":5,"description":"Maximum effort zone.","title":"Zone 5"},{"type":"number","const":6,"description":"Heart rate zone that doesn't fit into the standard zones or couldn't be classified.","title":"Other"}],"description":"Represents the heart rate zone the user is currently in during a workout or activity"},"LapData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LapData.yaml","type":"object","properties":{"laps":{"type":"array","items":{"$ref":"#/components/schemas/LapSample"},"description":"Array of datapoints for each lap performed by the user during the workout."}}},"LapSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LapSample.yaml","type":"object","properties":{"calories":{"type":"number","description":"Calories burned during the lap"},"avg_hr_bpm":{"type":"number","description":"Average heart rate in bpm, for the Lap sample"},"start_time":{"type":"string","description":"The start time of the associated lap, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time"},"avg_speed_meters_per_second":{"type":"number","description":"Average speed of the user during the lap"},"distance_meters":{"type":"number","description":"Distance covered during the lap"},"total_strokes":{"type":"integer","description":"Total strokes performed during the lap - only relevant for swimming activities"},"end_time":{"type":"string","description":"The end time of the associated lap, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time"},"stroke_type":{"$ref":"#/components/schemas/StrokeType","description":"Stroke type - only relevant for swimming activities"}}},"StrokeType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StrokeType.yaml","oneOf":[{"type":"string","const":"other","description":"Any swimming stroke style that doesn't fit the standard categories.","title":"Other"},{"type":"string","const":"freestyle","description":"Front crawl stroke where swimmers alternate arm movements with face in water.","title":"Freestyle"},{"type":"string","const":"backstroke","description":"Swimming stroke performed on the back with alternating arm movements.","title":"Backstroke"},{"type":"string","const":"breaststroke","description":"Swimming stroke where arms move simultaneously in a heart-shaped pattern with a frog kick.","title":"Breaststroke"},{"type":"string","const":"butterfly","description":"Swimming stroke with simultaneous overhead arm movements and dolphin kick.","title":"Butterfly"}],"description":"Stroke type used for the workout step (e.g. breaststroke)"},"METData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/METData.yaml","type":"object","properties":{"MET_samples":{"type":"array","items":{"$ref":"#/components/schemas/METSample"},"description":"An array of Metabolic Equivalent Time samples, as calculated by the user's wearable."},"avg_level":{"type":"number","description":"The average MET level of the activity."},"num_high_intensity_minutes":{"type":"number","minimum":0,"description":"Number of minutes spent in High Intensity during the workout - based off MET scale."},"num_inactive_minutes":{"type":"number","minimum":0,"description":"Number of minutes spent in state of Inactivity during the workout - based off MET scale."},"num_low_intensity_minutes":{"type":"number","minimum":0,"description":"Number of minutes spent in Low Intensity during the workout - based off MET scale."},"num_moderate_intensity_minutes":{"type":"number","minimum":0,"description":"Number of minutes spent in Moderate Intensity during the workout - based off MET scale."}}},"METSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/METSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"level":{"type":"number","description":"Metabolic Equivalent of Task (MET) level at the given timestamp"}}},"ActivityMetadata":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityMetadata.yaml","type":"object","properties":{"city":{"type":"string","description":"The City in which the workout was performed."},"country":{"type":"string","description":"The Country in which the workout was performed."},"end_time":{"type":"string","description":"The end time of the associated workout, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"name":{"type":"string","description":"The name - either user-entered or given by the fitness data provider - of the associated workout."},"start_time":{"type":"string","description":"The start time of the associated workout, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"state":{"type":"string","description":"The State in which the workout was performed."},"summary_id":{"type":"string","description":"A unique identifier for the workout - note that this is unique for the given user, and may not be globally unique."},"timestamp_localization":{"$ref":"#/components/schemas/TimestampLocalization"},"type":{"$ref":"#/components/schemas/ActivityType","description":"The type of activity performed for the associated workout."},"upload_type":{"$ref":"#/components/schemas/UploadType","description":"The upload type for the associated workout, providing information on whether this was an automatic workout or user-entered."}},"required":["end_time","start_time","summary_id","type","upload_type"]},"TimestampLocalization":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml","type":"number","enum":[0,1],"description":"Indicates whether the timestamps in this payload are localized (LOCAL) or in UTC."},"ActivityType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityType.yaml","oneOf":[{"type":"number","const":0,"description":"Activity type for when the user is in a vehicle, such as a car or bus.","title":"In Vehicle"},{"type":"number","const":1,"description":"Activity type for general biking or cycling.","title":"Biking"},{"type":"number","const":3,"description":"Activity type for when the user is still or not moving.","title":"Still"},{"type":"number","const":4,"description":"Activity type is unknown or could not be determined.","title":"Unknown"},{"type":"number","const":5,"description":"Activity type for when the device detects a tilting motion.","title":"Tilting"},{"type":"number","const":7,"description":"Activity type for general walking.","title":"Walking"},{"type":"number","const":8,"description":"Activity type for general running.","title":"Running"},{"type":"number","const":9,"description":"Activity type for aerobic exercises and workouts.","title":"Aerobics"},{"type":"number","const":10,"description":"Activity type for playing badminton.","title":"Badminton"},{"type":"number","const":11,"description":"Activity type for playing baseball.","title":"Baseball"},{"type":"number","const":12,"description":"Activity type for playing basketball.","title":"Basketball"},{"type":"number","const":13,"description":"Activity type for biathlon, combining cross-country skiing and rifle shooting.","title":"Biathlon"},{"type":"number","const":14,"description":"Activity type for hand biking, using a hand-powered bicycle.","title":"Hand Biking"},{"type":"number","const":15,"description":"Activity type for off-road cycling on rough terrain.","title":"Mountain Biking"},{"type":"number","const":16,"description":"Activity type for cycling on paved roads.","title":"Road Biking"},{"type":"number","const":17,"description":"Activity type for indoor cycling classes or spinning.","title":"Spinning"},{"type":"number","const":18,"description":"Activity type for exercising on a stationary bicycle.","title":"Stationary Biking"},{"type":"number","const":19,"description":"Activity type for cycling for transportation or utility purposes.","title":"Utility Biking"},{"type":"number","const":20,"description":"Activity type for boxing training or matches.","title":"Boxing"},{"type":"number","const":21,"description":"Activity type for bodyweight exercises focusing on rhythm and flow.","title":"Calisthenics"},{"type":"number","const":22,"description":"Activity type for workout consisting of a series of exercises performed in rotation.","title":"Circuit Training"},{"type":"number","const":23,"description":"Activity type for playing cricket.","title":"Cricket"},{"type":"number","const":24,"description":"Activity type for various forms of dance.","title":"Dancing"},{"type":"number","const":25,"description":"Activity type for exercising on an elliptical trainer.","title":"Elliptical"},{"type":"number","const":26,"description":"Activity type for fencing sport.","title":"Fencing"},{"type":"number","const":27,"description":"Activity type for playing American football.","title":"American Football"},{"type":"number","const":28,"description":"Activity type for playing Australian rules football.","title":"Australian Football"},{"type":"number","const":29,"description":"Activity type for playing soccer/football.","title":"English Football"},{"type":"number","const":30,"description":"Activity type for playing frisbee or disc sports.","title":"Frisbee"},{"type":"number","const":31,"description":"Activity type for gardening and yard work.","title":"Gardening"},{"type":"number","const":32,"description":"Activity type for playing golf.","title":"Golf"},{"type":"number","const":33,"description":"Activity type for performing gymnastics.","title":"Gymnastics"},{"type":"number","const":34,"description":"Activity type for playing handball.","title":"Handball"},{"type":"number","const":35,"description":"Activity type for hiking or walking on trails.","title":"Hiking"},{"type":"number","const":36,"description":"Activity type for playing hockey.","title":"Hockey"},{"type":"number","const":37,"description":"Activity type for horseback riding.","title":"Horseback Riding"},{"type":"number","const":38,"description":"Activity type for household chores and cleaning.","title":"Housework"},{"type":"number","const":39,"description":"Activity type for skipping or jumping rope.","title":"Jumping Rope"},{"type":"number","const":40,"description":"Activity type for kayaking on water.","title":"Kayaking"},{"type":"number","const":41,"description":"Activity type for exercises using kettlebells.","title":"Kettlebell Training"},{"type":"number","const":42,"description":"Activity type for kickboxing training or matches.","title":"Kickboxing"},{"type":"number","const":43,"description":"Activity type for kitesurfing or kiteboarding.","title":"Kitesurfing"},{"type":"number","const":44,"description":"Activity type for general martial arts training.","title":"Martial Arts"},{"type":"number","const":45,"description":"Activity type for meditation practice.","title":"Meditation"},{"type":"number","const":46,"description":"Activity type for MMA training or fighting.","title":"Mixed Martial Arts"},{"type":"number","const":47,"description":"Activity type for P90X home fitness program.","title":"P90X Exercises"},{"type":"number","const":48,"description":"Activity type for paragliding sport.","title":"Paragliding"},{"type":"number","const":49,"description":"Activity type for pilates exercises.","title":"Pilates"},{"type":"number","const":50,"description":"Activity type for playing polo.","title":"Polo"},{"type":"number","const":51,"description":"Activity type for playing racquetball.","title":"Racquetball"},{"type":"number","const":52,"description":"Activity type for rock climbing.","title":"Rock Climbing"},{"type":"number","const":53,"description":"Activity type for rowing on water.","title":"Rowing"},{"type":"number","const":54,"description":"Activity type for exercising on a rowing machine.","title":"Rowing Machine"},{"type":"number","const":55,"description":"Activity type for playing rugby.","title":"Rugby"},{"type":"number","const":56,"description":"Activity type for jogging at a leisurely pace.","title":"Jogging"},{"type":"number","const":57,"description":"Activity type for running on beach or sandy surface.","title":"Running on Sand"},{"type":"number","const":58,"description":"Activity type for running on a treadmill.","title":"Treadmill Running"},{"type":"number","const":59,"description":"Activity type for sailing on water.","title":"Sailing"},{"type":"number","const":60,"description":"Activity type for scuba diving underwater.","title":"Scuba Diving"},{"type":"number","const":61,"description":"Activity type for skateboarding.","title":"Skateboarding"},{"type":"number","const":62,"description":"Activity type for general skating.","title":"Skating"},{"type":"number","const":63,"description":"Activity type for cross skating or nordic skating.","title":"Cross Skating"},{"type":"number","const":64,"description":"Activity type for rollerblading indoors.","title":"Indoor Rollerblading"},{"type":"number","const":65,"description":"Activity type for general skiing.","title":"Skiing"},{"type":"number","const":66,"description":"Activity type for backcountry or off-piste skiing.","title":"Back Country Skiing"},{"type":"number","const":67,"description":"Activity type for cross-country skiing.","title":"Cross Country Skiing"},{"type":"number","const":68,"description":"Activity type for alpine or downhill skiing.","title":"Downhill Skiing"},{"type":"number","const":69,"description":"Activity type for skiing with a kite for propulsion.","title":"Kite Skiing"},{"type":"number","const":70,"description":"Activity type for roller skiing on wheels.","title":"Roller Skiing"},{"type":"number","const":71,"description":"Activity type for sledding or tobogganing.","title":"Sledding"},{"type":"number","const":73,"description":"Activity type for snowboarding.","title":"Snowboarding"},{"type":"number","const":74,"description":"Activity type for riding a snowmobile.","title":"Snowmobile"},{"type":"number","const":75,"description":"Activity type for walking with snowshoes.","title":"Snowshoeing"},{"type":"number","const":76,"description":"Activity type for playing squash.","title":"Squash"},{"type":"number","const":77,"description":"Activity type for climbing stairs.","title":"Stair Climbing"},{"type":"number","const":78,"description":"Activity type for exercising on a stair climbing machine.","title":"Stair Climbing Machine"},{"type":"number","const":79,"description":"Activity type for stand-up paddleboarding.","title":"Stand Up Paddleboarding"},{"type":"number","const":80,"description":"Activity type for resistance training or weight lifting.","title":"Strength Training"},{"type":"number","const":81,"description":"Activity type for surfing on waves.","title":"Surfing"},{"type":"number","const":82,"description":"Activity type for general swimming.","title":"Swimming"},{"type":"number","const":83,"description":"Activity type for swimming in a swimming pool.","title":"Swimming in Pool"},{"type":"number","const":84,"description":"Activity type for swimming in open water like oceans, lakes or rivers.","title":"Open Water Swimming"},{"type":"number","const":85,"description":"Activity type for playing table tennis or ping pong.","title":"Table Tennis"},{"type":"number","const":86,"description":"Activity type for general team sports not otherwise classified.","title":"Team Sports"},{"type":"number","const":87,"description":"Activity type for playing tennis.","title":"Tennis"},{"type":"number","const":88,"description":"Activity type for exercising on a treadmill.","title":"Treadmill"},{"type":"number","const":89,"description":"Activity type for general volleyball.","title":"Volleyball"},{"type":"number","const":90,"description":"Activity type for playing volleyball on a beach.","title":"Beach Volleyball"},{"type":"number","const":91,"description":"Activity type for playing volleyball indoors.","title":"Indoor Volleyball"},{"type":"number","const":92,"description":"Activity type for wakeboarding on water.","title":"Wakeboarding"},{"type":"number","const":93,"description":"Activity type for walking specifically for exercise.","title":"Walking for Fitness"},{"type":"number","const":94,"description":"Activity type for walking with poles.","title":"Nordic Walking"},{"type":"number","const":95,"description":"Activity type for walking on a treadmill.","title":"Treadmill Walking"},{"type":"number","const":96,"description":"Activity type for playing water polo.","title":"Water Polo"},{"type":"number","const":97,"description":"Activity type for weightlifting exercises.","title":"Weightlifting"},{"type":"number","const":98,"description":"Activity type for wheelchair-based movement.","title":"Wheelchair"},{"type":"number","const":99,"description":"Activity type for windsurfing on water.","title":"Windsurfing"},{"type":"number","const":100,"description":"Activity type for practicing yoga.","title":"Yoga"},{"type":"number","const":101,"description":"Activity type for Zumba dance fitness.","title":"Zumba"},{"type":"number","const":102,"description":"Activity type for diving or jumping into water.","title":"Diving"},{"type":"number","const":103,"description":"Activity type for exercising on an ergometer.","title":"Ergometer"},{"type":"number","const":104,"description":"Activity type for skating on ice.","title":"Ice Skating"},{"type":"number","const":105,"description":"Activity type for skating indoors.","title":"Indoor Skating"},{"type":"number","const":106,"description":"Activity type for playing curling on ice.","title":"Curling"},{"type":"number","const":108,"description":"Activity type for activities that don't fit into other categories.","title":"Other"},{"type":"number","const":113,"description":"Activity type for CrossFit training.","title":"CrossFit"},{"type":"number","const":114,"description":"Activity type for high-intensity interval training.","title":"HIIT"},{"type":"number","const":115,"description":"Activity type for general interval training workouts.","title":"Interval Training"},{"type":"number","const":116,"description":"Activity type for walking while pushing a stroller.","title":"Walking with Stroller"},{"type":"number","const":117,"description":"Activity type for riding in an elevator.","title":"Elevator"},{"type":"number","const":118,"description":"Activity type for riding on an escalator.","title":"Escalator"},{"type":"number","const":119,"description":"Activity type for practicing archery.","title":"Archery"},{"type":"number","const":120,"description":"Activity type for playing softball.","title":"Softball"},{"type":"number","const":122,"description":"Activity type for practicing guided breathing exercises.","title":"Guided Breathing"},{"type":"number","const":123,"description":"Activity type for general cardiovascular exercise.","title":"Cardio Training"},{"type":"number","const":124,"description":"Activity type for playing lacrosse.","title":"Lacrosse"},{"type":"number","const":125,"description":"Activity type for stretching exercises.","title":"Stretching"},{"type":"number","const":126,"description":"Activity type for triathlon events combining swimming, cycling and running.","title":"Triathlon"},{"type":"number","const":127,"description":"Activity type for inline skating or rollerblading.","title":"Inline Skating"},{"type":"number","const":128,"description":"Activity type for sky diving or parachuting.","title":"Sky Diving"},{"type":"number","const":129,"description":"Activity type for general paddling activities.","title":"Paddling"},{"type":"number","const":130,"description":"Activity type for mountaineering or alpine climbing.","title":"Mountaineering"},{"type":"number","const":131,"description":"Activity type for fishing activities.","title":"Fishing"},{"type":"number","const":132,"description":"Activity type for water skiing.","title":"Water Skiing"},{"type":"number","const":133,"description":"Activity type for running indoors.","title":"Indoor Running"},{"type":"number","const":134,"description":"Activity type for playing padel tennis.","title":"Padel Tennis"},{"type":"number","const":135,"description":"Activity type for driving a vehicle.","title":"Driving"},{"type":"number","const":136,"description":"Activity type for driving off-road or on unpaved surfaces.","title":"Off-Road Driving"},{"type":"number","const":137,"description":"Activity type for riding a motorcycle.","title":"Motorbiking"},{"type":"number","const":138,"description":"Activity type for motorsport racing.","title":"Motor Racing"},{"type":"number","const":139,"description":"Activity type for enduro motorcycle racing.","title":"Enduro"},{"type":"number","const":140,"description":"Activity type for canoeing on water.","title":"Canoeing"},{"type":"number","const":141,"description":"Activity type for orienteering navigation sport.","title":"Orienteering"},{"type":"number","const":142,"description":"Activity type for hang gliding.","title":"Hang Gliding"},{"type":"number","const":143,"description":"Activity type for piloting an aircraft.","title":"Flying"},{"type":"number","const":144,"description":"Activity type for hot air balloon flying.","title":"Hot Air Ballooning"},{"type":"number","const":145,"description":"Activity type for riding a jet ski on water.","title":"Jet Skiing"},{"type":"number","const":146,"description":"Activity type for operating a motorized boat.","title":"Power Boating"},{"type":"number","const":147,"description":"Activity type for playing Gaelic football.","title":"Gaelic Football"},{"type":"number","const":148,"description":"Activity type for playing hurling.","title":"Hurling"}],"description":"The type of activity performed for the associated workout."},"UploadType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/UploadType.yaml","oneOf":[{"type":"number","const":0,"description":"The upload type is unknown or could not be determined.","title":"Unknown"},{"type":"number","const":1,"description":"The workout was automatically detected and recorded by a device or service.","title":"Automatic"},{"type":"number","const":2,"description":"The workout was manually entered by the user.","title":"Manual"},{"type":"number","const":3,"description":"The workout data represents an update to a previously recorded workout.","title":"Update"},{"type":"number","const":4,"description":"The workout was marked for deletion.","title":"Delete"},{"type":"number","const":5,"description":"The workout upload is pending processing or confirmation.","title":"Pending"},{"type":"number","const":6,"description":"The workout was uploaded or synced from a third-party service or application.","title":"Third party upload"}],"description":"The type of upload for the associated workout, providing information on how the workout data was recorded or entered"},"MovementData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MovementData.yaml","type":"object","properties":{"adjusted_max_speed_meters_per_second":{"type":"number","description":"Adjusted max speed of the user during the workout - generated using Terra's algorithms to remove potential affecting the user's actual max speed measurement."},"avg_cadence_rpm":{"type":"number","description":"Average cadence of the user during the workout, in RPM."},"avg_pace_minutes_per_kilometer":{"type":"number","description":"Average pace of the user during the workout."},"avg_speed_meters_per_second":{"type":"number","description":"Average speed of the user during the workout."},"avg_torque_newton_meters":{"type":"number","description":"Average torque generated by the user during the workout - mainly relevant for cycling activities."},"avg_velocity_meters_per_second":{"type":"number","description":"Average velocity of the user during the workout - only calculated by certain providers, representing a separate quantity from speed."},"cadence_samples":{"type":"array","items":{"$ref":"#/components/schemas/CadenceSample"},"description":"Array of cadence values recorded throughout the workout, sampled at intervals determined by the fitness data provider."},"max_cadence_rpm":{"type":"number","description":"Maximum cadence of the user during the workout - mainly relevant for cycling activities."},"max_pace_minutes_per_kilometer":{"type":"number","description":"Maximum pace of the user during the workout."},"max_speed_meters_per_second":{"type":"number","description":"Maximum speed of the user during the workout."},"max_torque_newton_meters":{"type":"number","description":"Maximum torque generated by the user during the workout - mainly relevant for cycling activities."},"max_velocity_meters_per_second":{"type":"number","description":"Maximum velocity of the user during the workout - only calculated by certain providers, representing a separate quantity from speed."},"normalized_speed_meters_per_second":{"type":"number","description":"Average normalized speed of the user during the workout - only calculated by certain providers, representing a separate quantity from speed."},"speed_samples":{"type":"array","items":{"$ref":"#/components/schemas/SpeedSample"},"description":"Array of the datapoints for the user's speed sampled throughout the workout."},"torque_samples":{"type":"array","items":{"$ref":"#/components/schemas/TorqueSample"},"description":"Array of the datapoints for the user's torque sampled throughout the workout."}}},"CadenceSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CadenceSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"cadence_rpm":{"type":"number","description":"User's cadence at a given instant in time, in revolutions per minute"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"SpeedSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SpeedSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"speed_meters_per_second":{"type":"number","description":"Speed of the user at a given instant in time, in meters per second"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"TorqueSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TorqueSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"},"torque_newton_meters":{"type":"number","description":"Torque generated at a given instant in time, in Newton-meters"}}},"OxygenData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenData.yaml","type":"object","properties":{"avg_saturation_percentage":{"type":"number","description":"Average Oxygen Saturation percentage of the user during the day (SpO2 or SmO2)."},"saturation_samples":{"type":"array","items":{"$ref":"#/components/schemas/OxygenSaturationSample"},"description":"Array of Oxygen Saturation percentage datapoints sampled throughout the day."},"vo2_samples":{"type":"array","items":{"$ref":"#/components/schemas/Vo2MaxSample"},"description":"Array of VO2 datapoints sampled throughout the day."},"vo2max_ml_per_min_per_kg":{"type":"number","description":"VO2Max for the given user."}}},"OxygenSaturationSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"percentage":{"type":"number","description":"User's oxygen saturation percentage - referring to either SpO2 or SmO2, based on the `type` field"},"type":{"$ref":"#/components/schemas/OxygenSaturationType","description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"}}},"OxygenSaturationType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationType.yaml","oneOf":[{"type":"number","const":0,"description":"Oxygen saturation measurement for blood.","title":"Blood"},{"type":"number","const":1,"description":"Oxygen saturation measurement for muscle.","title":"Muscle"}],"description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"},"Vo2MaxSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Vo2MaxSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"vo2max_ml_per_min_per_kg":{"type":"number","description":"User's VO2Max - maximum amount of oxygen the user's body can utilize during exercise"}}},"PolylineMapData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PolylineMapData.yaml","type":"object","properties":{"summary_polyline":{"type":"string","description":"The polyline representation of the user's trajectory throughout the workout"}}},"PositionData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PositionData.yaml","type":"object","properties":{"center_pos_lat_lng_deg":{"type":"array","items":{"type":"number"},"description":"Position of the user at the midway point of the workout, represented by a 2-value array of latitude, longitude, wherein each of the two numbers can be nullable."},"end_pos_lat_lng_deg":{"type":"array","items":{"type":"number"},"description":"Position of the user at the end of the workout, represented by a 2-value array of latitude, longitude, wherein each of the two numbers can be nullable."},"position_samples":{"type":"array","items":{"$ref":"#/components/schemas/PositionSample"},"description":"Array of datapoints of the position of the user, sampled throughout the workout."},"start_pos_lat_lng_deg":{"type":"array","items":{"type":"number"},"description":"Position of the user at the start of the workout, represented by a 2-value array of latitude, longitude, wherein each of the two numbers can be nullable."}}},"PositionSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PositionSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"coords_lat_lng_deg":{"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"description":"Position of the user a given point in time, represented by a 2-value array of latitude, longitude, wherein each of the two numbers can be nullable"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"PowerData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PowerData.yaml","type":"object","properties":{"avg_watts":{"type":"number","description":"Average power output of the user during the workout."},"max_watts":{"type":"number","description":"Maximum power output of the user during the workout."},"power_samples":{"type":"array","items":{"$ref":"#/components/schemas/PowerSample"},"description":"Array containing datapoints of the power output of the user sampled throughout the workout."}}},"PowerSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PowerSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"watts":{"type":"number","description":"Power generated at a given instant in time, in Watts"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"StrainData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StrainData.yaml","type":"object","properties":{"strain_level":{"type":"number","description":"Level of cardiovascular strain imposed on the user during the day."}}},"TSSData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TSSData.yaml","type":"object","properties":{"TSS_samples":{"type":"array","items":{"$ref":"#/components/schemas/TSSSample"},"description":"Array of TSS information sampled throughout the workout"}}},"TSSSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TSSSample.yaml","type":"object","properties":{"planned":{"type":"number","description":"Planned Training Stress Score value"},"actual":{"type":"number","description":"Actual Training Stress Score value achieved"},"method":{"type":"string","description":"Method used to calculate the TSS"},"intensity_factor_planned":{"type":"number","description":"Planned intensity factor for the training session"},"intensity_factor_actual":{"type":"number","description":"Actual intensity factor achieved during the training session"},"normalized_power_watts":{"type":"number","description":"Normalized power output in watts"}}},"WorkData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WorkData.yaml","type":"object","properties":{"work_kilojoules":{"type":"number","description":"Total work output of the user for the workout, in kilojoules."}}},"NoDataReturned":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"message":{"type":"string"},"type":{"type":["string","null"]},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"DataSentToWebhook":{"type":"object","properties":{"reference":{"type":"string","description":"Payload reference, tying the request to the webhook payload which will be received","nullable":true},"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"RequestProcessing":{"type":"object","properties":{"retry_after_seconds":{"type":"number","description":"Recommended time after which the request may be retried","nullable":true},"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"RateLimitRequestProcessing":{"type":"object","properties":{"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"$ref":"#/components/schemas/TerraUser"}},"required":["user"]},"LargeRequestProcessingEvent":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LargeRequestProcessingEvent.yaml","type":"object","properties":{"type":{"type":"string","const":"large_request_processing"},"status":{"type":"string","const":"processing","description":"Status of the processing"},"message":{"type":"string","description":"Information about the processing"},"user":{"$ref":"#/components/schemas/TerraUser","description":"User whose data is being processed"},"reference":{"type":"string","description":"Reference ID for tracking this request"}},"required":["type","status","message","user","reference"],"allOf":[{"$ref":"#/components/schemas/WebhookEvent"}],"description":"Large request processing event"},"WebhookEvent":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml","type":"object","properties":{"type":{"type":"string","description":"The type of event"},"status":{"type":"string","description":"Status of the event"}},"required":["type"],"description":"Base webhook event structure that all events extend from"}}},"paths":{"/activity":{"get":{"summary":"Retrieve activity data for a given user ID","description":"Fetches completed workout sessions, with a defined start and end time and activity type (e.g. running, cycling, etc.)","tags":["Activity"],"operationId":"Activity_Fetch","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (UUID format) to retrieve data for","schema":{"type":"string"},"required":true},{"name":"start_date","in":"query","description":"Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":true},{"name":"end_date","in":"query","description":"End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":false},{"name":"to_webhook","in":"query","description":"Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)\n","schema":{"type":"boolean"},"required":false},{"name":"with_samples","in":"query","description":"Boolean flag specifying whether to include detailed samples in the returned payload (default: false)\n","schema":{"type":"boolean"},"required":false}],"responses":{"200":{"description":"Returned upon successful data request","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Activity"}},"type":{"type":["string","null"]}}},{"$ref":"#/components/schemas/NoDataReturned"},{"$ref":"#/components/schemas/DataSentToWebhook"},{"$ref":"#/components/schemas/RequestProcessing"},{"$ref":"#/components/schemas/RateLimitRequestProcessing"},{"$ref":"#/components/schemas/LargeRequestProcessingEvent"}]}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"401":{"description":"Returned when credentials (dev ID and API key) are invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"An error message","type":"string"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Retrieve body metrics for a given user ID

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]},"Body":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Body.yaml","type":"object","properties":{"blood_pressure_data":{"$ref":"#/components/schemas/BloodPressureData","description":"Object containing information on user's Blood Pressure."},"device_data":{"$ref":"#/components/schemas/DeviceData","description":"Object containing information on the device which recorded data for the payload."},"heart_data":{"$ref":"#/components/schemas/HeartData","description":"Object containing information on user's heart metrics."},"hydration_data":{"$ref":"#/components/schemas/HydrationData","description":"Object containing information on user's hydration (both internal & consumption of water) for the day."},"ketone_data":{"$ref":"#/components/schemas/KetoneData","description":"Object containing information on user's ketone data for the day."},"measurements_data":{"$ref":"#/components/schemas/MeasurementsData","description":"Object containing information on body measurements for the day."},"metadata":{"$ref":"#/components/schemas/BodyMetadata","description":"Object containing daily summary metadata."},"oxygen_data":{"$ref":"#/components/schemas/OxygenData","description":"Object containing information on user's oxygen-related data."},"temperature_data":{"$ref":"#/components/schemas/TemperatureData","description":"Object containing temperature information (core, skin, ambient) during the day."},"glucose_data":{"$ref":"#/components/schemas/GlucoseData","description":"Object containing information on user's blood glucose for the day."}},"required":["metadata"]},"BloodPressureData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BloodPressureData.yaml","type":"object","properties":{"blood_pressure_samples":{"type":"array","items":{"$ref":"#/components/schemas/BloodPressureSample"},"description":"List of Blood Pressure measurements sampled throughout the day."}}},"BloodPressureSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BloodPressureSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"diastolic_bp":{"type":"number","description":"User's diastolic blood pressure, in mmHg"},"systolic_bp":{"type":"number","description":"User's systolic blood pressure, in mmHg"}}},"DeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceData.yaml","type":"object","properties":{"activation_timestamp":{"type":"string","description":"Activation timestamp of the device, if applicable."},"data_provided":{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"},"description":"Data provided by the device, as enumerated types."},"hardware_version":{"type":"string","description":"Hardware version of the device."},"last_upload_date":{"type":"string","description":"Last upload date from the device."},"manufacturer":{"type":"string","description":"Device manufacturer name."},"name":{"type":"string","description":"Device name - note that this can also be the name of the application/package which the data comes from, if coming from a data aggregator such as Google Fit."},"other_devices":{"type":"array","items":{"$ref":"#/components/schemas/OtherDeviceData"},"description":"Data pertaining to other devices which may have contributed data for this workout."},"sensor_state":{"type":"string","description":"Sensor state of the device."},"serial_number":{"type":"string","description":"Device Serial Number."},"software_version":{"type":"string","description":"Device Software Version."}}},"DeviceDataType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceDataType.yaml","oneOf":[{"type":"string","const":"STEPS","description":"Count of steps taken by the user.","title":"Steps"},{"type":"string","const":"ACTIVE_MINUTES","description":"Duration of time the user spent in physical activity.","title":"Active Minutes"},{"type":"string","const":"BMR","description":"User's basal metabolic rate - calories burned at rest.","title":"Basal Metabolic Rate"},{"type":"string","const":"CALORIES","description":"Calories burned by the user during activity.","title":"Calories"},{"type":"string","const":"DISTANCE","description":"Distance traveled by the user during activity.","title":"Distance"},{"type":"string","const":"HEART_RATE","description":"User's heart rate measurements.","title":"Heart Rate"},{"type":"string","const":"OXYGEN_SATURATION","description":"Blood oxygen saturation level (SpO2) of the user.","title":"Oxygen Saturation"},{"type":"string","const":"SLEEP_TYPE","description":"Classification of user's sleep stages or types.","title":"Sleep Classification"},{"type":"string","const":"SPEED","description":"User's movement speed during activity.","title":"Speed"},{"type":"string","const":"CADENCE","description":"Rate of movement repetition during activity (steps per minute).","title":"Cadence"}],"description":"Represents data types that a certain device contributed to."},"OtherDeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OtherDeviceData.yaml","type":"object","properties":{"manufacturer":{"type":"string","description":"Device manufacturer name."},"hardware_version":{"type":"string","description":"Hardware version of the device."},"serial_number":{"type":"string","description":"Device Serial Number."},"name":{"type":"string","description":"Device name - note that this can also be the name of the application/package which the data comes from, if coming from a data aggregator such as Google Fit."},"software_version":{"type":"string","description":"Device Software Version."},"activation_timestamp":{"type":"string","description":"Activation timestamp of the device, if applicable."},"data_provided":{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"},"description":"Data provided by the device, as enumerated types."},"last_upload_date":{"type":"string","description":"Last upload date from the device."}}},"HeartData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartData.yaml","type":"object","properties":{"afib_classification_samples":{"type":"array","items":{"$ref":"#/components/schemas/AFibClassificationSample"},"description":"List of Atrial Fibrillation classification measurements sampled through the day."},"ecg_signal":{"type":"array","items":{"$ref":"#/components/schemas/ECGReading"},"description":"List of ECGReadings sampled through the day."},"heart_rate_data":{"$ref":"#/components/schemas/HeartRateData","description":"Object containing heart rate data."},"pulse_wave_velocity_samples":{"type":"array","items":{"$ref":"#/components/schemas/PulseVelocitySample"},"description":"List of Pulse Wave Velocity measurements sampled throughout the day. This represents a measurement of arterial stiffness that is an independent predictor of cardiovascular risk."},"rr_interval_samples":{"type":"array","items":{"$ref":"#/components/schemas/RRIntervalSample"},"description":"List of RR Interval samples throughout the day."}}},"AFibClassificationSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AFibClassificationSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"afib_classification":{"$ref":"#/components/schemas/AFibFlag","description":"Flag indicating the atrial fibrillation classification of the individual"}}},"AFibFlag":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AFibFlag.yaml","oneOf":[{"type":"number","const":0,"description":"AFib was not detected in the heart rhythm analysis.","title":"Negative"},{"type":"number","const":1,"description":"AFib was detected in the heart rhythm analysis.","title":"Positive"},{"type":"number","const":2,"description":"The heart rhythm analysis couldn't determine whether AFib was present or absent.","title":"Inconclusive"}],"description":"Flag indicating the atrial fibrillation classification of the individual"},"ECGReading":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ECGReading.yaml","type":"object","properties":{"start_timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"avg_hr_bpm":{"type":"number","description":"User's average heart rate throughout the day, in beats per minute (bpm)."},"afib_classification":{"$ref":"#/components/schemas/AFibFlag","description":"User's afib classification throught the day."},"raw_signal":{"type":"array","items":{"$ref":"#/components/schemas/RawECGSample"},"description":"List of raw ECG readings sampled through the day."}}},"RawECGSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RawECGSample.yaml","type":"object","properties":{"potential_uV":{"type":"number","description":"Potential uV in the RawECG Sample"},"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."}}},"HeartRateData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateData.yaml","type":"object","properties":{"detailed":{"$ref":"#/components/schemas/HeartRateDataDetailed","description":"Object containing detailed heart rate information for the associated workout."},"summary":{"$ref":"#/components/schemas/HeartRateDataSummary","description":"Object containing summary heart rate information for the associated workout."}}},"HeartRateDataDetailed":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataDetailed.yaml","type":"object","properties":{"hr_samples":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateDataSample"},"description":"Array of HeartRate data samples recorded for the user during the workout."},"hrv_samples_rmssd":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleRMSSD"},"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using RMSSD."},"hrv_samples_sdnn":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleSDNN"},"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using SDNN."}}},"HeartRateDataSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"bpm":{"type":"number","description":"User's heart rate in bpm"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"},"context":{"$ref":"#/components/schemas/HeartRateContext","description":"Represents the context in which heart rate was measured."}}},"HeartRateContext":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateContext.yaml","oneOf":[{"type":"number","const":0,"description":"Heart rate measurement context is not specified.","title":"Not Set"},{"type":"number","const":1,"description":"Heart rate was measured during physical activity or exercise.","title":"Active"},{"type":"number","const":2,"description":"Heart rate was measured during rest or non-active periods.","title":"Not Active"}],"description":"Represents the context in which heart rate was measured."},"HeartRateVariabilityDataSampleRMSSD":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleRMSSD.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hrv_rmssd":{"type":"number","description":"User's Heart Rate Variability, computed using RMSSD"}}},"HeartRateVariabilityDataSampleSDNN":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleSDNN.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hrv_sdnn":{"type":"number","description":"User's Heart Rate Variability, computed using SDNN"}}},"HeartRateDataSummary":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSummary.yaml","type":"object","properties":{"avg_hr_bpm":{"type":"number","minimum":0,"description":"Average HeartRate of the user during the workout."},"avg_hrv_rmssd":{"type":"number","description":"Average HeartRate Variability of the user during the workout, computed using RMSSD."},"avg_hrv_sdnn":{"type":"number","description":"Average HeartRate Variability of the user during the workout, computed using SDNN."},"hr_zone_data":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateZoneData"},"description":"Array of time spent in various HR zones throughout the workout."},"max_hr_bpm":{"type":"number","minimum":0,"description":"Maximum HeartRate of the user during the workout."},"min_hr_bpm":{"type":"number","minimum":0,"description":"Minimum HeartRate of the user during the workout."},"resting_hr_bpm":{"type":"number","minimum":0,"description":"Resting HeartRate of the user, as determined by the fitness data provider."},"user_max_hr_bpm":{"type":"number","description":"User's maximum HeartRate based on their age, and other factors as determined by the fitness data provider."}}},"HeartRateZoneData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZoneData.yaml","type":"object","properties":{"zone":{"$ref":"#/components/schemas/HeartRateZone","description":"Heart rate zone designation"},"start_percentage":{"type":"number","minimum":0,"maximum":100,"description":"Start percentage (based off user's max HR) of the HR zone"},"end_percentage":{"type":"number","minimum":0,"maximum":100,"description":"End percentage (based off user's max HR) of the HR zone"},"name":{"type":"string","description":"Name of the associated heart rate zone"},"duration_seconds":{"type":"number","description":"Duration spent in the heart rate zone"}}},"HeartRateZone":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZone.yaml","oneOf":[{"type":"number","const":0,"description":"Resting heart rate zone.","title":"Zone 0"},{"type":"number","const":1,"description":"Very light activity zone.","title":"Zone 1"},{"type":"number","const":2,"description":"Light activity zone.","title":"Zone 2"},{"type":"number","const":3,"description":"Moderate activity zone.","title":"Zone 3"},{"type":"number","const":4,"description":"Hard activity zone.","title":"Zone 4"},{"type":"number","const":5,"description":"Maximum effort zone.","title":"Zone 5"},{"type":"number","const":6,"description":"Heart rate zone that doesn't fit into the standard zones or couldn't be classified.","title":"Other"}],"description":"Represents the heart rate zone the user is currently in during a workout or activity"},"PulseVelocitySample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PulseVelocitySample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"pulse_wave_velocity_meters_per_second":{"type":"number","description":"User's Pulse Wave Velocity measurement - velocity at which the blood pressure pulse propagates through the circulatory system"}}},"RRIntervalSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RRIntervalSample.yaml","type":"object","properties":{"rr_interval_ms":{"type":"number","description":"User's RR Interval for a specific heart beat in milliseconds."},"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hr_bpm":{"type":"number","description":"The heart beat value at that specific instance."}}},"HydrationData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HydrationData.yaml","type":"object","properties":{"day_total_water_consumption_ml":{"type":"number","description":"User's total water consumption throughout the day."},"hydration_amount_samples":{"type":"array","items":{"$ref":"#/components/schemas/HydrationMeasurementSample"},"description":"User's hydration level samples throughout the day."}}},"HydrationMeasurementSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HydrationMeasurementSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hydration_kg":{"type":"number","description":"Total body water composition of the user, in kilograms."}}},"KetoneData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/KetoneData.yaml","type":"object","properties":{"ketone_samples":{"type":"array","items":{"$ref":"#/components/schemas/KetoneSample"},"description":"List of ketone data sampled through the day."}}},"KetoneSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/KetoneSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"ketone_mg_per_dL":{"type":"number","description":"Ketone in mg per dL"},"sample_type":{"$ref":"#/components/schemas/KetoneSampleType","description":"Flag indicating the ketone sample type (e.g. blood, breath, urine)"}}},"KetoneSampleType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/KetoneSampleType.yaml","oneOf":[{"type":"number","const":0,"description":"The type of ketone sample is unknown or not specified.","title":"Unknown"},{"type":"number","const":1,"description":"Ketone sample taken from blood.","title":"Blood"},{"type":"number","const":2,"description":"Ketone sample taken from urine.","title":"Urine"},{"type":"number","const":3,"description":"Ketone sample taken from breath.","title":"Breath"}],"description":"Flag indicating the ketone sample type (e.g. blood, breath, urine)"},"MeasurementsData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MeasurementsData.yaml","type":"object","properties":{"measurements":{"type":"array","items":{"$ref":"#/components/schemas/MeasurementDataSample"},"description":"List of body metrics & measurements taken throughout the associated day."}}},"MeasurementDataSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MeasurementDataSample.yaml","type":"object","properties":{"measurement_time":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"BMI":{"type":"number","description":"User's Body Mass Index (BMI)."},"BMR":{"type":"number","description":"User's Basal Metabolic Rate - minimum amount of calories that a person's body needs to perform necessary functions."},"RMR":{"type":"number","description":"User's Resting Metabolic Rate - amount of energy that a person's body needs to function while at rest. RMR accounts for additional low-effort daily activities on top of basic body functions."},"estimated_fitness_age":{"type":"string","description":"Estimate of how fit the user is compared to their actual age, as measured by the device."},"skin_fold_mm":{"type":"number","description":"User's skin fold measurement."},"bodyfat_percentage":{"type":"number","minimum":0,"maximum":100,"description":"User's body fat percentage."},"weight_kg":{"type":"number","description":"User's body weight."},"height_cm":{"type":"number","description":"User's height."},"bone_mass_g":{"type":"number","description":"User's total bone mass."},"muscle_mass_g":{"type":"number","description":"User's total muscle mass (i.e. skeletal muscle mass)."},"lean_mass_g":{"type":"number","description":"Total lean mass of the user - calculated as the difference between total body weight and body fat weight."},"water_percentage":{"type":"number","minimum":0,"maximum":100,"description":"Total amount of fluid in the user's body."},"insulin_units":{"type":"number","description":"Quantity of insulin administered to the user."},"insulin_type":{"type":"string","description":"Type of insulin administered to the user."},"urine_color":{"type":"string","description":"Color of the user's urine."},"user_notes":{"type":"string","description":"User notes associated with the measurement."}}},"BodyMetadata":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BodyMetadata.yaml","type":"object","properties":{"end_time":{"type":"string","description":"The end time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h after start_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"start_time":{"type":"string","description":"The start time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h before end_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"timestamp_localization":{"$ref":"#/components/schemas/TimestampLocalization"}},"required":["end_time","start_time"]},"TimestampLocalization":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml","type":"number","enum":[0,1],"description":"Indicates whether the timestamps in this payload are localized (LOCAL) or in UTC."},"OxygenData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenData.yaml","type":"object","properties":{"avg_saturation_percentage":{"type":"number","description":"Average Oxygen Saturation percentage of the user during the day (SpO2 or SmO2)."},"saturation_samples":{"type":"array","items":{"$ref":"#/components/schemas/OxygenSaturationSample"},"description":"Array of Oxygen Saturation percentage datapoints sampled throughout the day."},"vo2_samples":{"type":"array","items":{"$ref":"#/components/schemas/Vo2MaxSample"},"description":"Array of VO2 datapoints sampled throughout the day."},"vo2max_ml_per_min_per_kg":{"type":"number","description":"VO2Max for the given user."}}},"OxygenSaturationSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"percentage":{"type":"number","description":"User's oxygen saturation percentage - referring to either SpO2 or SmO2, based on the `type` field"},"type":{"$ref":"#/components/schemas/OxygenSaturationType","description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"}}},"OxygenSaturationType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationType.yaml","oneOf":[{"type":"number","const":0,"description":"Oxygen saturation measurement for blood.","title":"Blood"},{"type":"number","const":1,"description":"Oxygen saturation measurement for muscle.","title":"Muscle"}],"description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"},"Vo2MaxSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Vo2MaxSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"vo2max_ml_per_min_per_kg":{"type":"number","description":"User's VO2Max - maximum amount of oxygen the user's body can utilize during exercise"}}},"TemperatureData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TemperatureData.yaml","type":"object","properties":{"ambient_temperature_samples":{"type":"array","items":{"$ref":"#/components/schemas/TemperatureSample"},"description":"List of ambient temperature measurements sampled throughout the day."},"body_temperature_samples":{"type":"array","items":{"$ref":"#/components/schemas/TemperatureSample"},"description":"List of body temperature measurements sampled throughout the day."},"skin_temperature_samples":{"type":"array","items":{"$ref":"#/components/schemas/TemperatureSample"},"description":"List of skin temperature measurements sampled throughout the day."}}},"TemperatureSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TemperatureSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"temperature_celsius":{"type":"number","description":"Temperature value in degrees Celsius."}}},"GlucoseData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseData.yaml","type":"object","properties":{"blood_glucose_samples":{"type":"array","items":{"$ref":"#/components/schemas/GlucoseDataSample"},"description":"List of blood glucose readings sampled throughout the day."},"detailed_blood_glucose_samples":{"type":"array","items":{"$ref":"#/components/schemas/GlucoseDataSample"},"description":"List of blood glucose readings sampled throughout the day - this represents additional data points, potentially at higher frequency from the ones in blood_glucose_samples, which may come at a cost of reduced accuracy."},"day_avg_blood_glucose_mg_per_dL":{"type":"number","description":"User's average glucose level throughout the day."},"gmi":{"type":"number","description":"GMI (Glucose Management Indicator) is a metric derived from continuous glucose monitoring (CGM) data that estimates average glucose levels to help guide diabetes management, without implying a precise match to laboratory A1C."},"time_in_range":{"type":"number","description":"Time that the user's glucose is within acceptable range (not hyper or hypoglycemic)."},"sensor_usage":{"type":"integer","description":"Number of data points recorded by the sensor throughout the day."},"daily_patterns":{"type":"array","items":{"$ref":"#/components/schemas/DailyPatternSample"},"description":"List of glucose percentile samples throughout the day."}}},"GlucoseDataSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseDataSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"blood_glucose_mg_per_dL":{"type":"integer","description":"User's blood glucose reading"},"glucose_level_flag":{"$ref":"#/components/schemas/GlucoseFlag","description":"Flag indicating state of user's blood glucose level"},"trend_arrow":{"$ref":"#/components/schemas/TrendArrow","description":"Flag indicating the current trend in the user's blood glucose level (e.g. rising, constant, falling)"}}},"GlucoseFlag":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseFlag.yaml","oneOf":[{"type":"number","const":0,"description":"Blood glucose level is within the normal/healthy range.","title":"Normal"},{"type":"number","const":1,"description":"Blood glucose level is above the normal range (hyperglycemia).","title":"High"},{"type":"number","const":2,"description":"Blood glucose level is below the normal range (hypoglycemia).","title":"Low"}],"description":"Flag indicating state of user's blood glucose level"},"TrendArrow":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TrendArrow.yaml","oneOf":[{"type":"number","const":0,"description":"Glucose trend cannot be determined.","title":"Unknown"},{"type":"number","const":1,"description":"Glucose level is decreasing rapidly.","title":"Falling Quickly"},{"type":"number","const":2,"description":"Glucose level is decreasing gradually.","title":"Falling"},{"type":"number","const":3,"description":"Glucose level is remaining stable.","title":"Flat"},{"type":"number","const":4,"description":"Glucose level is increasing gradually.","title":"Rising"},{"type":"number","const":5,"description":"Glucose level is increasing rapidly.","title":"Rising Quickly"}],"description":"Flag indicating the current trend in the user's blood glucose level (e.g. rising, constant, falling)"},"DailyPatternSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyPatternSample.yaml","type":"object","properties":{"time_from_midnight":{"type":"integer","minimum":0,"maximum":23,"description":"Hour of the day, represented as an integer from 0 to 23, where 0 is midnight and 23 is the hour before the next midnight."},"percentile_5":{"type":"integer","description":"Percentile 5 of the glucose level at the given time of day."},"percentile_25":{"type":"integer","description":"Percentile 25 of the glucose level at the given time of day."},"percentile_50":{"type":"integer","description":"Percentile 50 of the glucose level at the given time of day."},"percentile_75":{"type":"integer","description":"Percentile 75 of the glucose level at the given time of day."},"percentile_95":{"type":"integer","description":"Percentile 95 of the glucose level at the given time of day."}}},"NoDataReturned":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"message":{"type":"string"},"type":{"type":["string","null"]},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"DataSentToWebhook":{"type":"object","properties":{"reference":{"type":"string","description":"Payload reference, tying the request to the webhook payload which will be received","nullable":true},"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"RequestProcessing":{"type":"object","properties":{"retry_after_seconds":{"type":"number","description":"Recommended time after which the request may be retried","nullable":true},"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"RateLimitRequestProcessing":{"type":"object","properties":{"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"$ref":"#/components/schemas/TerraUser"}},"required":["user"]},"LargeRequestProcessingEvent":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LargeRequestProcessingEvent.yaml","type":"object","properties":{"type":{"type":"string","const":"large_request_processing"},"status":{"type":"string","const":"processing","description":"Status of the processing"},"message":{"type":"string","description":"Information about the processing"},"user":{"$ref":"#/components/schemas/TerraUser","description":"User whose data is being processed"},"reference":{"type":"string","description":"Reference ID for tracking this request"}},"required":["type","status","message","user","reference"],"allOf":[{"$ref":"#/components/schemas/WebhookEvent"}],"description":"Large request processing event"},"WebhookEvent":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml","type":"object","properties":{"type":{"type":"string","description":"The type of event"},"status":{"type":"string","description":"Status of the event"}},"required":["type"],"description":"Base webhook event structure that all events extend from"}}},"paths":{"/body":{"get":{"summary":"Retrieve body metrics for a given user ID","description":"Fetches body metrics such as weight, height, body fat percentage etc. for a given user ID","tags":["Body"],"operationId":"Body_Fetch","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (UUID format) to retrieve data for","schema":{"type":"string"},"required":true},{"name":"start_date","in":"query","description":"Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":true},{"name":"end_date","in":"query","description":"End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":false},{"name":"to_webhook","in":"query","description":"Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)\n","schema":{"type":"boolean"},"required":false},{"name":"with_samples","in":"query","description":"Boolean flag specifying whether to include detailed samples in the returned payload (default: false)\n","schema":{"type":"boolean"},"required":false}],"responses":{"200":{"description":"Returned upon successful data request","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Body"}},"type":{"type":["string","null"]}}},{"$ref":"#/components/schemas/NoDataReturned"},{"$ref":"#/components/schemas/DataSentToWebhook"},{"$ref":"#/components/schemas/RequestProcessing"},{"$ref":"#/components/schemas/RateLimitRequestProcessing"},{"$ref":"#/components/schemas/LargeRequestProcessingEvent"}]}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"401":{"description":"Returned when credentials (dev ID and API key) are invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"An error message","type":"string"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Retrieve daily activity summaries for a given user ID

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]},"Daily":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Daily.yaml","type":"object","properties":{"active_durations_data":{"$ref":"#/components/schemas/ActiveDurationsData","description":"Object containing information related to the time spent in different activity intensities during over the day."},"calories_data":{"$ref":"#/components/schemas/CaloriesData","description":"Object containing calorie-related information for the user during the specific day."},"data_enrichment":{"$ref":"#/components/schemas/DailyDataEnrichment","description":"Object containing additional enrichment data for the day."},"device_data":{"$ref":"#/components/schemas/DeviceData","description":"Object containing information on the device which recorded data for the day."},"distance_data":{"$ref":"#/components/schemas/DailyDistanceData","description":"Object containing information related to distance covered during the associated day."},"heart_rate_data":{"$ref":"#/components/schemas/HeartRateData","description":"Object containing heartrate-related information for the day."},"MET_data":{"$ref":"#/components/schemas/METData","description":"Object containing information on the Metabolic Equivalent of Task for the day."},"metadata":{"$ref":"#/components/schemas/DailyMetadata","description":"Object containing daily summary metadata."},"oxygen_data":{"$ref":"#/components/schemas/OxygenData","description":"Object containing information on oxygen-related metrics for the day."},"scores":{"$ref":"#/components/schemas/ScoresData","description":"Scores for the user's performance on different metrics for the given day, as calculated by the fitness data provider."},"strain_data":{"$ref":"#/components/schemas/StrainData","description":"Object containing information on the strain put on the user's body over a day."},"stress_data":{"$ref":"#/components/schemas/StressData","description":"Object containing information on the stress put on the user over a day."},"tag_data":{"$ref":"#/components/schemas/TagData","description":"Object containing all user-entered or automatically tagged events in the day."}},"required":["metadata"]},"ActiveDurationsData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActiveDurationsData.yaml","type":"object","properties":{"activity_levels_samples":{"type":"array","items":{"$ref":"#/components/schemas/ActivityLevelSample"},"description":"Array of detailed samples of the intensity the user was in at various points during the workout."},"activity_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in an active state during the workout."},"inactivity_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in an inactive state during the workout."},"low_intensity_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in a low intensity state during the workout."},"moderate_intensity_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in a moderate intensity state during the workout."},"num_continuous_inactive_periods":{"type":"integer","minimum":0,"description":"Maximum number of continuous periods spent in an inactive state during the workout."},"rest_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent resting during the workout."},"vigorous_intensity_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in a state of vigorous intensity during the workout."},"standing_hours_count":{"type":"number"},"standing_seconds":{"type":"number"}}},"ActivityLevelSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityLevelSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"level":{"$ref":"#/components/schemas/ActivityLevel"}}},"ActivityLevel":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityLevel.yaml","oneOf":[{"type":"number","const":0,"description":"Activity level is unknown or could not be determined.","title":"Unknown"},{"type":"number","const":1,"description":"User is at rest, with minimal to no physical activity.","title":"Rest"},{"type":"number","const":2,"description":"User is awake but inactive or sedentary.","title":"Inactive"},{"type":"number","const":3,"description":"User is engaged in light physical activity such as casual walking.","title":"Low Intensity"},{"type":"number","const":4,"description":"User is engaged in moderate physical activity such as brisk walking or light exercise.","title":"Medium Intensity"},{"type":"number","const":5,"description":"User is engaged in vigorous physical activity such as running or intense exercise.","title":"High Intensity"}],"description":"Intensity of the user's activity at an instant in time"},"CaloriesData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CaloriesData.yaml","type":"object","properties":{"BMR_calories":{"type":"number","description":"Basal Metabolic Rate calories - calories burned at rest."},"calorie_samples":{"type":"array","items":{"$ref":"#/components/schemas/CalorieSample"},"description":"Array of calorie data samples recorded throughout the time period."},"net_activity_calories":{"type":"number","description":"Net calories burned through activity (excluding BMR)."},"net_intake_calories":{"type":"number","description":"Net calories consumed through food and drink intake."},"total_burned_calories":{"type":"number","description":"Total calories burned including BMR and activity."}}},"CalorieSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CalorieSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"calories":{"type":"number","description":"Number of calories burned at the given timestamp."},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"DailyDataEnrichment":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyDataEnrichment.yaml","type":"object","properties":{"cardiovascular_contributors":{"type":"array","items":{"$ref":"#/components/schemas/DataContributor"},"description":"Array of factors contributing to cardiovascular score."},"cardiovascular_score":{"type":"number","description":"Cardiovascular health score for the day."},"immune_contributors":{"type":"array","items":{"$ref":"#/components/schemas/DataContributor"},"description":"Array of factors contributing to immune index."},"immune_index":{"type":"number","description":"Immune system health index for the day."},"readiness_contributors":{"type":"array","items":{"$ref":"#/components/schemas/DataContributor"},"description":"Array of factors contributing to readiness score."},"readiness_score":{"type":"number","description":"Readiness score for the day."},"respiratory_contributors":{"type":"array","items":{"$ref":"#/components/schemas/DataContributor"},"description":"Array of factors contributing to respiratory score."},"respiratory_score":{"type":"number","description":"Respiratory health score for the day."},"start_time":{"type":"string","description":"Start time for the data enrichment calculation period."},"stress_contributors":{"type":"array","items":{"$ref":"#/components/schemas/DataContributor"},"description":"Array of factors contributing to stress score."},"total_stress_score":{"type":"number","description":"Total stress score for the day."}}},"DataContributor":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DataContributor.yaml","type":"object","properties":{"contributor_name":{"type":"string","description":"Name of the factor contributing to the score."},"contributor_score":{"type":"number","description":"Numerical score representing the contribution of this factor."}},"required":["contributor_name","contributor_score"]},"DeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceData.yaml","type":"object","properties":{"activation_timestamp":{"type":"string","description":"Activation timestamp of the device, if applicable."},"data_provided":{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"},"description":"Data provided by the device, as enumerated types."},"hardware_version":{"type":"string","description":"Hardware version of the device."},"last_upload_date":{"type":"string","description":"Last upload date from the device."},"manufacturer":{"type":"string","description":"Device manufacturer name."},"name":{"type":"string","description":"Device name - note that this can also be the name of the application/package which the data comes from, if coming from a data aggregator such as Google Fit."},"other_devices":{"type":"array","items":{"$ref":"#/components/schemas/OtherDeviceData"},"description":"Data pertaining to other devices which may have contributed data for this workout."},"sensor_state":{"type":"string","description":"Sensor state of the device."},"serial_number":{"type":"string","description":"Device Serial Number."},"software_version":{"type":"string","description":"Device Software Version."}}},"DeviceDataType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceDataType.yaml","oneOf":[{"type":"string","const":"STEPS","description":"Count of steps taken by the user.","title":"Steps"},{"type":"string","const":"ACTIVE_MINUTES","description":"Duration of time the user spent in physical activity.","title":"Active Minutes"},{"type":"string","const":"BMR","description":"User's basal metabolic rate - calories burned at rest.","title":"Basal Metabolic Rate"},{"type":"string","const":"CALORIES","description":"Calories burned by the user during activity.","title":"Calories"},{"type":"string","const":"DISTANCE","description":"Distance traveled by the user during activity.","title":"Distance"},{"type":"string","const":"HEART_RATE","description":"User's heart rate measurements.","title":"Heart Rate"},{"type":"string","const":"OXYGEN_SATURATION","description":"Blood oxygen saturation level (SpO2) of the user.","title":"Oxygen Saturation"},{"type":"string","const":"SLEEP_TYPE","description":"Classification of user's sleep stages or types.","title":"Sleep Classification"},{"type":"string","const":"SPEED","description":"User's movement speed during activity.","title":"Speed"},{"type":"string","const":"CADENCE","description":"Rate of movement repetition during activity (steps per minute).","title":"Cadence"}],"description":"Represents data types that a certain device contributed to."},"OtherDeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OtherDeviceData.yaml","type":"object","properties":{"manufacturer":{"type":"string","description":"Device manufacturer name."},"hardware_version":{"type":"string","description":"Hardware version of the device."},"serial_number":{"type":"string","description":"Device Serial Number."},"name":{"type":"string","description":"Device name - note that this can also be the name of the application/package which the data comes from, if coming from a data aggregator such as Google Fit."},"software_version":{"type":"string","description":"Device Software Version."},"activation_timestamp":{"type":"string","description":"Activation timestamp of the device, if applicable."},"data_provided":{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"},"description":"Data provided by the device, as enumerated types."},"last_upload_date":{"type":"string","description":"Last upload date from the device."}}},"DailyDistanceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyDistanceData.yaml","type":"object","properties":{"detailed":{"$ref":"#/components/schemas/DistanceDataDetailed","description":"Object containing detailed distance information - this may include second-by-second samples."},"distance_meters":{"type":"number","description":"Total distance covered by the user throughout the day."},"elevation":{"$ref":"#/components/schemas/ElevationData","description":"Object containing information on the elevation of the user throughout the day."},"floors_climbed":{"type":"integer","minimum":0,"description":"Total number of elevation gain in floors climbed equivalent throughout the day, as determined by the fitness data provider."},"steps":{"type":"integer","description":"Total number of steps performed during the day."},"swimming":{"$ref":"#/components/schemas/SwimmingData","description":"Summary information of the user's swimming statistics for the day, if applicable."}}},"DistanceDataDetailed":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceDataDetailed.yaml","type":"object","properties":{"distance_samples":{"type":"array","items":{"$ref":"#/components/schemas/DistanceSample"},"description":"Array of detailed samples of distance covered throughout the workout."},"elevation_samples":{"type":"array","items":{"$ref":"#/components/schemas/ElevationSample"},"description":"Array of detailed samples of elevation throughout the workout."},"floors_climbed_samples":{"type":"array","items":{"$ref":"#/components/schemas/FloorsClimbedSample"},"description":"Array of detailed samples of floors climbed throughout the workout, as determined by the fitness data provider."},"step_samples":{"type":"array","items":{"$ref":"#/components/schemas/StepSample"},"description":"Array of detailed samples of steps performed throughout the workout."}}},"DistanceSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"distance_meters":{"type":"number","description":"Cumulative distance covered up to associated timestamp, since the start of the payload"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"ElevationSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ElevationSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"elev_meters":{"type":"number","description":"User's altitude at a given point in time, in meters above sea level."},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"FloorsClimbedSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/FloorsClimbedSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"floors_climbed":{"type":"integer","description":"Cumulative number of elevation gain measured in floors climbed up to associated timestamp, since the start of the payload"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"StepSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StepSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"steps":{"type":"integer","description":"Cumulative number of steps taken up to associated timestamp, since the start of the payload"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"ElevationData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ElevationData.yaml","type":"object","properties":{"avg_meters":{"type":"number","description":"Average elevation of the user throughout the workout."},"gain_actual_meters":{"type":"number","minimum":0,"description":"Actual elevation gain of the user throughout the workout - this includes all elevation gain, and does _not_ represent net gain."},"gain_planned_meters":{"type":"number","minimum":0,"description":"Planned elevation gain for the workout."},"loss_actual_meters":{"type":"number","minimum":0,"description":"Elevation loss of the user throughout the workout."},"max_meters":{"type":"number","description":"Maximum elevation of the user during the workout."},"min_meters":{"type":"number","description":"Minimum elevation of the user during the workout."}}},"SwimmingData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SwimmingData.yaml","type":"object","properties":{"num_laps":{"type":"integer","minimum":0,"description":"Total number of swimming laps performed during the day."},"num_strokes":{"type":"integer","minimum":0,"description":"Total number of swimming strokes performed during the day."},"pool_length_meters":{"type":"integer","minimum":0,"description":"Pool length for associated with the day."}}},"HeartRateData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateData.yaml","type":"object","properties":{"detailed":{"$ref":"#/components/schemas/HeartRateDataDetailed","description":"Object containing detailed heart rate information for the associated workout."},"summary":{"$ref":"#/components/schemas/HeartRateDataSummary","description":"Object containing summary heart rate information for the associated workout."}}},"HeartRateDataDetailed":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataDetailed.yaml","type":"object","properties":{"hr_samples":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateDataSample"},"description":"Array of HeartRate data samples recorded for the user during the workout."},"hrv_samples_rmssd":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleRMSSD"},"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using RMSSD."},"hrv_samples_sdnn":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleSDNN"},"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using SDNN."}}},"HeartRateDataSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"bpm":{"type":"number","description":"User's heart rate in bpm"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"},"context":{"$ref":"#/components/schemas/HeartRateContext","description":"Represents the context in which heart rate was measured."}}},"HeartRateContext":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateContext.yaml","oneOf":[{"type":"number","const":0,"description":"Heart rate measurement context is not specified.","title":"Not Set"},{"type":"number","const":1,"description":"Heart rate was measured during physical activity or exercise.","title":"Active"},{"type":"number","const":2,"description":"Heart rate was measured during rest or non-active periods.","title":"Not Active"}],"description":"Represents the context in which heart rate was measured."},"HeartRateVariabilityDataSampleRMSSD":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleRMSSD.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hrv_rmssd":{"type":"number","description":"User's Heart Rate Variability, computed using RMSSD"}}},"HeartRateVariabilityDataSampleSDNN":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleSDNN.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hrv_sdnn":{"type":"number","description":"User's Heart Rate Variability, computed using SDNN"}}},"HeartRateDataSummary":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSummary.yaml","type":"object","properties":{"avg_hr_bpm":{"type":"number","minimum":0,"description":"Average HeartRate of the user during the workout."},"avg_hrv_rmssd":{"type":"number","description":"Average HeartRate Variability of the user during the workout, computed using RMSSD."},"avg_hrv_sdnn":{"type":"number","description":"Average HeartRate Variability of the user during the workout, computed using SDNN."},"hr_zone_data":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateZoneData"},"description":"Array of time spent in various HR zones throughout the workout."},"max_hr_bpm":{"type":"number","minimum":0,"description":"Maximum HeartRate of the user during the workout."},"min_hr_bpm":{"type":"number","minimum":0,"description":"Minimum HeartRate of the user during the workout."},"resting_hr_bpm":{"type":"number","minimum":0,"description":"Resting HeartRate of the user, as determined by the fitness data provider."},"user_max_hr_bpm":{"type":"number","description":"User's maximum HeartRate based on their age, and other factors as determined by the fitness data provider."}}},"HeartRateZoneData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZoneData.yaml","type":"object","properties":{"zone":{"$ref":"#/components/schemas/HeartRateZone","description":"Heart rate zone designation"},"start_percentage":{"type":"number","minimum":0,"maximum":100,"description":"Start percentage (based off user's max HR) of the HR zone"},"end_percentage":{"type":"number","minimum":0,"maximum":100,"description":"End percentage (based off user's max HR) of the HR zone"},"name":{"type":"string","description":"Name of the associated heart rate zone"},"duration_seconds":{"type":"number","description":"Duration spent in the heart rate zone"}}},"HeartRateZone":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZone.yaml","oneOf":[{"type":"number","const":0,"description":"Resting heart rate zone.","title":"Zone 0"},{"type":"number","const":1,"description":"Very light activity zone.","title":"Zone 1"},{"type":"number","const":2,"description":"Light activity zone.","title":"Zone 2"},{"type":"number","const":3,"description":"Moderate activity zone.","title":"Zone 3"},{"type":"number","const":4,"description":"Hard activity zone.","title":"Zone 4"},{"type":"number","const":5,"description":"Maximum effort zone.","title":"Zone 5"},{"type":"number","const":6,"description":"Heart rate zone that doesn't fit into the standard zones or couldn't be classified.","title":"Other"}],"description":"Represents the heart rate zone the user is currently in during a workout or activity"},"METData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/METData.yaml","type":"object","properties":{"MET_samples":{"type":"array","items":{"$ref":"#/components/schemas/METSample"},"description":"An array of Metabolic Equivalent Time samples, as calculated by the user's wearable."},"avg_level":{"type":"number","description":"The average MET level of the activity."},"num_high_intensity_minutes":{"type":"number","minimum":0,"description":"Number of minutes spent in High Intensity during the workout - based off MET scale."},"num_inactive_minutes":{"type":"number","minimum":0,"description":"Number of minutes spent in state of Inactivity during the workout - based off MET scale."},"num_low_intensity_minutes":{"type":"number","minimum":0,"description":"Number of minutes spent in Low Intensity during the workout - based off MET scale."},"num_moderate_intensity_minutes":{"type":"number","minimum":0,"description":"Number of minutes spent in Moderate Intensity during the workout - based off MET scale."}}},"METSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/METSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"level":{"type":"number","description":"Metabolic Equivalent of Task (MET) level at the given timestamp"}}},"DailyMetadata":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyMetadata.yaml","type":"object","properties":{"end_time":{"type":"string","description":"The end time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h after start_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"start_time":{"type":"string","description":"The start time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h before end_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"timestamp_localization":{"$ref":"#/components/schemas/TimestampLocalization"},"upload_type":{"$ref":"#/components/schemas/UploadType","description":"The upload type for data in the associated day, providing information on whether data was automatically uploaded or user-entered. If any data point in a day is altered, the day should be classed as manual."}},"required":["end_time","start_time","upload_type"]},"TimestampLocalization":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml","type":"number","enum":[0,1],"description":"Indicates whether the timestamps in this payload are localized (LOCAL) or in UTC."},"UploadType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/UploadType.yaml","oneOf":[{"type":"number","const":0,"description":"The upload type is unknown or could not be determined.","title":"Unknown"},{"type":"number","const":1,"description":"The workout was automatically detected and recorded by a device or service.","title":"Automatic"},{"type":"number","const":2,"description":"The workout was manually entered by the user.","title":"Manual"},{"type":"number","const":3,"description":"The workout data represents an update to a previously recorded workout.","title":"Update"},{"type":"number","const":4,"description":"The workout was marked for deletion.","title":"Delete"},{"type":"number","const":5,"description":"The workout upload is pending processing or confirmation.","title":"Pending"},{"type":"number","const":6,"description":"The workout was uploaded or synced from a third-party service or application.","title":"Third party upload"}],"description":"The type of upload for the associated workout, providing information on how the workout data was recorded or entered"},"OxygenData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenData.yaml","type":"object","properties":{"avg_saturation_percentage":{"type":"number","description":"Average Oxygen Saturation percentage of the user during the day (SpO2 or SmO2)."},"saturation_samples":{"type":"array","items":{"$ref":"#/components/schemas/OxygenSaturationSample"},"description":"Array of Oxygen Saturation percentage datapoints sampled throughout the day."},"vo2_samples":{"type":"array","items":{"$ref":"#/components/schemas/Vo2MaxSample"},"description":"Array of VO2 datapoints sampled throughout the day."},"vo2max_ml_per_min_per_kg":{"type":"number","description":"VO2Max for the given user."}}},"OxygenSaturationSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"percentage":{"type":"number","description":"User's oxygen saturation percentage - referring to either SpO2 or SmO2, based on the `type` field"},"type":{"$ref":"#/components/schemas/OxygenSaturationType","description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"}}},"OxygenSaturationType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationType.yaml","oneOf":[{"type":"number","const":0,"description":"Oxygen saturation measurement for blood.","title":"Blood"},{"type":"number","const":1,"description":"Oxygen saturation measurement for muscle.","title":"Muscle"}],"description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"},"Vo2MaxSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Vo2MaxSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"vo2max_ml_per_min_per_kg":{"type":"number","description":"User's VO2Max - maximum amount of oxygen the user's body can utilize during exercise"}}},"ScoresData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ScoresData.yaml","type":"object","properties":{"activity":{"type":"number","minimum":0,"maximum":100,"description":"Activity score for the given day."},"recovery":{"type":"number","minimum":0,"maximum":100,"description":"Recovery score for the given day."},"sleep":{"type":"number","minimum":0,"maximum":100,"description":"Sleep score for the given day, pertaining to the previous night's sleep."},"biological_age":{"type":"number","minimum":0,"maximum":100,"description":"Biological age computed for the given day."}}},"StrainData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StrainData.yaml","type":"object","properties":{"strain_level":{"type":"number","description":"Level of cardiovascular strain imposed on the user during the day."}}},"StressData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StressData.yaml","type":"object","properties":{"avg_stress_level":{"type":"number","description":"Average stress level for the day."},"activity_stress_duration_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in a stressed state while active during the day."},"low_stress_duration_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in a state of low stress during the day."},"max_stress_level":{"type":"number","description":"Maximum stress level recorded during the day."},"medium_stress_duration_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in a state of medium stress during the day."},"samples":{"type":"array","items":{"$ref":"#/components/schemas/StressSample"},"description":"Array of stress level data points sampled throughout the day."},"rest_stress_duration_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in a stressed state while at rest during the day."},"high_stress_duration_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in a state of high stress during the day."},"stress_duration_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in any stressed state during the day."},"stress_rating":{"$ref":"#/components/schemas/StressLevel","description":"Stress rating for the day."},"body_battery_samples":{"type":"array","items":{"$ref":"#/components/schemas/BodyBatterySample"},"description":"Array of Body Battery data points sampled throughout the day."}}},"StressSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StressSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"level":{"type":"number","description":"Stress level measurement at the given timestamp"}}},"StressLevel":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StressLevel.yaml","oneOf":[{"type":"number","const":0,"description":"Stress level is unknown or could not be determined.","title":"Unknown"},{"type":"number","const":1,"description":"Very low stress level (range 1-25).","title":"Rest"},{"type":"number","const":2,"description":"Low stress level (range 26-50).","title":"Low"},{"type":"number","const":3,"description":"Moderate stress level (range 51-75).","title":"Medium"},{"type":"number","const":4,"description":"High stress level (range 76-100).","title":"High"}],"description":"Represents stress level ranges."},"BodyBatterySample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BodyBatterySample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"level":{"type":"number","description":"Body battery energy level at the given timestamp"}}},"TagData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TagData.yaml","type":"object","properties":{"tags":{"type":"array","items":{"$ref":"#/components/schemas/TagEntry"},"description":"Array of user-entered tags for the day."}}},"TagEntry":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TagEntry.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the tag is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"tag_name":{"type":"string","description":"Tag name, representing a certain event associated with the user's day."},"notes":{"type":"string","description":"User-input notes associated with the given tag."}},"required":["timestamp","tag_name","notes"]},"NoDataReturned":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"message":{"type":"string"},"type":{"type":["string","null"]},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"DataSentToWebhook":{"type":"object","properties":{"reference":{"type":"string","description":"Payload reference, tying the request to the webhook payload which will be received","nullable":true},"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"RequestProcessing":{"type":"object","properties":{"retry_after_seconds":{"type":"number","description":"Recommended time after which the request may be retried","nullable":true},"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"RateLimitRequestProcessing":{"type":"object","properties":{"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"$ref":"#/components/schemas/TerraUser"}},"required":["user"]},"LargeRequestProcessingEvent":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LargeRequestProcessingEvent.yaml","type":"object","properties":{"type":{"type":"string","const":"large_request_processing"},"status":{"type":"string","const":"processing","description":"Status of the processing"},"message":{"type":"string","description":"Information about the processing"},"user":{"$ref":"#/components/schemas/TerraUser","description":"User whose data is being processed"},"reference":{"type":"string","description":"Reference ID for tracking this request"}},"required":["type","status","message","user","reference"],"allOf":[{"$ref":"#/components/schemas/WebhookEvent"}],"description":"Large request processing event"},"WebhookEvent":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml","type":"object","properties":{"type":{"type":"string","description":"The type of event"},"status":{"type":"string","description":"Status of the event"}},"required":["type"],"description":"Base webhook event structure that all events extend from"}}},"paths":{"/daily":{"get":{"summary":"Retrieve daily activity summaries for a given user ID","description":"Fetches daily summaries of activity metrics such as steps, distance, calories burned etc. for a given user ID","tags":["Daily"],"operationId":"Daily_Fetch","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (UUID format) to retrieve data for","schema":{"type":"string"},"required":true},{"name":"start_date","in":"query","description":"Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":true},{"name":"end_date","in":"query","description":"End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":false},{"name":"to_webhook","in":"query","description":"Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)\n","schema":{"type":"boolean"},"required":false},{"name":"with_samples","in":"query","description":"Boolean flag specifying whether to include detailed samples in the returned payload (default: false)\n","schema":{"type":"boolean"},"required":false}],"responses":{"200":{"description":"Returned upon successful data request","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Daily"}},"type":{"type":["string","null"]}}},{"$ref":"#/components/schemas/NoDataReturned"},{"$ref":"#/components/schemas/DataSentToWebhook"},{"$ref":"#/components/schemas/RequestProcessing"},{"$ref":"#/components/schemas/RateLimitRequestProcessing"},{"$ref":"#/components/schemas/LargeRequestProcessingEvent"}]}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"401":{"description":"Returned when credentials (dev ID and API key) are invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"An error message","type":"string"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Retrieve menstruation data for a given user ID

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]},"Menstruation":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Menstruation.yaml","type":"object","properties":{"metadata":{"$ref":"#/components/schemas/MenstruationMetadata","description":"Object containing daily summary metadata."},"menstruation_data":{"$ref":"#/components/schemas/MenstruationData","description":"Object containing information on user's menstruation for a given day."}},"required":["metadata"]},"MenstruationMetadata":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationMetadata.yaml","type":"object","properties":{"end_time":{"type":"string","description":"The end time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h after start_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"start_time":{"type":"string","description":"The start time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h before end_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"timestamp_localization":{"$ref":"#/components/schemas/TimestampLocalization"}},"required":["end_time","start_time"]},"TimestampLocalization":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml","type":"number","enum":[0,1],"description":"Indicates whether the timestamps in this payload are localized (LOCAL) or in UTC."},"MenstruationData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationData.yaml","type":"object","properties":{"period_length_days":{"type":"integer","description":"Total length of period (i.e. menstrual bleeding)."},"current_phase":{"$ref":"#/components/schemas/MenstrualPhase","description":"Phase in associated cycle, (i.e. menstruation, fertile etc)."},"length_of_current_phase_days":{"type":"integer","description":"Length of current phase."},"days_until_next_phase":{"type":"integer","description":"Number of days to reach the next phase (predicted)."},"period_start_date":{"type":"string","description":"Start date of menstrual cycle, in ISO8601 format."},"predicted_cycle_length_days":{"type":"integer","description":"Prediction of the cycle's total length."},"day_in_cycle":{"type":"integer","description":"Number of day in cycle this object is associated with."},"last_updated_time":{"type":"string","description":"Last time when the user recorded information regarding their cycle, in ISO8601 format, with microseconds precision."},"cycle_length_days":{"type":"string","description":"Total cycle length in days."},"is_predicted_cycle":{"type":"string","description":"Flag indicating whether associated object is a prediction or user-logged information."},"menstruation_flow":{"type":"array","items":{"$ref":"#/components/schemas/MenstruationFlowSample"},"description":"List of user logs of information related to the strength of user's menstrual flow."}}},"MenstrualPhase":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstrualPhase.yaml","oneOf":[{"type":"string","const":"menstrual","description":"The menstrual phase when bleeding occurs.","title":"Menstrual"},{"type":"string","const":"follicular","description":"The follicular phase when follicles in ovaries develop.","title":"Follicular"},{"type":"string","const":"ovulation","description":"The ovulation phase when an egg is released.","title":"Ovulation"},{"type":"string","const":"luteal","description":"The luteal phase following ovulation.","title":"Luteal"},{"type":"string","const":"pms","description":"Premenstrual syndrome phase before menstruation begins.","title":"PMS"},{"type":"string","const":"fertile","description":"The fertile window when conception is most likely.","title":"Fertile"},{"type":"string","const":"first_trimester","description":"First third of pregnancy, weeks 1-12.","title":"First Trimester"},{"type":"string","const":"second_trimester","description":"Middle third of pregnancy, weeks 13-26.","title":"Second Trimester"},{"type":"string","const":"third_trimester","description":"Final third of pregnancy, weeks 27-40.","title":"Third Trimester"},{"type":"string","const":"unknown","description":"Menstrual cycle phase could not be determined.","title":"Unknown"}],"description":"Represents menstrual cycle phases."},"MenstruationFlowSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationFlowSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"flow":{"$ref":"#/components/schemas/MenstruationFlow","description":"Flag indicating the strength of the user's menstrual flow."}}},"MenstruationFlow":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationFlow.yaml","oneOf":[{"type":"number","const":0,"description":"Flow status is unknown or not recorded.","title":"Unknown"},{"type":"number","const":1,"description":"No menstrual flow present.","title":"None"},{"type":"number","const":2,"description":"Light menstrual flow.","title":"Light"},{"type":"number","const":3,"description":"Moderate menstrual flow.","title":"Medium"},{"type":"number","const":4,"description":"Heavy menstrual flow.","title":"Heavy"},{"type":"number","const":5,"description":"Menstrual flow occurred but intensity not specified.","title":"Had"}],"description":"Flag indicating the strength of the user's menstrual flow"},"NoDataReturned":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"message":{"type":"string"},"type":{"type":["string","null"]},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"DataSentToWebhook":{"type":"object","properties":{"reference":{"type":"string","description":"Payload reference, tying the request to the webhook payload which will be received","nullable":true},"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"RequestProcessing":{"type":"object","properties":{"retry_after_seconds":{"type":"number","description":"Recommended time after which the request may be retried","nullable":true},"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"RateLimitRequestProcessing":{"type":"object","properties":{"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"$ref":"#/components/schemas/TerraUser"}},"required":["user"]},"LargeRequestProcessingEvent":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LargeRequestProcessingEvent.yaml","type":"object","properties":{"type":{"type":"string","const":"large_request_processing"},"status":{"type":"string","const":"processing","description":"Status of the processing"},"message":{"type":"string","description":"Information about the processing"},"user":{"$ref":"#/components/schemas/TerraUser","description":"User whose data is being processed"},"reference":{"type":"string","description":"Reference ID for tracking this request"}},"required":["type","status","message","user","reference"],"allOf":[{"$ref":"#/components/schemas/WebhookEvent"}],"description":"Large request processing event"},"WebhookEvent":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml","type":"object","properties":{"type":{"type":"string","description":"The type of event"},"status":{"type":"string","description":"Status of the event"}},"required":["type"],"description":"Base webhook event structure that all events extend from"}}},"paths":{"/menstruation":{"get":{"summary":"Retrieve menstruation data for a given user ID","description":"Fetches menstruation data such as cycle length, period length, ovulation date etc. for a given user ID","tags":["Menstruation"],"operationId":"Menstruation_Fetch","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (UUID format) to retrieve data for","schema":{"type":"string"},"required":true},{"name":"start_date","in":"query","description":"Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":true},{"name":"end_date","in":"query","description":"End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":false},{"name":"to_webhook","in":"query","description":"Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)\n","schema":{"type":"boolean"},"required":false},{"name":"with_samples","in":"query","description":"Boolean flag specifying whether to include detailed samples in the returned payload (default: false)\n","schema":{"type":"boolean"},"required":false}],"responses":{"200":{"description":"Returned upon successful data request","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Menstruation"}},"type":{"type":["string","null"]}}},{"$ref":"#/components/schemas/NoDataReturned"},{"$ref":"#/components/schemas/DataSentToWebhook"},{"$ref":"#/components/schemas/RequestProcessing"},{"$ref":"#/components/schemas/RateLimitRequestProcessing"},{"$ref":"#/components/schemas/LargeRequestProcessingEvent"}]}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"401":{"description":"Returned when credentials (dev ID and API key) are invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"An error message","type":"string"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Retrieve nutrition log data for a given user ID

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]},"Nutrition":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Nutrition.yaml","type":"object","properties":{"drink_samples":{"type":"array","items":{"$ref":"#/components/schemas/DrinkSample"},"description":"Information on drinks the user consumed throughout the day."},"meals":{"type":"array","items":{"$ref":"#/components/schemas/Meal"},"description":"Information on individual foods consumed throughout a given day."},"metadata":{"$ref":"#/components/schemas/NutritionMetadata","description":"Object containing daily summary metadata."},"summary":{"$ref":"#/components/schemas/NutritionSummary","description":"Summative nutritional information for a given day."}},"required":["metadata"]},"DrinkSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DrinkSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time"},"drink_volume":{"type":"number","description":"Volume of drink consumed"},"drink_unit":{"type":"string","description":"Unit of measurement for the drink"},"drink_name":{"type":"string","description":"Name of drink consumed."}}},"Meal":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Meal.yaml","type":"object","properties":{"micros":{"$ref":"#/components/schemas/NutritionMicros","description":"Micronutrient information for associated food."},"type":{"$ref":"#/components/schemas/MealType","description":"Enum representing the category the consumed food/meal falls under (i.e. Breakfast/Lunch/Dinner etc)."},"id":{"type":"string","description":"Identifier for food logged by the user."},"timestamp":{"type":"string","description":"Timestamp the food is associated with, in ISO8601 format, with microsecond precision."},"quantity":{"$ref":"#/components/schemas/NutritionQuantity","description":"Quantity of the food that was consumed, containing information on amount & units in which this was recorded."},"name":{"type":"string","description":"Name of food logged by the user."},"macros":{"$ref":"#/components/schemas/NutritionMacros","description":"Macronutrient information for associated food."}},"required":["micros","type","id","timestamp","quantity","name","macros"]},"NutritionMicros":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMicros.yaml","type":"object","properties":{"biotin_mg":{"type":"number","description":"Biotin content of the associated food(s)."},"caffeine_mg":{"type":"number","description":"Caffeine content of the associated food(s)."},"calcium_mg":{"type":"number","description":"Calcium content of the associated food(s)."},"chloride_mg":{"type":"number","description":"Chloride content of the associated food(s)."},"chromium_mg":{"type":"number","description":"Chromium content of the associated food(s)."},"copper_mg":{"type":"number","description":"Copper content of the associated food(s)."},"folate_mg":{"type":"number","description":"Folate content of the associated food(s)."},"folic_acid_mg":{"type":"number","description":"Folic Acid content of the associated food(s)."},"iodine_mg":{"type":"number","description":"Iodine content of the associated food(s)."},"iron_mg":{"type":"number","description":"Iron content of the associated food(s)."},"magnesium_mg":{"type":"number","description":"Magnesium content of the associated food(s)."},"manganese_mg":{"type":"number","description":"Manganese content of the associated food(s)."},"molybdenum_mg":{"type":"number","description":"Molybdenum content of the associated food(s)."},"niacin_mg":{"type":"number","description":"Niacin content of the associated food(s)."},"pantothenic_acid_mg":{"type":"number","description":"Pantothenic content of the associated food(s)."},"phosphorus_mg":{"type":"number","description":"Phosphorus content of the associated food(s)."},"potassium_mg":{"type":"number","description":"Potassium content of the associated food(s)."},"riboflavin_mg":{"type":"number","description":"Riboflavin content of the associated food(s)."},"selenium_mg":{"type":"number","description":"Selenium content of the associated food(s)."},"thiamin_mg":{"type":"number","description":"Thiamin content of the associated food(s)."},"vitamin_A_mg":{"type":"number","description":"Vitamin A content of the associated food(s)."},"vitamin_B12_mg":{"type":"number","description":"Vitamin B12 content of the associated food(s)."},"vitamin_B6_mg":{"type":"number","description":"Vitamin B6 content of the associated food(s)."},"vitamin_C_mg":{"type":"number","description":"Vitamin C content of the associated food(s)."},"vitamin_D_mg":{"type":"number","description":"Vitamin D content of the associated food(s)."},"vitamin_D2_mg":{"type":"number","description":"Vitamin D2 content of the associated food(s)."},"vitamin_D3_mg":{"type":"number","description":"Vitamin D3 content of the associated food(s)."},"vitamin_E_mg":{"type":"number","description":"Vitamin E content of the associated food(s)."},"vitamin_K_mg":{"type":"number","description":"Vitamin K content of the associated food(s)."},"zinc_mg":{"type":"number","description":"Zinc content of the associated food(s)."},"cystine_g":{"type":"number","description":"Cystine content of the associated food(s)."},"histidine_g":{"type":"number","description":"Histidine content of the associated food(s)."},"isoleucine_g":{"type":"number","description":"Isoleucine content of the associated food(s)."},"leucine_g":{"type":"number","description":"Leucine content of the associated food(s)."},"lysine_g":{"type":"number","description":"Lysine content of the associated food(s)."},"methionine_g":{"type":"number","description":"Methionine content of the associated food(s)."},"phenylalanine_g":{"type":"number","description":"Phenylalanine content of the associated food(s)."},"threonine_g":{"type":"number","description":"Threonine content of the associated food(s)."},"tryptophan_g":{"type":"number","description":"Tryptophan content of the associated food(s)."},"tyrosine_g":{"type":"number","description":"Tyrosine content of the associated food(s)."},"valine_g":{"type":"number","description":"Valine content of the associated food(s)."},"monounsaturated_fat_g":{"type":"number","description":"Monounsaturated fat content of the associated food(s)."},"polyunsaturated_fat_g":{"type":"number","description":"Polyunsaturated fat content of the associated food(s)."},"omega3_g":{"type":"number","description":"Omega3 content of the associated food(s)."},"omega6_g":{"type":"number","description":"Omega6 content of the associated food(s)."},"starch_g":{"type":"number","description":"Starch content of the associated food(s)."}}},"MealType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MealType.yaml","oneOf":[{"type":"number","const":0,"description":"Meal type is unknown or could not be determined.","title":"Unknown"},{"type":"number","const":1,"description":"Meal consumed in the morning, typically the first meal of the day.","title":"Breakfast"},{"type":"number","const":2,"description":"Light meal or snack consumed in the morning, between breakfast and lunch.","title":"Morning Snack"},{"type":"number","const":3,"description":"Meal consumed around midday, typically the second meal of the day.","title":"Lunch"},{"type":"number","const":4,"description":"Light meal or snack consumed in the afternoon, between lunch and dinner.","title":"Afternoon Snack"},{"type":"number","const":5,"description":"Meal consumed in the evening, typically the last main meal of the day.","title":"Dinner"},{"type":"number","const":6,"description":"Any light meal or snack consumed at any time, not fitting into main meal categories.","title":"Snack"}],"description":"Enum representing the category the consumed food/meal falls under (i.e. Breakfast/Lunch/Dinner etc)"},"NutritionQuantity":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionQuantity.yaml","type":"object","properties":{"unit":{"$ref":"#/components/schemas/NutritionUnits"},"amount":{"type":"number"}},"required":["unit","amount"]},"NutritionUnits":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionUnits.yaml","oneOf":[{"type":"number","const":0,"description":"The unit of measurement is unknown or not specified.","title":"Unknown"},{"type":"number","const":1,"description":"Measurement in grams, a metric unit of mass.","title":"Gram"},{"type":"number","const":2,"description":"Measurement in teaspoons, approximately 5 milliliters.","title":"Teaspoon"},{"type":"number","const":3,"description":"Measurement in tablespoons, approximately 15 milliliters.","title":"Tablespoon"},{"type":"number","const":4,"description":"Measurement in cups, approximately 240 milliliters.","title":"Cup"},{"type":"number","const":5,"description":"Quantity measured in medium-sized eggs.","title":"Medium Egg"},{"type":"number","const":6,"description":"Quantity measured in large-sized eggs.","title":"Large Egg"},{"type":"number","const":7,"description":"Quantity measured in small-sized eggs.","title":"Small Egg"},{"type":"number","const":8,"description":"Measurement in milliliters, a metric unit of volume.","title":"Milliliter"},{"type":"number","const":9,"description":"Measurement in ounces, approximately 28 grams.","title":"Ounce"},{"type":"number","const":10,"description":"Quantity measured by individual count or number of items.","title":"Count"},{"type":"number","const":11,"description":"Quantity measured in scoops, typically used for protein powder or supplements.","title":"Scoop"},{"type":"number","const":12,"description":"Measurement in fluid ounces, approximately 30 milliliters.","title":"Fluid Ounce"}],"description":"Represents units used for nutrition measurements"},"NutritionMacros":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMacros.yaml","type":"object","properties":{"alcohol_g":{"type":"number","description":"Alcohol content of the associated food(s)."},"calories":{"type":"number","description":"Calorie content of the associated food(s)."},"carbohydrates_g":{"type":"number","description":"Carbohydrates content of the associated food(s)."},"cholesterol_mg":{"type":"number","description":"Cholesterol content of the associated food(s)."},"fat_g":{"type":"number","description":"Fat content of the associated food(s)."},"fiber_g":{"type":"number","description":"Fiber content of the associated food(s)."},"net_carbohydrates_g":{"type":"number","description":"Net carbs content of the associated food(s)."},"protein_g":{"type":"number","description":"Protein content of the associated food(s)."},"saturated_fat_g":{"type":"number","description":"Saturated fat content of the associated food(s)."},"sodium_mg":{"type":"number","description":"Sodium content of the associated food(s)."},"sugar_g":{"type":"number","description":"Sugar content of the associated food(s)."},"trans_fat_g":{"type":"number","description":"Trans fat content of the associated food(s)."}}},"NutritionMetadata":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMetadata.yaml","type":"object","properties":{"end_time":{"type":"string","description":"The end time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h after start_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"start_time":{"type":"string","description":"The start time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h before end_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"timestamp_localization":{"$ref":"#/components/schemas/TimestampLocalization"}},"required":["end_time","start_time"]},"TimestampLocalization":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml","type":"number","enum":[0,1],"description":"Indicates whether the timestamps in this payload are localized (LOCAL) or in UTC."},"NutritionSummary":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionSummary.yaml","type":"object","properties":{"macros":{"$ref":"#/components/schemas/NutritionMacros","description":"Summary of macronutrient information for a given day."},"micros":{"$ref":"#/components/schemas/NutritionMicros","description":"Summary of micronutrient information for a given day."},"water_ml":{"type":"number","description":"Water consumption of the user for a given day."},"drink_ml":{"type":"number","description":"Non-water drink consumption of the user for a given day."}}},"NoDataReturned":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"message":{"type":"string"},"type":{"type":["string","null"]},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"DataSentToWebhook":{"type":"object","properties":{"reference":{"type":"string","description":"Payload reference, tying the request to the webhook payload which will be received","nullable":true},"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"RequestProcessing":{"type":"object","properties":{"retry_after_seconds":{"type":"number","description":"Recommended time after which the request may be retried","nullable":true},"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"RateLimitRequestProcessing":{"type":"object","properties":{"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"$ref":"#/components/schemas/TerraUser"}},"required":["user"]},"LargeRequestProcessingEvent":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LargeRequestProcessingEvent.yaml","type":"object","properties":{"type":{"type":"string","const":"large_request_processing"},"status":{"type":"string","const":"processing","description":"Status of the processing"},"message":{"type":"string","description":"Information about the processing"},"user":{"$ref":"#/components/schemas/TerraUser","description":"User whose data is being processed"},"reference":{"type":"string","description":"Reference ID for tracking this request"}},"required":["type","status","message","user","reference"],"allOf":[{"$ref":"#/components/schemas/WebhookEvent"}],"description":"Large request processing event"},"WebhookEvent":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml","type":"object","properties":{"type":{"type":"string","description":"The type of event"},"status":{"type":"string","description":"Status of the event"}},"required":["type"],"description":"Base webhook event structure that all events extend from"}}},"paths":{"/nutrition":{"get":{"summary":"Retrieve nutrition log data for a given user ID","description":"Fetches nutrition log data such as meal type, calories, macronutrients etc. for a given user ID","tags":["Nutrition"],"operationId":"Nutrition_Fetch","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (UUID format) to retrieve data for","schema":{"type":"string"},"required":true},{"name":"start_date","in":"query","description":"Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":true},{"name":"end_date","in":"query","description":"End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":false},{"name":"to_webhook","in":"query","description":"Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)\n","schema":{"type":"boolean"},"required":false},{"name":"with_samples","in":"query","description":"Boolean flag specifying whether to include detailed samples in the returned payload (default: false)\n","schema":{"type":"boolean"},"required":false}],"responses":{"200":{"description":"Returned upon successful data request","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Nutrition"}},"type":{"type":["string","null"]}}},{"$ref":"#/components/schemas/NoDataReturned"},{"$ref":"#/components/schemas/DataSentToWebhook"},{"$ref":"#/components/schemas/RequestProcessing"},{"$ref":"#/components/schemas/RateLimitRequestProcessing"},{"$ref":"#/components/schemas/LargeRequestProcessingEvent"}]}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"401":{"description":"Returned when credentials (dev ID and API key) are invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"An error message","type":"string"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Retrieve sleep sessions for a given user ID

> 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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]},"Sleep":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Sleep.yaml","type":"object","properties":{"data_enrichment":{"$ref":"#/components/schemas/SleepDataEnrichment","description":"Object containing additional enrichment data for the sleep session."},"device_data":{"$ref":"#/components/schemas/DeviceData","description":"Object containing information on the device which recorded data for the payload."},"heart_rate_data":{"$ref":"#/components/schemas/HeartRateData","description":"Object containing information on the user's heart rate during the sleep session."},"metadata":{"$ref":"#/components/schemas/SleepMetadata","description":"Object containing daily summary metadata."},"readiness_data":{"$ref":"#/components/schemas/ReadinessData","description":"Object containing information on the user's readiness for the day, based off the quality and duration of their sleep."},"respiration_data":{"$ref":"#/components/schemas/RespirationData","description":"Object containing information on the user's respiration throughout the sleep session."},"scores":{"type":"object","properties":{"sleep":{"type":"number","description":"User's sleep score."}},"description":"User's sleep score"},"sleep_durations_data":{"$ref":"#/components/schemas/SleepDurationsData","description":"Object containing information on the user's duration spent in various sleep stages."},"temperature_data":{"$ref":"#/components/schemas/SleepTemperatureData","description":"Object containing body temperature information of the user during the sleep recording session."}},"required":["metadata"]},"SleepDataEnrichment":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepDataEnrichment.yaml","type":"object","properties":{"sleep_contributors":{"type":"array","items":{"$ref":"#/components/schemas/DataContributor"}},"sleep_score":{"type":"number"}}},"DataContributor":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DataContributor.yaml","type":"object","properties":{"contributor_name":{"type":"string","description":"Name of the factor contributing to the score."},"contributor_score":{"type":"number","description":"Numerical score representing the contribution of this factor."}},"required":["contributor_name","contributor_score"]},"DeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceData.yaml","type":"object","properties":{"activation_timestamp":{"type":"string","description":"Activation timestamp of the device, if applicable."},"data_provided":{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"},"description":"Data provided by the device, as enumerated types."},"hardware_version":{"type":"string","description":"Hardware version of the device."},"last_upload_date":{"type":"string","description":"Last upload date from the device."},"manufacturer":{"type":"string","description":"Device manufacturer name."},"name":{"type":"string","description":"Device name - note that this can also be the name of the application/package which the data comes from, if coming from a data aggregator such as Google Fit."},"other_devices":{"type":"array","items":{"$ref":"#/components/schemas/OtherDeviceData"},"description":"Data pertaining to other devices which may have contributed data for this workout."},"sensor_state":{"type":"string","description":"Sensor state of the device."},"serial_number":{"type":"string","description":"Device Serial Number."},"software_version":{"type":"string","description":"Device Software Version."}}},"DeviceDataType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceDataType.yaml","oneOf":[{"type":"string","const":"STEPS","description":"Count of steps taken by the user.","title":"Steps"},{"type":"string","const":"ACTIVE_MINUTES","description":"Duration of time the user spent in physical activity.","title":"Active Minutes"},{"type":"string","const":"BMR","description":"User's basal metabolic rate - calories burned at rest.","title":"Basal Metabolic Rate"},{"type":"string","const":"CALORIES","description":"Calories burned by the user during activity.","title":"Calories"},{"type":"string","const":"DISTANCE","description":"Distance traveled by the user during activity.","title":"Distance"},{"type":"string","const":"HEART_RATE","description":"User's heart rate measurements.","title":"Heart Rate"},{"type":"string","const":"OXYGEN_SATURATION","description":"Blood oxygen saturation level (SpO2) of the user.","title":"Oxygen Saturation"},{"type":"string","const":"SLEEP_TYPE","description":"Classification of user's sleep stages or types.","title":"Sleep Classification"},{"type":"string","const":"SPEED","description":"User's movement speed during activity.","title":"Speed"},{"type":"string","const":"CADENCE","description":"Rate of movement repetition during activity (steps per minute).","title":"Cadence"}],"description":"Represents data types that a certain device contributed to."},"OtherDeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OtherDeviceData.yaml","type":"object","properties":{"manufacturer":{"type":"string","description":"Device manufacturer name."},"hardware_version":{"type":"string","description":"Hardware version of the device."},"serial_number":{"type":"string","description":"Device Serial Number."},"name":{"type":"string","description":"Device name - note that this can also be the name of the application/package which the data comes from, if coming from a data aggregator such as Google Fit."},"software_version":{"type":"string","description":"Device Software Version."},"activation_timestamp":{"type":"string","description":"Activation timestamp of the device, if applicable."},"data_provided":{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"},"description":"Data provided by the device, as enumerated types."},"last_upload_date":{"type":"string","description":"Last upload date from the device."}}},"HeartRateData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateData.yaml","type":"object","properties":{"detailed":{"$ref":"#/components/schemas/HeartRateDataDetailed","description":"Object containing detailed heart rate information for the associated workout."},"summary":{"$ref":"#/components/schemas/HeartRateDataSummary","description":"Object containing summary heart rate information for the associated workout."}}},"HeartRateDataDetailed":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataDetailed.yaml","type":"object","properties":{"hr_samples":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateDataSample"},"description":"Array of HeartRate data samples recorded for the user during the workout."},"hrv_samples_rmssd":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleRMSSD"},"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using RMSSD."},"hrv_samples_sdnn":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleSDNN"},"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using SDNN."}}},"HeartRateDataSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"bpm":{"type":"number","description":"User's heart rate in bpm"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"},"context":{"$ref":"#/components/schemas/HeartRateContext","description":"Represents the context in which heart rate was measured."}}},"HeartRateContext":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateContext.yaml","oneOf":[{"type":"number","const":0,"description":"Heart rate measurement context is not specified.","title":"Not Set"},{"type":"number","const":1,"description":"Heart rate was measured during physical activity or exercise.","title":"Active"},{"type":"number","const":2,"description":"Heart rate was measured during rest or non-active periods.","title":"Not Active"}],"description":"Represents the context in which heart rate was measured."},"HeartRateVariabilityDataSampleRMSSD":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleRMSSD.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hrv_rmssd":{"type":"number","description":"User's Heart Rate Variability, computed using RMSSD"}}},"HeartRateVariabilityDataSampleSDNN":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleSDNN.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hrv_sdnn":{"type":"number","description":"User's Heart Rate Variability, computed using SDNN"}}},"HeartRateDataSummary":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSummary.yaml","type":"object","properties":{"avg_hr_bpm":{"type":"number","minimum":0,"description":"Average HeartRate of the user during the workout."},"avg_hrv_rmssd":{"type":"number","description":"Average HeartRate Variability of the user during the workout, computed using RMSSD."},"avg_hrv_sdnn":{"type":"number","description":"Average HeartRate Variability of the user during the workout, computed using SDNN."},"hr_zone_data":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateZoneData"},"description":"Array of time spent in various HR zones throughout the workout."},"max_hr_bpm":{"type":"number","minimum":0,"description":"Maximum HeartRate of the user during the workout."},"min_hr_bpm":{"type":"number","minimum":0,"description":"Minimum HeartRate of the user during the workout."},"resting_hr_bpm":{"type":"number","minimum":0,"description":"Resting HeartRate of the user, as determined by the fitness data provider."},"user_max_hr_bpm":{"type":"number","description":"User's maximum HeartRate based on their age, and other factors as determined by the fitness data provider."}}},"HeartRateZoneData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZoneData.yaml","type":"object","properties":{"zone":{"$ref":"#/components/schemas/HeartRateZone","description":"Heart rate zone designation"},"start_percentage":{"type":"number","minimum":0,"maximum":100,"description":"Start percentage (based off user's max HR) of the HR zone"},"end_percentage":{"type":"number","minimum":0,"maximum":100,"description":"End percentage (based off user's max HR) of the HR zone"},"name":{"type":"string","description":"Name of the associated heart rate zone"},"duration_seconds":{"type":"number","description":"Duration spent in the heart rate zone"}}},"HeartRateZone":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZone.yaml","oneOf":[{"type":"number","const":0,"description":"Resting heart rate zone.","title":"Zone 0"},{"type":"number","const":1,"description":"Very light activity zone.","title":"Zone 1"},{"type":"number","const":2,"description":"Light activity zone.","title":"Zone 2"},{"type":"number","const":3,"description":"Moderate activity zone.","title":"Zone 3"},{"type":"number","const":4,"description":"Hard activity zone.","title":"Zone 4"},{"type":"number","const":5,"description":"Maximum effort zone.","title":"Zone 5"},{"type":"number","const":6,"description":"Heart rate zone that doesn't fit into the standard zones or couldn't be classified.","title":"Other"}],"description":"Represents the heart rate zone the user is currently in during a workout or activity"},"SleepMetadata":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepMetadata.yaml","type":"object","properties":{"end_time":{"type":"string","description":"The end time of the associated sleep session, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"is_nap":{"type":"boolean","description":"Flag indicating whether the sleep session was a nap, or the user's main sleep session for the day."},"start_time":{"type":"string","description":"The start time of the associated sleep session, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h before end_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"summary_id":{"type":"string","description":"A unique identifier for the sleep session."},"timestamp_localization":{"$ref":"#/components/schemas/TimestampLocalization"},"upload_type":{"$ref":"#/components/schemas/SleepUploadType","description":"The upload type for the associated sleep session, providing information on whether this was an automatic sleep or user-entered."}},"required":["end_time","start_time","upload_type"]},"TimestampLocalization":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml","type":"number","enum":[0,1],"description":"Indicates whether the timestamps in this payload are localized (LOCAL) or in UTC."},"SleepUploadType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepUploadType.yaml","oneOf":[{"type":"number","const":0,"description":"The sleep data upload type is unknown or could not be determined.","title":"Unknown"},{"type":"number","const":1,"description":"The sleep data was manually entered by the user.","title":"Manual"},{"type":"number","const":2,"description":"The sleep data was automatically detected and recorded by a device or service.","title":"Automatic"},{"type":"number","const":3,"description":"The sleep data is preliminary or tentative and may be subject to change.","title":"Tentative"},{"type":"number","const":4,"description":"The sleep data upload type cannot be clearly categorized.","title":"Indeterminate"}],"description":"The upload type for the associated workout, providing information on whether this was an automatic workout or user-entered"},"ReadinessData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ReadinessData.yaml","type":"object","properties":{"readiness":{"type":"integer","minimum":0,"maximum":100,"description":"User's readiness score for a given day, resulting from the sleep session."},"recovery_level":{"$ref":"#/components/schemas/RecoveryLevel","description":"User's recovery score for a given day, resulting from the sleep session - takes Enum value."}}},"RecoveryLevel":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RecoveryLevel.yaml","oneOf":[{"type":"number","const":0,"description":"Recovery level could not be determined or is not available.","title":"Unknown"},{"type":"number","const":1,"description":"Extremely low recovery.","title":"Very Poor"},{"type":"number","const":2,"description":"Low recovery level.","title":"Poor"},{"type":"number","const":3,"description":"Below average recovery.","title":"Compromised"},{"type":"number","const":4,"description":"Moderate recovery level.","title":"Ok"},{"type":"number","const":5,"description":"Above average recovery.","title":"Good"},{"type":"number","const":6,"description":"Excellent recovery level.","title":"Very Good"}],"description":"User's recovery score for a given day, resulting from the sleep session"},"RespirationData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RespirationData.yaml","type":"object","properties":{"breaths_data":{"$ref":"#/components/schemas/BreathsData","description":"Object containing information on breathing rate for the sleep session."},"oxygen_saturation_data":{"$ref":"#/components/schemas/OxygenSaturationData","description":"Object containing information on saturation metrics for the sleep session."},"snoring_data":{"$ref":"#/components/schemas/SnoringData","description":"Object containing information on snoring metrics for the sleep session."}}},"BreathsData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BreathsData.yaml","type":"object","properties":{"avg_breaths_per_min":{"type":"number","description":"Average breathing rate of the user during the sleep session."},"max_breaths_per_min":{"type":"number","description":"Maximum breathing rate of the user during the sleep session."},"min_breaths_per_min":{"type":"number","description":"Minimum breathing rate of the user during the sleep session."},"on_demand_reading":{"type":"boolean","description":"Flag indicating if the reading was performed on demand, or if it was automatically captured by the device."},"samples":{"type":"array","items":{"$ref":"#/components/schemas/BreathSample"},"description":"List of breathing rate information sampled throughout the sleep session."},"start_time":{"type":"string","description":"The start time of the recording of breathing rate data, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h before end_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"end_time":{"type":"string","description":"The end time of the recording of breathing rate data, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."}}},"BreathSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BreathSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time"},"breaths_per_min":{"type":"number","description":"User's respiration rate"}}},"OxygenSaturationData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationData.yaml","type":"object","properties":{"avg_saturation_percentage":{"type":"number","description":"Average Oxygen Saturation percentage of the user during the sleep session."},"end_time":{"type":"string","description":"The end time of the recording of oxygen saturation, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"samples":{"type":"array","items":{"$ref":"#/components/schemas/OxygenSaturationSample"},"description":"Array of Oxygen Saturation percentage datapoints sampled throughout the sleep session."},"start_time":{"type":"string","description":"The start time of the recording of oxygen saturation, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h before end_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."}}},"OxygenSaturationSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"percentage":{"type":"number","description":"User's oxygen saturation percentage - referring to either SpO2 or SmO2, based on the `type` field"},"type":{"$ref":"#/components/schemas/OxygenSaturationType","description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"}}},"OxygenSaturationType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationType.yaml","oneOf":[{"type":"number","const":0,"description":"Oxygen saturation measurement for blood.","title":"Blood"},{"type":"number","const":1,"description":"Oxygen saturation measurement for muscle.","title":"Muscle"}],"description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"},"SnoringData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SnoringData.yaml","type":"object","properties":{"start_time":{"type":"string","description":"The start time of the recording of snoring data, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h before end_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"end_time":{"type":"string","description":"The end time of the recording of snoring data, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"num_snoring_events":{"type":"integer","description":"Number of times over the sleep period when the user started snoring, as determined by the device."},"samples":{"type":"array","items":{"$ref":"#/components/schemas/SnoringSample"},"description":"List of snoring information data points sampled throughout the sleep session."},"total_snoring_duration_seconds":{"type":"number","description":"Total duration for which the user was snoring."}}},"SnoringSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SnoringSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"duration_seconds":{"type":"number","description":"Duration of snoring episode, in seconds"}}},"SleepDurationsData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepDurationsData.yaml","type":"object","properties":{"asleep":{"$ref":"#/components/schemas/AsleepDurations","description":"Object containing information on the duration the user spent asleep during the sleep recording session."},"awake":{"$ref":"#/components/schemas/AwakeDurations","description":"Object containing information on the duration the user spent awake during the sleep recording session."},"hypnogram_samples":{"type":"array","items":{"$ref":"#/components/schemas/SleepHypnogramSample"},"description":"List of sleep stage (Hypnogram) samples recorded during the user's sleep session."},"other":{"$ref":"#/components/schemas/OtherSleepDurations","description":"Object containing information on the miscellaneous duration data for the sleep recording session."},"sleep_efficiency":{"type":"number","minimum":0,"maximum":100,"description":"Sleep efficiency of the user given as a percentage, measured as time spent asleep divided by time spent in bed."}}},"AsleepDurations":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AsleepDurations.yaml","type":"object","properties":{"duration_asleep_state_seconds":{"type":"number","description":"Total duration for which the user was asleep, in any state."},"duration_deep_sleep_state_seconds":{"type":"number","description":"Total duration for which the user was in a state of deep sleep."},"duration_light_sleep_state_seconds":{"type":"number","description":"Total duration for which the user was in a state of light sleep."},"duration_REM_sleep_state_seconds":{"type":"number","description":"Total duration for which the user was in a state of REM sleep."},"num_REM_events":{"type":"integer","description":"Number of periods of REM sleep captured during the sleep session."}}},"AwakeDurations":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AwakeDurations.yaml","type":"object","properties":{"duration_awake_state_seconds":{"type":"number","description":"Total duration for which the user was awake during the sleep session."},"duration_long_interruption_seconds":{"type":"number","description":"Total duration for which the user was awake during the sleep session, when the interruption of their sleep was greater than 90 seconds."},"duration_short_interruption_seconds":{"type":"number","description":"Total duration for which the user was awake during the sleep session, when the interruption of their sleep was less than 90 seconds."},"num_out_of_bed_events":{"type":"integer","description":"Number of times the user got out of bed during the sleep session."},"num_wakeup_events":{"type":"integer","description":"Number of times the user woke up during the sleep session."},"sleep_latency_seconds":{"type":"number","description":"Sleep latency, defined as time between the moment the user lays in bed with the intention to sleep and the moment they actually fall asleep."},"wake_up_latency_seconds":{"type":"number","description":"Wake up latency, defined as time between the moment the user wakes up and the moment they get out of bed."}}},"SleepHypnogramSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepHypnogramSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"level":{"$ref":"#/components/schemas/SleepLevel"}}},"SleepLevel":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepLevel.yaml","oneOf":[{"type":"number","const":0,"description":"Sleep level is unknown or could not be determined.","title":"Unknown"},{"type":"number","const":1,"description":"User is awake during the sleep session.","title":"Awake"},{"type":"number","const":2,"description":"User is in a general sleep state.","title":"Sleeping"},{"type":"number","const":3,"description":"User has left the bed during a sleep session.","title":"Out of bed"},{"type":"number","const":4,"description":"User is in light sleep stage.","title":"Light sleep"},{"type":"number","const":5,"description":"User is in deep sleep stage.","title":"Deep sleep"},{"type":"number","const":6,"description":"User is in REM sleep stage.","title":"REM sleep"}],"description":"Represents the sleep level of the user during a sleep session, indicating the depth and quality of sleep"},"OtherSleepDurations":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OtherSleepDurations.yaml","type":"object","properties":{"duration_in_bed_seconds":{"type":"number","description":"Total duration of time spent in bed."},"duration_unmeasurable_sleep_seconds":{"type":"number","description":"Total duration during which the user's state (awake, asleep, REM, etc) was unmeasurable during the sleep session."}}},"SleepTemperatureData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepTemperatureData.yaml","type":"object","properties":{"delta":{"type":"number","description":"Variation in user's skin temperature from their baseline."}}},"NoDataReturned":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"message":{"type":"string"},"type":{"type":["string","null"]},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"DataSentToWebhook":{"type":"object","properties":{"reference":{"type":"string","description":"Payload reference, tying the request to the webhook payload which will be received","nullable":true},"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"RequestProcessing":{"type":"object","properties":{"retry_after_seconds":{"type":"number","description":"Recommended time after which the request may be retried","nullable":true},"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"RateLimitRequestProcessing":{"type":"object","properties":{"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"$ref":"#/components/schemas/TerraUser"}},"required":["user"]},"LargeRequestProcessingEvent":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LargeRequestProcessingEvent.yaml","type":"object","properties":{"type":{"type":"string","const":"large_request_processing"},"status":{"type":"string","const":"processing","description":"Status of the processing"},"message":{"type":"string","description":"Information about the processing"},"user":{"$ref":"#/components/schemas/TerraUser","description":"User whose data is being processed"},"reference":{"type":"string","description":"Reference ID for tracking this request"}},"required":["type","status","message","user","reference"],"allOf":[{"$ref":"#/components/schemas/WebhookEvent"}],"description":"Large request processing event"},"WebhookEvent":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml","type":"object","properties":{"type":{"type":"string","description":"The type of event"},"status":{"type":"string","description":"Status of the event"}},"required":["type"],"description":"Base webhook event structure that all events extend from"}}},"paths":{"/sleep":{"get":{"summary":"Retrieve sleep sessions for a given user ID","description":"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","tags":["Sleep"],"operationId":"Sleep_Fetch","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (UUID format) to retrieve data for","schema":{"type":"string"},"required":true},{"name":"start_date","in":"query","description":"Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":true},{"name":"end_date","in":"query","description":"End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":false},{"name":"to_webhook","in":"query","description":"Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)\n","schema":{"type":"boolean"},"required":false},{"name":"with_samples","in":"query","description":"Boolean flag specifying whether to include detailed samples in the returned payload (default: false)\n","schema":{"type":"boolean"},"required":false}],"responses":{"200":{"description":"Returned upon successful data request","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Sleep"}},"type":{"type":["string","null"]}}},{"$ref":"#/components/schemas/NoDataReturned"},{"$ref":"#/components/schemas/DataSentToWebhook"},{"$ref":"#/components/schemas/RequestProcessing"},{"$ref":"#/components/schemas/RateLimitRequestProcessing"},{"$ref":"#/components/schemas/LargeRequestProcessingEvent"}]}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"401":{"description":"Returned when credentials (dev ID and API key) are invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"An error message","type":"string"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Retrieve workout plans for a given user ID

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]},"PlannedWorkout":{"type":"object","properties":{"steps":{"type":"array","description":"List of exercises/steps/intervals for the workout plan","items":{"$ref":"#/components/schemas/PlannedWorkoutSteps"}},"metadata":{"description":"Metadata for the workout plan","type":"object","allOf":[{"$ref":"#/components/schemas/PlannedWorkoutMetadata"}]}}},"PlannedWorkoutSteps":{"type":"object","properties":{},"oneOf":[{"$ref":"#/components/schemas/PlannedWorkoutStep"},{"$ref":"#/components/schemas/PlannedWorkoutRepeatStep"},{"$ref":"#/components/schemas/SwimmingPlannedWorkoutStep"},{"$ref":"#/components/schemas/CardioPlannedWorkoutStep"},{"$ref":"#/components/schemas/StrengthPlannedWorkoutStep"},{"$ref":"#/components/schemas/YogaPlannedWorkoutStep"},{"$ref":"#/components/schemas/PilatesPlannedWorkoutStep"},{"$ref":"#/components/schemas/RunningPlannedWorkoutStep"},{"$ref":"#/components/schemas/CyclingPlannedWorkoutStep"}],"discriminator":{"propertyName":"type","mapping":{"PlannedWorkoutStep":"#/components/schemas/PlannedWorkoutStep","PlannedWorkoutRepeatStep":"#/components/schemas/PlannedWorkoutRepeatStep","SwimmingPlannedWorkoutStep":"#/components/schemas/SwimmingPlannedWorkoutStep","CardioPlannedWorkoutStep":"#/components/schemas/CardioPlannedWorkoutStep","StrengthPlannedWorkoutStep":"#/components/schemas/StrengthPlannedWorkoutStep","YogaPlannedWorkoutStep":"#/components/schemas/YogaPlannedWorkoutStep","PilatesPlannedWorkoutStep":"#/components/schemas/PilatesPlannedWorkoutStep","RunningPlannedWorkoutStep":"#/components/schemas/RunningPlannedWorkoutStep","CyclingPlannedWorkoutStep":"#/components/schemas/CyclingPlannedWorkoutStep"}}},"PlannedWorkoutStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTargets"}},"type":{"description":"Type of workout step - either repeat or one-off","type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"description":"Planned intensity for the workout step","type":"string","enum":["REST","WARMUP","COOLDOWN","RECOVERY","INTERVAL","ACTIVE"]},"order":{"type":"integer","description":"Position of the workout step in the overall workout"},"description":{"type":"string","description":"Description of workout step"},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDurations"}},"name":{"type":"string","description":"Name of workout step"}}},"PlannedWorkoutStepTargets":{"type":"object","properties":{},"oneOf":[{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/CadencePlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/HRPlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/PowerPlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/SpeedPlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/PacePlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/TSSPlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/IFPlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/RepetitionPlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/SwimStrokePlannedWorkoutStepTarget"}],"discriminator":{"propertyName":"type","mapping":{"PlannedWorkoutStepTarget":"#/components/schemas/PlannedWorkoutStepTarget","CadencePlannedWorkoutStepTarget":"#/components/schemas/CadencePlannedWorkoutStepTarget","HRPlannedWorkoutStepTarget":"#/components/schemas/HRPlannedWorkoutStepTarget","PowerPlannedWorkoutStepTarget":"#/components/schemas/PowerPlannedWorkoutStepTarget","SpeedPlannedWorkoutStepTarget":"#/components/schemas/SpeedPlannedWorkoutStepTarget","PacePlannedWorkoutStepTarget":"#/components/schemas/PacePlannedWorkoutStepTarget","TSSPlannedWorkoutStepTarget":"#/components/schemas/TSSPlannedWorkoutStepTarget","IFPlannedWorkoutStepTarget":"#/components/schemas/IFPlannedWorkoutStepTarget","RepetitionPlannedWorkoutStepTarget":"#/components/schemas/RepetitionPlannedWorkoutStepTarget","SwimStrokePlannedWorkoutStepTarget":"#/components/schemas/SwimStrokePlannedWorkoutStepTarget"}}},"PlannedWorkoutStepTarget":{"type":"object","properties":{"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]}}},"CadencePlannedWorkoutStepTarget":{"type":"object","properties":{"cadence":{"type":"integer","description":"Ideal cadence value to be maintained for the workout step","nullable":true},"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"cadence_low":{"type":"integer","description":"Minimum cadence threshold for the workout step - i.e. the user is to stay above this value during the workout","nullable":true},"cadence_high":{"type":"integer","description":"Maximum cadence threshold for the workout step - i.e. the user is to stay under this value during the workout step","nullable":true}}},"HRPlannedWorkoutStepTarget":{"type":"object","properties":{"hr_percentage_low":{"type":"number","description":"Maximum max heart rate percentage threshold for the workout step - i.e. the user is to stay under this value during the workout step","nullable":true},"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"hr_percentage_high":{"type":"number","description":"Minimum heart rate percentage threshold for the workout step - i.e. the user is to stay above this value during the workout","nullable":true},"hr_percentage":{"type":"number","description":"Ideal percentage of user's maximum HR to be maintained workout step","nullable":true},"hr_bpm_high":{"type":"integer","description":"Maximum heart rate threshold for the workout step - i.e. the user is to stay under this value during the workout step","nullable":true},"hr_bpm_low":{"type":"integer","description":"Minimum heart rate threshold for the workout step - i.e. the user is to stay above this value during the workout","nullable":true}}},"PowerPlannedWorkoutStepTarget":{"type":"object","properties":{"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"power_percentage_low":{"type":"number","description":"Maximum percentage of Functional Threshold Power for the workout step - i.e. the user is to stay under this value during the workout step","nullable":true},"power_percentage_high":{"type":"number","description":"Minimum percentage of Functional Threshold Power for the workout step - i.e. the user is to stay above this value during the workout","nullable":true},"power_watt_high":{"type":"integer","description":"Maximum power threshold for the workout step - i.e. the user is to stay under this value during the workout step","nullable":true},"power_watt_low":{"type":"integer","description":"Minimum power threshold for the workout step - i.e. the user is to stay above this value during the workout","nullable":true},"power_watt":{"type":"integer","default":null,"nullable":true},"power_percentage":{"type":"number","description":"Ideal percentage of user's Functional Threshold Power to be maintained workout step","nullable":true}}},"SpeedPlannedWorkoutStepTarget":{"type":"object","properties":{"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"speed_percentage_high":{"type":"number","description":"Maximum speed threshold for the workout step - i.e. the user is to stay under this value during the workout step","nullable":true},"speed_percentage_low":{"type":"number","description":"Minimum speed threshold for the workout step - i.e. the user is to stay above this value during the workout step","nullable":true},"speed_percentage":{"type":"number","description":"Ideal percentage of user's Threshold Speed, based off their Threshold Pace, to be maintained workout step. Usually, the Threshold Pace is defined as the pace one could race at for 50 to 60 minutes","nullable":true},"speed_meters_per_second":{"type":"number","description":"Ideal speed value to be maintained for the workout step","nullable":true}}},"PacePlannedWorkoutStepTarget":{"type":"object","properties":{"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"pace_minutes_per_kilometer":{"type":"number","description":"Ideal pace value to be maintained for the workout step","nullable":true}}},"TSSPlannedWorkoutStepTarget":{"type":"object","properties":{"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"tss":{"type":"number","description":"Planned Training Stress Score to be achieved for the workout step","nullable":true}}},"IFPlannedWorkoutStepTarget":{"type":"object","properties":{"if_high":{"type":"number","description":"Maximum Intensity Factor to be achieved for the workout step","nullable":true},"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"if_low":{"type":"number","description":"Minimum Intensity Factor to be achieved for the workout step","nullable":true}}},"RepetitionPlannedWorkoutStepTarget":{"type":"object","properties":{"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"repetitions":{"type":"number","description":"Number of repetitions of the workout step to be performed","nullable":true}}},"SwimStrokePlannedWorkoutStepTarget":{"type":"object","properties":{"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"swim_strokes":{"type":"integer","description":"Number of swim strokes to be performed during the workout step","nullable":true}}},"PlannedWorkoutStepDurations":{"type":"object","properties":{},"oneOf":[{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/TimePlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/PowerAbovePlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/PowerBelowPlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/FixedRestPlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/CaloriesPlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/HRAbovePlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/HRBelowPlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/RepsPlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/DistancePlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/StepsPlannedWorkoutStepDuration"}],"discriminator":{"propertyName":"type","mapping":{"PlannedWorkoutStepDuration":"#/components/schemas/PlannedWorkoutStepDuration","TimePlannedWorkoutStepDuration":"#/components/schemas/TimePlannedWorkoutStepDuration","PowerAbovePlannedWorkoutStepDuration":"#/components/schemas/PowerAbovePlannedWorkoutStepDuration","PowerBelowPlannedWorkoutStepDuration":"#/components/schemas/PowerBelowPlannedWorkoutStepDuration","FixedRestPlannedWorkoutStepDuration":"#/components/schemas/FixedRestPlannedWorkoutStepDuration","CaloriesPlannedWorkoutStepDuration":"#/components/schemas/CaloriesPlannedWorkoutStepDuration","HRAbovePlannedWorkoutStepDuration":"#/components/schemas/HRAbovePlannedWorkoutStepDuration","HRBelowPlannedWorkoutStepDuration":"#/components/schemas/HRBelowPlannedWorkoutStepDuration","RepsPlannedWorkoutStepDuration":"#/components/schemas/RepsPlannedWorkoutStepDuration","DistancePlannedWorkoutStepDuration":"#/components/schemas/DistancePlannedWorkoutStepDuration","StepsPlannedWorkoutStepDuration":"#/components/schemas/StepsPlannedWorkoutStepDuration"}}},"PlannedWorkoutStepDuration":{"type":"object","properties":{"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"TimePlannedWorkoutStepDuration":{"type":"object","properties":{"seconds":{"type":"integer","description":"Time duration to be elapsed for the workout step","nullable":true},"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"PowerAbovePlannedWorkoutStepDuration":{"type":"object","properties":{"power_above_watts":{"type":"integer","description":"Threshold power goal to complete the workout step - once the user reaches above this power level, the step will be completed","nullable":true},"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"PowerBelowPlannedWorkoutStepDuration":{"type":"object","properties":{"power_below_watts":{"type":"integer","description":"Threshold power goal to complete the workout step - once the user reaches below this power level, the step will be completed","nullable":true},"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"FixedRestPlannedWorkoutStepDuration":{"type":"object","properties":{"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]},"rest_seconds":{"type":"integer","description":"Time duration to be elapsed for the rest period","nullable":true}}},"CaloriesPlannedWorkoutStepDuration":{"type":"object","properties":{"calories":{"type":"integer","description":"Calorie burn target for the workout step - once the user reaches the target, the step will be completed","nullable":true},"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"HRAbovePlannedWorkoutStepDuration":{"type":"object","properties":{"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]},"hr_above_bpm":{"type":"integer","description":"Threshold heart rate goal to complete the workout step - once the user's heart rate reaches above below this value, the step will be completed","nullable":true}}},"HRBelowPlannedWorkoutStepDuration":{"type":"object","properties":{"hr_below_bpm":{"type":"integer","description":"Threshold heart rate goal to complete the workout step - once the user's heart rate reaches below this value, the step will be completed","nullable":true},"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"RepsPlannedWorkoutStepDuration":{"type":"object","properties":{"reps":{"type":"integer","description":"Target number of reps for the workout step - once the user completes this rep target, the step will be completed","nullable":true},"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"DistancePlannedWorkoutStepDuration":{"type":"object","properties":{"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]},"distance_meters":{"type":"integer","description":"Target distance for the workout step - once the user covers this distance, the step will be completed","nullable":true}}},"StepsPlannedWorkoutStepDuration":{"type":"object","properties":{"steps":{"type":"integer","description":"Target number of steps for the workout step - once the user performs this number of steps, the step will be completed","nullable":true},"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"PlannedWorkoutRepeatStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"steps":{"type":"array","description":"List of steps to be repeated for this workout step - e.g. if a user wants to schedule 5 repetitions of 100m sprints plus 20s rest in between","items":{"$ref":"#/components/schemas/PlannedWorkoutStep"}},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"name":{"type":"string","description":"Name of workout step","nullable":true}}},"SwimmingPlannedWorkoutStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"equipment_type":{"description":"Workout equipment to be used during the workout step","nullable":false,"type":"string","enum":["NONE","SWIM_FINS","SWIM_KICKBOARD","SWIM_PADDLES","SWIM_PULL_BUOY","SWIM_SNORKEL"]},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"name":{"type":"string","description":"Name of workout step","nullable":true},"stroke_type":{"description":"Stroke type used for the workout step (e.g. breaststroke)","nullable":false,"type":"string","enum":["OTHER","FREESTYLE","BACKSTROKE","BREASTSTROKE","BUTTERFLY","REST"]}}},"CardioPlannedWorkoutStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"exercise_name":{"type":"string","description":"Name of exercise to be performed for the workout step","nullable":true},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"exercise_category":{"description":"Type of exercise to be performed for the workout step","nullable":false,"type":"string","enum":["UNKNOWN","BENCH_PRESS","CALF_RAISE","CARDIO","CARRY","CHOP","CORE","CRUNCH","CURL","DEADLIFT","FLYE","HIP_RAISE","HIP_STABILITY","HIP_SWING","HYPEREXTENSION","LATERAL_RAISE","LEG_CURL","LEG_RAISE","LUNGE","OLYMPIC_LIFT","PLANK","PLYO","PULL_UP","PUSH_UP","ROW","SHOULDER_PRESS","SHOULDER_STABILITY","SHRUG","SIT_UP","SQUAT","TOTAL_BODY","TRICEPS_EXTENSION","WARM_UP","RUN","BIKE","CARDIO_SENSORS"]},"name":{"type":"string","description":"Name of workout step","nullable":true}}},"StrengthPlannedWorkoutStep":{"type":"object","properties":{"weight_kg":{"type":"number","description":"Weight to be lifted for the exercise","nullable":true},"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"exercise_name":{"type":"string","description":"Name of strength exercise to be performed for the workout step","nullable":true},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"exercise_category":{"description":"Type of strength exercise to be performed for the workout step","nullable":false,"type":"string","enum":["UNKNOWN","BENCH_PRESS","CALF_RAISE","CARDIO","CARRY","CHOP","CORE","CRUNCH","CURL","DEADLIFT","FLYE","HIP_RAISE","HIP_STABILITY","HIP_SWING","HYPEREXTENSION","LATERAL_RAISE","LEG_CURL","LEG_RAISE","LUNGE","OLYMPIC_LIFT","PLANK","PLYO","PULL_UP","PUSH_UP","ROW","SHOULDER_PRESS","SHOULDER_STABILITY","SHRUG","SIT_UP","SQUAT","TOTAL_BODY","TRICEPS_EXTENSION","WARM_UP","RUN","BIKE","CARDIO_SENSORS"]},"name":{"type":"string","description":"Name of workout step","nullable":true}}},"YogaPlannedWorkoutStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"name":{"type":"string","description":"Name of workout step","nullable":true}}},"PilatesPlannedWorkoutStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"name":{"type":"string","description":"Name of workout step","nullable":true}}},"RunningPlannedWorkoutStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"name":{"type":"string","description":"Name of workout step","nullable":true}}},"CyclingPlannedWorkoutStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"name":{"type":"string","description":"Name of workout step","nullable":true}}},"PlannedWorkoutMetadata":{"type":"object","properties":{"estimated_energy_kj":{"type":["number","null"],"description":"Estimated energy expenditure for the workout"},"estimated_speed_meters_per_second":{"type":["number","null"],"description":"Estimated speed for the workout"},"estimated_elevation_gain_meters":{"type":["number","null"],"description":"Estimated elevation gain for the workout"},"estimated_tss":{"type":["number","null"],"description":"Estimated Training Stress Score for the workout"},"estimated_calories":{"type":["integer","null"],"description":"Estimated calorie burn for the workout"},"created_date":{"type":["string","null"],"description":"The creation datetime of the associated workout, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time","format":"date-time"},"planned_date":{"type":"string","description":"The planned start datetime, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time","format":"date-time","nullable":true},"type":{"description":"The name - either user-entered or given by the fitness data provider - of the associated workout plan","nullable":false,"type":"string","enum":["IN_VEHICLE","BIKING","STILL","UNKNOWN","TILTING","WALKING","RUNNING","AEROBICS","BADMINTON","BASEBALL","BASKETBALL","BIATHLON","HANDBIKING","MOUNTAIN_BIKING","ROAD_BIKING","SPINNING","STATIONARY_BIKING","UTILITY_BIKING","BOXING","CALISTHENICS","CIRCUIT_TRAINING","CRICKET","DANCING","ELLIPTICAL","FENCING","AMERICAN_FOOTBALL","AUSTRALIAN_FOOTBALL","ENGLISH_FOOTBALL","FRISBEE","GARDENING","GOLF","GYMNASTICS","HANDBALL","HIKING","HOCKEY","HORSEBACK_RIDING","HOUSEWORK","JUMPING_ROPE","KAYAKING","KETTLEBELL_TRAINING","KICKBOXING","KITESURFING","MARTIAL_ARTS","MEDITATION","MIXED_MARTIAL_ARTS","P90X_EXERCISES","PARAGLIDING","PILATES","POLO","RACQUETBALL","ROCK_CLIMBING","ROWING","ROWING_MACHINE","RUGBY","JOGGING","RUNNING_ON_SAND","TREADMILL_RUNNING","SAILING","SCUBA_DIVING","SKATEBOARDING","SKATING","CROSS_SKATING","INDOOR_ROLLERBLADING","SKIING","BACK_COUNTRY_SKIING","CROSS_COUNTRY_SKIING","DOWNHILL_SKIING","KITE_SKIING","ROLLER_SKIING","SLEDDING","SNOWBOARDING","SNOWMOBILE","SNOWSHOEING","SQUASH","STAIR_CLIMBING","STAIR_CLIMBING_MACHINE","STAND_UP_PADDLEBOARDING","STRENGTH_TRAINING","SURFING","SWIMMING","SWIMMING_SWIMMING_POOL","SWIMMING_OPEN_WATER","TABLE_TENNIS","TEAM_SPORTS","TENNIS","TREADMILL","VOLLEYBALL","VOLLEYBALL_BEACH","VOLLEYBALL_INDOOR","WAKEBOARDING","WALKING_FITNESS","NORDIC_WALKING","WALKING_TREADMILL","WATERPOLO","WEIGHTLIFTING","WHEELCHAIR","WINDSURFING","YOGA","ZUMBA","DIVING","ERGOMETER","ICE_SKATING","INDOOR_SKATING","CURLING","OTHER","CROSSFIT","HIIT","INTERVAL_TRAINING","WALKING_STROLLER","ELEVATOR","ESCALATOR","ARCHERY","SOFTBALL","GUIDED_BREATHING","CARDIO_TRAINING","LACROSSE","STRETCHING","TRIATHLON","INLINE_SKATING","SKY_DIVING","PADDLING","MOUNTAINEERING","FISHING","WATER_SKIING","INDOOR_RUNNING"]},"id":{"type":["string","null"],"default":null},"estimated_duration_seconds":{"type":["integer","null"],"description":"Estimated workout duration"},"estimated_pace_minutes_per_kilometer":{"type":["number","null"],"description":"Estimated pace for the workout"},"provider":{"type":"string","description":"Name of the original source of the workout plan"},"estimated_tscore":{"type":["number","null"],"description":"Estimated training stress score for the workout (normalized power-based metric)"},"description":{"type":["string","null"],"description":"Description of the workout"},"name":{"type":["string","null"],"description":"Name of the workout plan"},"estimated_distance_meters":{"type":["integer","null"],"description":"Estimated distance for the workout"},"estimated_if":{"type":["number","null"],"description":"Estimated Intensity Factor for the workout"},"pool_length_meters":{"type":["integer","null"],"description":"Pool length of the pool used for the workout - only relevant for swimming activity types"}}},"NoDataReturned":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"message":{"type":"string"},"type":{"type":["string","null"]},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"DataSentToWebhook":{"type":"object","properties":{"reference":{"type":"string","description":"Payload reference, tying the request to the webhook payload which will be received","nullable":true},"message":{"type":"string","nullable":false},"type":{"type":"string","nullable":false},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}}}},"paths":{"/plannedWorkout":{"get":{"summary":"Retrieve workout plans for a given user ID","description":"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)","tags":["PlannedWorkout"],"operationId":"PlannedWorkout_Fetch","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (UUID format) to retrieve data for","schema":{"type":"string"},"required":true},{"name":"start_date","in":"query","description":"Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":true},{"name":"end_date","in":"query","description":"End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit)","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":false},{"name":"to_webhook","in":"query","description":"Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided)\n","schema":{"type":"boolean"},"required":false}],"responses":{"200":{"description":"Returned upon successful data request","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"data":{"type":"array","items":{"$ref":"#/components/schemas/PlannedWorkout"}},"type":{"type":["string","null"]}}},{"$ref":"#/components/schemas/NoDataReturned"},{"$ref":"#/components/schemas/DataSentToWebhook"}]}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"401":{"description":"Returned when credentials (dev ID and API key) are invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"An error message","type":"string"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## ✏️ Writing data

## Post activity data to a provider

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"Activity":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Activity.yaml","type":"object","properties":{"active_durations_data":{"$ref":"#/components/schemas/ActiveDurationsData","description":"Number of minutes spent at various intensities during the workout, as reported by the Fitness Data provider."},"calories_data":{"$ref":"#/components/schemas/CaloriesData","description":"Object containing calorie-related information for the user during the specific workout."},"cheat_detection":{"type":"number","description":"Cheat detection flag."},"data_enrichment":{"$ref":"#/components/schemas/DataEnrichment","description":"Object containing Terra Scores."},"device_data":{"$ref":"#/components/schemas/DeviceData","description":"Object containing information on the device which recorded the specific workout."},"distance_data":{"$ref":"#/components/schemas/DistanceData","description":"Object containing information related to distance covered during the associated workout."},"energy_data":{"$ref":"#/components/schemas/EnergyData","description":"Object containing information on the energy expended by the user during the workout."},"heart_rate_data":{"$ref":"#/components/schemas/HeartRateData","description":"Object containing heartrate-related information for the workout."},"lap_data":{"$ref":"#/components/schemas/LapData","description":"Object containing information on data for each lap performed by the user - mostly relates to track & field running activities, and swimming activities."},"MET_data":{"$ref":"#/components/schemas/METData","description":"Object containing information on the Metabolic Equivalent of Task for the workout."},"metadata":{"$ref":"#/components/schemas/ActivityMetadata","description":"Object containing workout metadata."},"movement_data":{"$ref":"#/components/schemas/MovementData","description":"Object containing information on the user's movement throughout the workout."},"oxygen_data":{"$ref":"#/components/schemas/OxygenData","description":"Object containing information on oxygen-related metrics for the workout."},"polyline_map_data":{"$ref":"#/components/schemas/PolylineMapData","description":"Object containing polyline-representation map data, plotting the user's trajectory throughout the workout."},"position_data":{"$ref":"#/components/schemas/PositionData","description":"Object containing information on the user's position throughout the workout."},"power_data":{"$ref":"#/components/schemas/PowerData","description":"Object containing information on the power generated by the user during the workout."},"strain_data":{"$ref":"#/components/schemas/StrainData","description":"Object containing information on the cardiovascular strain imposed on the user during the workout."},"TSS_data":{"$ref":"#/components/schemas/TSSData","description":"Object containing information on the stress put on the user's body from a workout."},"work_data":{"$ref":"#/components/schemas/WorkData","description":"Object containing information on the work output of the user during the workout."}},"required":["metadata"]},"ActiveDurationsData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActiveDurationsData.yaml","type":"object","properties":{"activity_levels_samples":{"type":"array","items":{"$ref":"#/components/schemas/ActivityLevelSample"},"description":"Array of detailed samples of the intensity the user was in at various points during the workout."},"activity_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in an active state during the workout."},"inactivity_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in an inactive state during the workout."},"low_intensity_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in a low intensity state during the workout."},"moderate_intensity_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in a moderate intensity state during the workout."},"num_continuous_inactive_periods":{"type":"integer","minimum":0,"description":"Maximum number of continuous periods spent in an inactive state during the workout."},"rest_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent resting during the workout."},"vigorous_intensity_seconds":{"type":"number","minimum":0,"description":"Total number of seconds spent in a state of vigorous intensity during the workout."},"standing_hours_count":{"type":"number"},"standing_seconds":{"type":"number"}}},"ActivityLevelSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityLevelSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"level":{"$ref":"#/components/schemas/ActivityLevel"}}},"ActivityLevel":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityLevel.yaml","oneOf":[{"type":"number","const":0,"description":"Activity level is unknown or could not be determined.","title":"Unknown"},{"type":"number","const":1,"description":"User is at rest, with minimal to no physical activity.","title":"Rest"},{"type":"number","const":2,"description":"User is awake but inactive or sedentary.","title":"Inactive"},{"type":"number","const":3,"description":"User is engaged in light physical activity such as casual walking.","title":"Low Intensity"},{"type":"number","const":4,"description":"User is engaged in moderate physical activity such as brisk walking or light exercise.","title":"Medium Intensity"},{"type":"number","const":5,"description":"User is engaged in vigorous physical activity such as running or intense exercise.","title":"High Intensity"}],"description":"Intensity of the user's activity at an instant in time"},"CaloriesData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CaloriesData.yaml","type":"object","properties":{"BMR_calories":{"type":"number","description":"Basal Metabolic Rate calories - calories burned at rest."},"calorie_samples":{"type":"array","items":{"$ref":"#/components/schemas/CalorieSample"},"description":"Array of calorie data samples recorded throughout the time period."},"net_activity_calories":{"type":"number","description":"Net calories burned through activity (excluding BMR)."},"net_intake_calories":{"type":"number","description":"Net calories consumed through food and drink intake."},"total_burned_calories":{"type":"number","description":"Total calories burned including BMR and activity."}}},"CalorieSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CalorieSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"calories":{"type":"number","description":"Number of calories burned at the given timestamp."},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"DataEnrichment":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DataEnrichment.yaml","type":"object","properties":{"stress_score":{"type":"integer","description":"User's stress score."}}},"DeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceData.yaml","type":"object","properties":{"activation_timestamp":{"type":"string","description":"Activation timestamp of the device, if applicable."},"data_provided":{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"},"description":"Data provided by the device, as enumerated types."},"hardware_version":{"type":"string","description":"Hardware version of the device."},"last_upload_date":{"type":"string","description":"Last upload date from the device."},"manufacturer":{"type":"string","description":"Device manufacturer name."},"name":{"type":"string","description":"Device name - note that this can also be the name of the application/package which the data comes from, if coming from a data aggregator such as Google Fit."},"other_devices":{"type":"array","items":{"$ref":"#/components/schemas/OtherDeviceData"},"description":"Data pertaining to other devices which may have contributed data for this workout."},"sensor_state":{"type":"string","description":"Sensor state of the device."},"serial_number":{"type":"string","description":"Device Serial Number."},"software_version":{"type":"string","description":"Device Software Version."}}},"DeviceDataType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceDataType.yaml","oneOf":[{"type":"string","const":"STEPS","description":"Count of steps taken by the user.","title":"Steps"},{"type":"string","const":"ACTIVE_MINUTES","description":"Duration of time the user spent in physical activity.","title":"Active Minutes"},{"type":"string","const":"BMR","description":"User's basal metabolic rate - calories burned at rest.","title":"Basal Metabolic Rate"},{"type":"string","const":"CALORIES","description":"Calories burned by the user during activity.","title":"Calories"},{"type":"string","const":"DISTANCE","description":"Distance traveled by the user during activity.","title":"Distance"},{"type":"string","const":"HEART_RATE","description":"User's heart rate measurements.","title":"Heart Rate"},{"type":"string","const":"OXYGEN_SATURATION","description":"Blood oxygen saturation level (SpO2) of the user.","title":"Oxygen Saturation"},{"type":"string","const":"SLEEP_TYPE","description":"Classification of user's sleep stages or types.","title":"Sleep Classification"},{"type":"string","const":"SPEED","description":"User's movement speed during activity.","title":"Speed"},{"type":"string","const":"CADENCE","description":"Rate of movement repetition during activity (steps per minute).","title":"Cadence"}],"description":"Represents data types that a certain device contributed to."},"OtherDeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OtherDeviceData.yaml","type":"object","properties":{"manufacturer":{"type":"string","description":"Device manufacturer name."},"hardware_version":{"type":"string","description":"Hardware version of the device."},"serial_number":{"type":"string","description":"Device Serial Number."},"name":{"type":"string","description":"Device name - note that this can also be the name of the application/package which the data comes from, if coming from a data aggregator such as Google Fit."},"software_version":{"type":"string","description":"Device Software Version."},"activation_timestamp":{"type":"string","description":"Activation timestamp of the device, if applicable."},"data_provided":{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"},"description":"Data provided by the device, as enumerated types."},"last_upload_date":{"type":"string","description":"Last upload date from the device."}}},"DistanceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceData.yaml","type":"object","properties":{"detailed":{"$ref":"#/components/schemas/DistanceDataDetailed","description":"Object containing detailed distance information - this may included second-by-second samples."},"summary":{"$ref":"#/components/schemas/DistanceDataSummary","description":"Object containing summary information related to distance covered throughout the workout."}}},"DistanceDataDetailed":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceDataDetailed.yaml","type":"object","properties":{"distance_samples":{"type":"array","items":{"$ref":"#/components/schemas/DistanceSample"},"description":"Array of detailed samples of distance covered throughout the workout."},"elevation_samples":{"type":"array","items":{"$ref":"#/components/schemas/ElevationSample"},"description":"Array of detailed samples of elevation throughout the workout."},"floors_climbed_samples":{"type":"array","items":{"$ref":"#/components/schemas/FloorsClimbedSample"},"description":"Array of detailed samples of floors climbed throughout the workout, as determined by the fitness data provider."},"step_samples":{"type":"array","items":{"$ref":"#/components/schemas/StepSample"},"description":"Array of detailed samples of steps performed throughout the workout."}}},"DistanceSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"distance_meters":{"type":"number","description":"Cumulative distance covered up to associated timestamp, since the start of the payload"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"ElevationSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ElevationSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"elev_meters":{"type":"number","description":"User's altitude at a given point in time, in meters above sea level."},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"FloorsClimbedSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/FloorsClimbedSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"floors_climbed":{"type":"integer","description":"Cumulative number of elevation gain measured in floors climbed up to associated timestamp, since the start of the payload"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"StepSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StepSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"steps":{"type":"integer","description":"Cumulative number of steps taken up to associated timestamp, since the start of the payload"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"DistanceDataSummary":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceDataSummary.yaml","type":"object","properties":{"distance_meters":{"type":"integer","description":"Total distance covered by the user throughout the workout."},"elevation":{"$ref":"#/components/schemas/ElevationData","description":"Object containing information on the elevation of the user throughout the workout."},"floors_climbed":{"type":"integer","description":"Total number of elevation gain in floors climbed equivalent throughout the workout, as determined by the fitness data provider."},"steps":{"type":"integer","description":"Total number of steps performed during the workout."},"swimming":{"$ref":"#/components/schemas/SwimmingData","description":"Summary information of the user's swimming statistics for the workout, if applicable."}}},"ElevationData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ElevationData.yaml","type":"object","properties":{"avg_meters":{"type":"number","description":"Average elevation of the user throughout the workout."},"gain_actual_meters":{"type":"number","minimum":0,"description":"Actual elevation gain of the user throughout the workout - this includes all elevation gain, and does _not_ represent net gain."},"gain_planned_meters":{"type":"number","minimum":0,"description":"Planned elevation gain for the workout."},"loss_actual_meters":{"type":"number","minimum":0,"description":"Elevation loss of the user throughout the workout."},"max_meters":{"type":"number","description":"Maximum elevation of the user during the workout."},"min_meters":{"type":"number","description":"Minimum elevation of the user during the workout."}}},"SwimmingData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SwimmingData.yaml","type":"object","properties":{"num_laps":{"type":"integer","minimum":0,"description":"Total number of swimming laps performed during the day."},"num_strokes":{"type":"integer","minimum":0,"description":"Total number of swimming strokes performed during the day."},"pool_length_meters":{"type":"integer","minimum":0,"description":"Pool length for associated with the day."}}},"EnergyData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/EnergyData.yaml","type":"object","properties":{"energy_kilojoules":{"type":"number","description":"Total number of kiloJoules expended during the workout"},"energy_planned_kilojoules":{"type":"number","description":"Total number of kiloJoules planned to be expended during the workout - represents the user's predefined goal for the workout"}}},"HeartRateData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateData.yaml","type":"object","properties":{"detailed":{"$ref":"#/components/schemas/HeartRateDataDetailed","description":"Object containing detailed heart rate information for the associated workout."},"summary":{"$ref":"#/components/schemas/HeartRateDataSummary","description":"Object containing summary heart rate information for the associated workout."}}},"HeartRateDataDetailed":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataDetailed.yaml","type":"object","properties":{"hr_samples":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateDataSample"},"description":"Array of HeartRate data samples recorded for the user during the workout."},"hrv_samples_rmssd":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleRMSSD"},"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using RMSSD."},"hrv_samples_sdnn":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleSDNN"},"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using SDNN."}}},"HeartRateDataSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"bpm":{"type":"number","description":"User's heart rate in bpm"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"},"context":{"$ref":"#/components/schemas/HeartRateContext","description":"Represents the context in which heart rate was measured."}}},"HeartRateContext":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateContext.yaml","oneOf":[{"type":"number","const":0,"description":"Heart rate measurement context is not specified.","title":"Not Set"},{"type":"number","const":1,"description":"Heart rate was measured during physical activity or exercise.","title":"Active"},{"type":"number","const":2,"description":"Heart rate was measured during rest or non-active periods.","title":"Not Active"}],"description":"Represents the context in which heart rate was measured."},"HeartRateVariabilityDataSampleRMSSD":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleRMSSD.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hrv_rmssd":{"type":"number","description":"User's Heart Rate Variability, computed using RMSSD"}}},"HeartRateVariabilityDataSampleSDNN":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleSDNN.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hrv_sdnn":{"type":"number","description":"User's Heart Rate Variability, computed using SDNN"}}},"HeartRateDataSummary":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSummary.yaml","type":"object","properties":{"avg_hr_bpm":{"type":"number","minimum":0,"description":"Average HeartRate of the user during the workout."},"avg_hrv_rmssd":{"type":"number","description":"Average HeartRate Variability of the user during the workout, computed using RMSSD."},"avg_hrv_sdnn":{"type":"number","description":"Average HeartRate Variability of the user during the workout, computed using SDNN."},"hr_zone_data":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateZoneData"},"description":"Array of time spent in various HR zones throughout the workout."},"max_hr_bpm":{"type":"number","minimum":0,"description":"Maximum HeartRate of the user during the workout."},"min_hr_bpm":{"type":"number","minimum":0,"description":"Minimum HeartRate of the user during the workout."},"resting_hr_bpm":{"type":"number","minimum":0,"description":"Resting HeartRate of the user, as determined by the fitness data provider."},"user_max_hr_bpm":{"type":"number","description":"User's maximum HeartRate based on their age, and other factors as determined by the fitness data provider."}}},"HeartRateZoneData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZoneData.yaml","type":"object","properties":{"zone":{"$ref":"#/components/schemas/HeartRateZone","description":"Heart rate zone designation"},"start_percentage":{"type":"number","minimum":0,"maximum":100,"description":"Start percentage (based off user's max HR) of the HR zone"},"end_percentage":{"type":"number","minimum":0,"maximum":100,"description":"End percentage (based off user's max HR) of the HR zone"},"name":{"type":"string","description":"Name of the associated heart rate zone"},"duration_seconds":{"type":"number","description":"Duration spent in the heart rate zone"}}},"HeartRateZone":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZone.yaml","oneOf":[{"type":"number","const":0,"description":"Resting heart rate zone.","title":"Zone 0"},{"type":"number","const":1,"description":"Very light activity zone.","title":"Zone 1"},{"type":"number","const":2,"description":"Light activity zone.","title":"Zone 2"},{"type":"number","const":3,"description":"Moderate activity zone.","title":"Zone 3"},{"type":"number","const":4,"description":"Hard activity zone.","title":"Zone 4"},{"type":"number","const":5,"description":"Maximum effort zone.","title":"Zone 5"},{"type":"number","const":6,"description":"Heart rate zone that doesn't fit into the standard zones or couldn't be classified.","title":"Other"}],"description":"Represents the heart rate zone the user is currently in during a workout or activity"},"LapData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LapData.yaml","type":"object","properties":{"laps":{"type":"array","items":{"$ref":"#/components/schemas/LapSample"},"description":"Array of datapoints for each lap performed by the user during the workout."}}},"LapSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LapSample.yaml","type":"object","properties":{"calories":{"type":"number","description":"Calories burned during the lap"},"avg_hr_bpm":{"type":"number","description":"Average heart rate in bpm, for the Lap sample"},"start_time":{"type":"string","description":"The start time of the associated lap, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time"},"avg_speed_meters_per_second":{"type":"number","description":"Average speed of the user during the lap"},"distance_meters":{"type":"number","description":"Distance covered during the lap"},"total_strokes":{"type":"integer","description":"Total strokes performed during the lap - only relevant for swimming activities"},"end_time":{"type":"string","description":"The end time of the associated lap, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time"},"stroke_type":{"$ref":"#/components/schemas/StrokeType","description":"Stroke type - only relevant for swimming activities"}}},"StrokeType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StrokeType.yaml","oneOf":[{"type":"string","const":"other","description":"Any swimming stroke style that doesn't fit the standard categories.","title":"Other"},{"type":"string","const":"freestyle","description":"Front crawl stroke where swimmers alternate arm movements with face in water.","title":"Freestyle"},{"type":"string","const":"backstroke","description":"Swimming stroke performed on the back with alternating arm movements.","title":"Backstroke"},{"type":"string","const":"breaststroke","description":"Swimming stroke where arms move simultaneously in a heart-shaped pattern with a frog kick.","title":"Breaststroke"},{"type":"string","const":"butterfly","description":"Swimming stroke with simultaneous overhead arm movements and dolphin kick.","title":"Butterfly"}],"description":"Stroke type used for the workout step (e.g. breaststroke)"},"METData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/METData.yaml","type":"object","properties":{"MET_samples":{"type":"array","items":{"$ref":"#/components/schemas/METSample"},"description":"An array of Metabolic Equivalent Time samples, as calculated by the user's wearable."},"avg_level":{"type":"number","description":"The average MET level of the activity."},"num_high_intensity_minutes":{"type":"number","minimum":0,"description":"Number of minutes spent in High Intensity during the workout - based off MET scale."},"num_inactive_minutes":{"type":"number","minimum":0,"description":"Number of minutes spent in state of Inactivity during the workout - based off MET scale."},"num_low_intensity_minutes":{"type":"number","minimum":0,"description":"Number of minutes spent in Low Intensity during the workout - based off MET scale."},"num_moderate_intensity_minutes":{"type":"number","minimum":0,"description":"Number of minutes spent in Moderate Intensity during the workout - based off MET scale."}}},"METSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/METSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"level":{"type":"number","description":"Metabolic Equivalent of Task (MET) level at the given timestamp"}}},"ActivityMetadata":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityMetadata.yaml","type":"object","properties":{"city":{"type":"string","description":"The City in which the workout was performed."},"country":{"type":"string","description":"The Country in which the workout was performed."},"end_time":{"type":"string","description":"The end time of the associated workout, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"name":{"type":"string","description":"The name - either user-entered or given by the fitness data provider - of the associated workout."},"start_time":{"type":"string","description":"The start time of the associated workout, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"state":{"type":"string","description":"The State in which the workout was performed."},"summary_id":{"type":"string","description":"A unique identifier for the workout - note that this is unique for the given user, and may not be globally unique."},"timestamp_localization":{"$ref":"#/components/schemas/TimestampLocalization"},"type":{"$ref":"#/components/schemas/ActivityType","description":"The type of activity performed for the associated workout."},"upload_type":{"$ref":"#/components/schemas/UploadType","description":"The upload type for the associated workout, providing information on whether this was an automatic workout or user-entered."}},"required":["end_time","start_time","summary_id","type","upload_type"]},"TimestampLocalization":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml","type":"number","enum":[0,1],"description":"Indicates whether the timestamps in this payload are localized (LOCAL) or in UTC."},"ActivityType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityType.yaml","oneOf":[{"type":"number","const":0,"description":"Activity type for when the user is in a vehicle, such as a car or bus.","title":"In Vehicle"},{"type":"number","const":1,"description":"Activity type for general biking or cycling.","title":"Biking"},{"type":"number","const":3,"description":"Activity type for when the user is still or not moving.","title":"Still"},{"type":"number","const":4,"description":"Activity type is unknown or could not be determined.","title":"Unknown"},{"type":"number","const":5,"description":"Activity type for when the device detects a tilting motion.","title":"Tilting"},{"type":"number","const":7,"description":"Activity type for general walking.","title":"Walking"},{"type":"number","const":8,"description":"Activity type for general running.","title":"Running"},{"type":"number","const":9,"description":"Activity type for aerobic exercises and workouts.","title":"Aerobics"},{"type":"number","const":10,"description":"Activity type for playing badminton.","title":"Badminton"},{"type":"number","const":11,"description":"Activity type for playing baseball.","title":"Baseball"},{"type":"number","const":12,"description":"Activity type for playing basketball.","title":"Basketball"},{"type":"number","const":13,"description":"Activity type for biathlon, combining cross-country skiing and rifle shooting.","title":"Biathlon"},{"type":"number","const":14,"description":"Activity type for hand biking, using a hand-powered bicycle.","title":"Hand Biking"},{"type":"number","const":15,"description":"Activity type for off-road cycling on rough terrain.","title":"Mountain Biking"},{"type":"number","const":16,"description":"Activity type for cycling on paved roads.","title":"Road Biking"},{"type":"number","const":17,"description":"Activity type for indoor cycling classes or spinning.","title":"Spinning"},{"type":"number","const":18,"description":"Activity type for exercising on a stationary bicycle.","title":"Stationary Biking"},{"type":"number","const":19,"description":"Activity type for cycling for transportation or utility purposes.","title":"Utility Biking"},{"type":"number","const":20,"description":"Activity type for boxing training or matches.","title":"Boxing"},{"type":"number","const":21,"description":"Activity type for bodyweight exercises focusing on rhythm and flow.","title":"Calisthenics"},{"type":"number","const":22,"description":"Activity type for workout consisting of a series of exercises performed in rotation.","title":"Circuit Training"},{"type":"number","const":23,"description":"Activity type for playing cricket.","title":"Cricket"},{"type":"number","const":24,"description":"Activity type for various forms of dance.","title":"Dancing"},{"type":"number","const":25,"description":"Activity type for exercising on an elliptical trainer.","title":"Elliptical"},{"type":"number","const":26,"description":"Activity type for fencing sport.","title":"Fencing"},{"type":"number","const":27,"description":"Activity type for playing American football.","title":"American Football"},{"type":"number","const":28,"description":"Activity type for playing Australian rules football.","title":"Australian Football"},{"type":"number","const":29,"description":"Activity type for playing soccer/football.","title":"English Football"},{"type":"number","const":30,"description":"Activity type for playing frisbee or disc sports.","title":"Frisbee"},{"type":"number","const":31,"description":"Activity type for gardening and yard work.","title":"Gardening"},{"type":"number","const":32,"description":"Activity type for playing golf.","title":"Golf"},{"type":"number","const":33,"description":"Activity type for performing gymnastics.","title":"Gymnastics"},{"type":"number","const":34,"description":"Activity type for playing handball.","title":"Handball"},{"type":"number","const":35,"description":"Activity type for hiking or walking on trails.","title":"Hiking"},{"type":"number","const":36,"description":"Activity type for playing hockey.","title":"Hockey"},{"type":"number","const":37,"description":"Activity type for horseback riding.","title":"Horseback Riding"},{"type":"number","const":38,"description":"Activity type for household chores and cleaning.","title":"Housework"},{"type":"number","const":39,"description":"Activity type for skipping or jumping rope.","title":"Jumping Rope"},{"type":"number","const":40,"description":"Activity type for kayaking on water.","title":"Kayaking"},{"type":"number","const":41,"description":"Activity type for exercises using kettlebells.","title":"Kettlebell Training"},{"type":"number","const":42,"description":"Activity type for kickboxing training or matches.","title":"Kickboxing"},{"type":"number","const":43,"description":"Activity type for kitesurfing or kiteboarding.","title":"Kitesurfing"},{"type":"number","const":44,"description":"Activity type for general martial arts training.","title":"Martial Arts"},{"type":"number","const":45,"description":"Activity type for meditation practice.","title":"Meditation"},{"type":"number","const":46,"description":"Activity type for MMA training or fighting.","title":"Mixed Martial Arts"},{"type":"number","const":47,"description":"Activity type for P90X home fitness program.","title":"P90X Exercises"},{"type":"number","const":48,"description":"Activity type for paragliding sport.","title":"Paragliding"},{"type":"number","const":49,"description":"Activity type for pilates exercises.","title":"Pilates"},{"type":"number","const":50,"description":"Activity type for playing polo.","title":"Polo"},{"type":"number","const":51,"description":"Activity type for playing racquetball.","title":"Racquetball"},{"type":"number","const":52,"description":"Activity type for rock climbing.","title":"Rock Climbing"},{"type":"number","const":53,"description":"Activity type for rowing on water.","title":"Rowing"},{"type":"number","const":54,"description":"Activity type for exercising on a rowing machine.","title":"Rowing Machine"},{"type":"number","const":55,"description":"Activity type for playing rugby.","title":"Rugby"},{"type":"number","const":56,"description":"Activity type for jogging at a leisurely pace.","title":"Jogging"},{"type":"number","const":57,"description":"Activity type for running on beach or sandy surface.","title":"Running on Sand"},{"type":"number","const":58,"description":"Activity type for running on a treadmill.","title":"Treadmill Running"},{"type":"number","const":59,"description":"Activity type for sailing on water.","title":"Sailing"},{"type":"number","const":60,"description":"Activity type for scuba diving underwater.","title":"Scuba Diving"},{"type":"number","const":61,"description":"Activity type for skateboarding.","title":"Skateboarding"},{"type":"number","const":62,"description":"Activity type for general skating.","title":"Skating"},{"type":"number","const":63,"description":"Activity type for cross skating or nordic skating.","title":"Cross Skating"},{"type":"number","const":64,"description":"Activity type for rollerblading indoors.","title":"Indoor Rollerblading"},{"type":"number","const":65,"description":"Activity type for general skiing.","title":"Skiing"},{"type":"number","const":66,"description":"Activity type for backcountry or off-piste skiing.","title":"Back Country Skiing"},{"type":"number","const":67,"description":"Activity type for cross-country skiing.","title":"Cross Country Skiing"},{"type":"number","const":68,"description":"Activity type for alpine or downhill skiing.","title":"Downhill Skiing"},{"type":"number","const":69,"description":"Activity type for skiing with a kite for propulsion.","title":"Kite Skiing"},{"type":"number","const":70,"description":"Activity type for roller skiing on wheels.","title":"Roller Skiing"},{"type":"number","const":71,"description":"Activity type for sledding or tobogganing.","title":"Sledding"},{"type":"number","const":73,"description":"Activity type for snowboarding.","title":"Snowboarding"},{"type":"number","const":74,"description":"Activity type for riding a snowmobile.","title":"Snowmobile"},{"type":"number","const":75,"description":"Activity type for walking with snowshoes.","title":"Snowshoeing"},{"type":"number","const":76,"description":"Activity type for playing squash.","title":"Squash"},{"type":"number","const":77,"description":"Activity type for climbing stairs.","title":"Stair Climbing"},{"type":"number","const":78,"description":"Activity type for exercising on a stair climbing machine.","title":"Stair Climbing Machine"},{"type":"number","const":79,"description":"Activity type for stand-up paddleboarding.","title":"Stand Up Paddleboarding"},{"type":"number","const":80,"description":"Activity type for resistance training or weight lifting.","title":"Strength Training"},{"type":"number","const":81,"description":"Activity type for surfing on waves.","title":"Surfing"},{"type":"number","const":82,"description":"Activity type for general swimming.","title":"Swimming"},{"type":"number","const":83,"description":"Activity type for swimming in a swimming pool.","title":"Swimming in Pool"},{"type":"number","const":84,"description":"Activity type for swimming in open water like oceans, lakes or rivers.","title":"Open Water Swimming"},{"type":"number","const":85,"description":"Activity type for playing table tennis or ping pong.","title":"Table Tennis"},{"type":"number","const":86,"description":"Activity type for general team sports not otherwise classified.","title":"Team Sports"},{"type":"number","const":87,"description":"Activity type for playing tennis.","title":"Tennis"},{"type":"number","const":88,"description":"Activity type for exercising on a treadmill.","title":"Treadmill"},{"type":"number","const":89,"description":"Activity type for general volleyball.","title":"Volleyball"},{"type":"number","const":90,"description":"Activity type for playing volleyball on a beach.","title":"Beach Volleyball"},{"type":"number","const":91,"description":"Activity type for playing volleyball indoors.","title":"Indoor Volleyball"},{"type":"number","const":92,"description":"Activity type for wakeboarding on water.","title":"Wakeboarding"},{"type":"number","const":93,"description":"Activity type for walking specifically for exercise.","title":"Walking for Fitness"},{"type":"number","const":94,"description":"Activity type for walking with poles.","title":"Nordic Walking"},{"type":"number","const":95,"description":"Activity type for walking on a treadmill.","title":"Treadmill Walking"},{"type":"number","const":96,"description":"Activity type for playing water polo.","title":"Water Polo"},{"type":"number","const":97,"description":"Activity type for weightlifting exercises.","title":"Weightlifting"},{"type":"number","const":98,"description":"Activity type for wheelchair-based movement.","title":"Wheelchair"},{"type":"number","const":99,"description":"Activity type for windsurfing on water.","title":"Windsurfing"},{"type":"number","const":100,"description":"Activity type for practicing yoga.","title":"Yoga"},{"type":"number","const":101,"description":"Activity type for Zumba dance fitness.","title":"Zumba"},{"type":"number","const":102,"description":"Activity type for diving or jumping into water.","title":"Diving"},{"type":"number","const":103,"description":"Activity type for exercising on an ergometer.","title":"Ergometer"},{"type":"number","const":104,"description":"Activity type for skating on ice.","title":"Ice Skating"},{"type":"number","const":105,"description":"Activity type for skating indoors.","title":"Indoor Skating"},{"type":"number","const":106,"description":"Activity type for playing curling on ice.","title":"Curling"},{"type":"number","const":108,"description":"Activity type for activities that don't fit into other categories.","title":"Other"},{"type":"number","const":113,"description":"Activity type for CrossFit training.","title":"CrossFit"},{"type":"number","const":114,"description":"Activity type for high-intensity interval training.","title":"HIIT"},{"type":"number","const":115,"description":"Activity type for general interval training workouts.","title":"Interval Training"},{"type":"number","const":116,"description":"Activity type for walking while pushing a stroller.","title":"Walking with Stroller"},{"type":"number","const":117,"description":"Activity type for riding in an elevator.","title":"Elevator"},{"type":"number","const":118,"description":"Activity type for riding on an escalator.","title":"Escalator"},{"type":"number","const":119,"description":"Activity type for practicing archery.","title":"Archery"},{"type":"number","const":120,"description":"Activity type for playing softball.","title":"Softball"},{"type":"number","const":122,"description":"Activity type for practicing guided breathing exercises.","title":"Guided Breathing"},{"type":"number","const":123,"description":"Activity type for general cardiovascular exercise.","title":"Cardio Training"},{"type":"number","const":124,"description":"Activity type for playing lacrosse.","title":"Lacrosse"},{"type":"number","const":125,"description":"Activity type for stretching exercises.","title":"Stretching"},{"type":"number","const":126,"description":"Activity type for triathlon events combining swimming, cycling and running.","title":"Triathlon"},{"type":"number","const":127,"description":"Activity type for inline skating or rollerblading.","title":"Inline Skating"},{"type":"number","const":128,"description":"Activity type for sky diving or parachuting.","title":"Sky Diving"},{"type":"number","const":129,"description":"Activity type for general paddling activities.","title":"Paddling"},{"type":"number","const":130,"description":"Activity type for mountaineering or alpine climbing.","title":"Mountaineering"},{"type":"number","const":131,"description":"Activity type for fishing activities.","title":"Fishing"},{"type":"number","const":132,"description":"Activity type for water skiing.","title":"Water Skiing"},{"type":"number","const":133,"description":"Activity type for running indoors.","title":"Indoor Running"},{"type":"number","const":134,"description":"Activity type for playing padel tennis.","title":"Padel Tennis"},{"type":"number","const":135,"description":"Activity type for driving a vehicle.","title":"Driving"},{"type":"number","const":136,"description":"Activity type for driving off-road or on unpaved surfaces.","title":"Off-Road Driving"},{"type":"number","const":137,"description":"Activity type for riding a motorcycle.","title":"Motorbiking"},{"type":"number","const":138,"description":"Activity type for motorsport racing.","title":"Motor Racing"},{"type":"number","const":139,"description":"Activity type for enduro motorcycle racing.","title":"Enduro"},{"type":"number","const":140,"description":"Activity type for canoeing on water.","title":"Canoeing"},{"type":"number","const":141,"description":"Activity type for orienteering navigation sport.","title":"Orienteering"},{"type":"number","const":142,"description":"Activity type for hang gliding.","title":"Hang Gliding"},{"type":"number","const":143,"description":"Activity type for piloting an aircraft.","title":"Flying"},{"type":"number","const":144,"description":"Activity type for hot air balloon flying.","title":"Hot Air Ballooning"},{"type":"number","const":145,"description":"Activity type for riding a jet ski on water.","title":"Jet Skiing"},{"type":"number","const":146,"description":"Activity type for operating a motorized boat.","title":"Power Boating"},{"type":"number","const":147,"description":"Activity type for playing Gaelic football.","title":"Gaelic Football"},{"type":"number","const":148,"description":"Activity type for playing hurling.","title":"Hurling"}],"description":"The type of activity performed for the associated workout."},"UploadType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/UploadType.yaml","oneOf":[{"type":"number","const":0,"description":"The upload type is unknown or could not be determined.","title":"Unknown"},{"type":"number","const":1,"description":"The workout was automatically detected and recorded by a device or service.","title":"Automatic"},{"type":"number","const":2,"description":"The workout was manually entered by the user.","title":"Manual"},{"type":"number","const":3,"description":"The workout data represents an update to a previously recorded workout.","title":"Update"},{"type":"number","const":4,"description":"The workout was marked for deletion.","title":"Delete"},{"type":"number","const":5,"description":"The workout upload is pending processing or confirmation.","title":"Pending"},{"type":"number","const":6,"description":"The workout was uploaded or synced from a third-party service or application.","title":"Third party upload"}],"description":"The type of upload for the associated workout, providing information on how the workout data was recorded or entered"},"MovementData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MovementData.yaml","type":"object","properties":{"adjusted_max_speed_meters_per_second":{"type":"number","description":"Adjusted max speed of the user during the workout - generated using Terra's algorithms to remove potential affecting the user's actual max speed measurement."},"avg_cadence_rpm":{"type":"number","description":"Average cadence of the user during the workout, in RPM."},"avg_pace_minutes_per_kilometer":{"type":"number","description":"Average pace of the user during the workout."},"avg_speed_meters_per_second":{"type":"number","description":"Average speed of the user during the workout."},"avg_torque_newton_meters":{"type":"number","description":"Average torque generated by the user during the workout - mainly relevant for cycling activities."},"avg_velocity_meters_per_second":{"type":"number","description":"Average velocity of the user during the workout - only calculated by certain providers, representing a separate quantity from speed."},"cadence_samples":{"type":"array","items":{"$ref":"#/components/schemas/CadenceSample"},"description":"Array of cadence values recorded throughout the workout, sampled at intervals determined by the fitness data provider."},"max_cadence_rpm":{"type":"number","description":"Maximum cadence of the user during the workout - mainly relevant for cycling activities."},"max_pace_minutes_per_kilometer":{"type":"number","description":"Maximum pace of the user during the workout."},"max_speed_meters_per_second":{"type":"number","description":"Maximum speed of the user during the workout."},"max_torque_newton_meters":{"type":"number","description":"Maximum torque generated by the user during the workout - mainly relevant for cycling activities."},"max_velocity_meters_per_second":{"type":"number","description":"Maximum velocity of the user during the workout - only calculated by certain providers, representing a separate quantity from speed."},"normalized_speed_meters_per_second":{"type":"number","description":"Average normalized speed of the user during the workout - only calculated by certain providers, representing a separate quantity from speed."},"speed_samples":{"type":"array","items":{"$ref":"#/components/schemas/SpeedSample"},"description":"Array of the datapoints for the user's speed sampled throughout the workout."},"torque_samples":{"type":"array","items":{"$ref":"#/components/schemas/TorqueSample"},"description":"Array of the datapoints for the user's torque sampled throughout the workout."}}},"CadenceSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CadenceSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"cadence_rpm":{"type":"number","description":"User's cadence at a given instant in time, in revolutions per minute"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"SpeedSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SpeedSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"speed_meters_per_second":{"type":"number","description":"Speed of the user at a given instant in time, in meters per second"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"TorqueSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TorqueSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"},"torque_newton_meters":{"type":"number","description":"Torque generated at a given instant in time, in Newton-meters"}}},"OxygenData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenData.yaml","type":"object","properties":{"avg_saturation_percentage":{"type":"number","description":"Average Oxygen Saturation percentage of the user during the day (SpO2 or SmO2)."},"saturation_samples":{"type":"array","items":{"$ref":"#/components/schemas/OxygenSaturationSample"},"description":"Array of Oxygen Saturation percentage datapoints sampled throughout the day."},"vo2_samples":{"type":"array","items":{"$ref":"#/components/schemas/Vo2MaxSample"},"description":"Array of VO2 datapoints sampled throughout the day."},"vo2max_ml_per_min_per_kg":{"type":"number","description":"VO2Max for the given user."}}},"OxygenSaturationSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"percentage":{"type":"number","description":"User's oxygen saturation percentage - referring to either SpO2 or SmO2, based on the `type` field"},"type":{"$ref":"#/components/schemas/OxygenSaturationType","description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"}}},"OxygenSaturationType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationType.yaml","oneOf":[{"type":"number","const":0,"description":"Oxygen saturation measurement for blood.","title":"Blood"},{"type":"number","const":1,"description":"Oxygen saturation measurement for muscle.","title":"Muscle"}],"description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"},"Vo2MaxSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Vo2MaxSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"vo2max_ml_per_min_per_kg":{"type":"number","description":"User's VO2Max - maximum amount of oxygen the user's body can utilize during exercise"}}},"PolylineMapData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PolylineMapData.yaml","type":"object","properties":{"summary_polyline":{"type":"string","description":"The polyline representation of the user's trajectory throughout the workout"}}},"PositionData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PositionData.yaml","type":"object","properties":{"center_pos_lat_lng_deg":{"type":"array","items":{"type":"number"},"description":"Position of the user at the midway point of the workout, represented by a 2-value array of latitude, longitude, wherein each of the two numbers can be nullable."},"end_pos_lat_lng_deg":{"type":"array","items":{"type":"number"},"description":"Position of the user at the end of the workout, represented by a 2-value array of latitude, longitude, wherein each of the two numbers can be nullable."},"position_samples":{"type":"array","items":{"$ref":"#/components/schemas/PositionSample"},"description":"Array of datapoints of the position of the user, sampled throughout the workout."},"start_pos_lat_lng_deg":{"type":"array","items":{"type":"number"},"description":"Position of the user at the start of the workout, represented by a 2-value array of latitude, longitude, wherein each of the two numbers can be nullable."}}},"PositionSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PositionSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"coords_lat_lng_deg":{"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"description":"Position of the user a given point in time, represented by a 2-value array of latitude, longitude, wherein each of the two numbers can be nullable"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"PowerData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PowerData.yaml","type":"object","properties":{"avg_watts":{"type":"number","description":"Average power output of the user during the workout."},"max_watts":{"type":"number","description":"Maximum power output of the user during the workout."},"power_samples":{"type":"array","items":{"$ref":"#/components/schemas/PowerSample"},"description":"Array containing datapoints of the power output of the user sampled throughout the workout."}}},"PowerSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PowerSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"watts":{"type":"number","description":"Power generated at a given instant in time, in Watts"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"StrainData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StrainData.yaml","type":"object","properties":{"strain_level":{"type":"number","description":"Level of cardiovascular strain imposed on the user during the day."}}},"TSSData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TSSData.yaml","type":"object","properties":{"TSS_samples":{"type":"array","items":{"$ref":"#/components/schemas/TSSSample"},"description":"Array of TSS information sampled throughout the workout"}}},"TSSSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TSSSample.yaml","type":"object","properties":{"planned":{"type":"number","description":"Planned Training Stress Score value"},"actual":{"type":"number","description":"Actual Training Stress Score value achieved"},"method":{"type":"string","description":"Method used to calculate the TSS"},"intensity_factor_planned":{"type":"number","description":"Planned intensity factor for the training session"},"intensity_factor_actual":{"type":"number","description":"Actual intensity factor achieved during the training session"},"normalized_power_watts":{"type":"number","description":"Normalized power output in watts"}}},"WorkData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WorkData.yaml","type":"object","properties":{"work_kilojoules":{"type":"number","description":"Total work output of the user for the workout, in kilojoules."}}},"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]}}},"paths":{"/activity":{"post":{"tags":["Activity"],"operationId":"Activity_Write","description":"Used to post activity data to a provider. This endpoint only works for users connected via Wahoo. Returns error for other providers.","summary":"Post activity data to a provider","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"description":"List of user-tracked workouts to post to data provider","type":"array","items":{"$ref":"#/components/schemas/Activity"}}},"required":["data"]}}},"required":true},"responses":{"201":{"description":"Returned when activity was successfully created on the provider","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"log_ids":{"description":"List of identifiers for the objects created, returned in the same order they were posted. I.e. Posting [ObjectA, ObjectB] will return [IdentifierA, IdentifierB]","type":"array","items":{"type":"string"}},"message":{"type":"string","default":"Activity successfully logged"}}}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Post nutrition logs to a provider

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"Nutrition":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Nutrition.yaml","type":"object","properties":{"drink_samples":{"type":"array","items":{"$ref":"#/components/schemas/DrinkSample"},"description":"Information on drinks the user consumed throughout the day."},"meals":{"type":"array","items":{"$ref":"#/components/schemas/Meal"},"description":"Information on individual foods consumed throughout a given day."},"metadata":{"$ref":"#/components/schemas/NutritionMetadata","description":"Object containing daily summary metadata."},"summary":{"$ref":"#/components/schemas/NutritionSummary","description":"Summative nutritional information for a given day."}},"required":["metadata"]},"DrinkSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DrinkSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time"},"drink_volume":{"type":"number","description":"Volume of drink consumed"},"drink_unit":{"type":"string","description":"Unit of measurement for the drink"},"drink_name":{"type":"string","description":"Name of drink consumed."}}},"Meal":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Meal.yaml","type":"object","properties":{"micros":{"$ref":"#/components/schemas/NutritionMicros","description":"Micronutrient information for associated food."},"type":{"$ref":"#/components/schemas/MealType","description":"Enum representing the category the consumed food/meal falls under (i.e. Breakfast/Lunch/Dinner etc)."},"id":{"type":"string","description":"Identifier for food logged by the user."},"timestamp":{"type":"string","description":"Timestamp the food is associated with, in ISO8601 format, with microsecond precision."},"quantity":{"$ref":"#/components/schemas/NutritionQuantity","description":"Quantity of the food that was consumed, containing information on amount & units in which this was recorded."},"name":{"type":"string","description":"Name of food logged by the user."},"macros":{"$ref":"#/components/schemas/NutritionMacros","description":"Macronutrient information for associated food."}},"required":["micros","type","id","timestamp","quantity","name","macros"]},"NutritionMicros":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMicros.yaml","type":"object","properties":{"biotin_mg":{"type":"number","description":"Biotin content of the associated food(s)."},"caffeine_mg":{"type":"number","description":"Caffeine content of the associated food(s)."},"calcium_mg":{"type":"number","description":"Calcium content of the associated food(s)."},"chloride_mg":{"type":"number","description":"Chloride content of the associated food(s)."},"chromium_mg":{"type":"number","description":"Chromium content of the associated food(s)."},"copper_mg":{"type":"number","description":"Copper content of the associated food(s)."},"folate_mg":{"type":"number","description":"Folate content of the associated food(s)."},"folic_acid_mg":{"type":"number","description":"Folic Acid content of the associated food(s)."},"iodine_mg":{"type":"number","description":"Iodine content of the associated food(s)."},"iron_mg":{"type":"number","description":"Iron content of the associated food(s)."},"magnesium_mg":{"type":"number","description":"Magnesium content of the associated food(s)."},"manganese_mg":{"type":"number","description":"Manganese content of the associated food(s)."},"molybdenum_mg":{"type":"number","description":"Molybdenum content of the associated food(s)."},"niacin_mg":{"type":"number","description":"Niacin content of the associated food(s)."},"pantothenic_acid_mg":{"type":"number","description":"Pantothenic content of the associated food(s)."},"phosphorus_mg":{"type":"number","description":"Phosphorus content of the associated food(s)."},"potassium_mg":{"type":"number","description":"Potassium content of the associated food(s)."},"riboflavin_mg":{"type":"number","description":"Riboflavin content of the associated food(s)."},"selenium_mg":{"type":"number","description":"Selenium content of the associated food(s)."},"thiamin_mg":{"type":"number","description":"Thiamin content of the associated food(s)."},"vitamin_A_mg":{"type":"number","description":"Vitamin A content of the associated food(s)."},"vitamin_B12_mg":{"type":"number","description":"Vitamin B12 content of the associated food(s)."},"vitamin_B6_mg":{"type":"number","description":"Vitamin B6 content of the associated food(s)."},"vitamin_C_mg":{"type":"number","description":"Vitamin C content of the associated food(s)."},"vitamin_D_mg":{"type":"number","description":"Vitamin D content of the associated food(s)."},"vitamin_D2_mg":{"type":"number","description":"Vitamin D2 content of the associated food(s)."},"vitamin_D3_mg":{"type":"number","description":"Vitamin D3 content of the associated food(s)."},"vitamin_E_mg":{"type":"number","description":"Vitamin E content of the associated food(s)."},"vitamin_K_mg":{"type":"number","description":"Vitamin K content of the associated food(s)."},"zinc_mg":{"type":"number","description":"Zinc content of the associated food(s)."},"cystine_g":{"type":"number","description":"Cystine content of the associated food(s)."},"histidine_g":{"type":"number","description":"Histidine content of the associated food(s)."},"isoleucine_g":{"type":"number","description":"Isoleucine content of the associated food(s)."},"leucine_g":{"type":"number","description":"Leucine content of the associated food(s)."},"lysine_g":{"type":"number","description":"Lysine content of the associated food(s)."},"methionine_g":{"type":"number","description":"Methionine content of the associated food(s)."},"phenylalanine_g":{"type":"number","description":"Phenylalanine content of the associated food(s)."},"threonine_g":{"type":"number","description":"Threonine content of the associated food(s)."},"tryptophan_g":{"type":"number","description":"Tryptophan content of the associated food(s)."},"tyrosine_g":{"type":"number","description":"Tyrosine content of the associated food(s)."},"valine_g":{"type":"number","description":"Valine content of the associated food(s)."},"monounsaturated_fat_g":{"type":"number","description":"Monounsaturated fat content of the associated food(s)."},"polyunsaturated_fat_g":{"type":"number","description":"Polyunsaturated fat content of the associated food(s)."},"omega3_g":{"type":"number","description":"Omega3 content of the associated food(s)."},"omega6_g":{"type":"number","description":"Omega6 content of the associated food(s)."},"starch_g":{"type":"number","description":"Starch content of the associated food(s)."}}},"MealType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MealType.yaml","oneOf":[{"type":"number","const":0,"description":"Meal type is unknown or could not be determined.","title":"Unknown"},{"type":"number","const":1,"description":"Meal consumed in the morning, typically the first meal of the day.","title":"Breakfast"},{"type":"number","const":2,"description":"Light meal or snack consumed in the morning, between breakfast and lunch.","title":"Morning Snack"},{"type":"number","const":3,"description":"Meal consumed around midday, typically the second meal of the day.","title":"Lunch"},{"type":"number","const":4,"description":"Light meal or snack consumed in the afternoon, between lunch and dinner.","title":"Afternoon Snack"},{"type":"number","const":5,"description":"Meal consumed in the evening, typically the last main meal of the day.","title":"Dinner"},{"type":"number","const":6,"description":"Any light meal or snack consumed at any time, not fitting into main meal categories.","title":"Snack"}],"description":"Enum representing the category the consumed food/meal falls under (i.e. Breakfast/Lunch/Dinner etc)"},"NutritionQuantity":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionQuantity.yaml","type":"object","properties":{"unit":{"$ref":"#/components/schemas/NutritionUnits"},"amount":{"type":"number"}},"required":["unit","amount"]},"NutritionUnits":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionUnits.yaml","oneOf":[{"type":"number","const":0,"description":"The unit of measurement is unknown or not specified.","title":"Unknown"},{"type":"number","const":1,"description":"Measurement in grams, a metric unit of mass.","title":"Gram"},{"type":"number","const":2,"description":"Measurement in teaspoons, approximately 5 milliliters.","title":"Teaspoon"},{"type":"number","const":3,"description":"Measurement in tablespoons, approximately 15 milliliters.","title":"Tablespoon"},{"type":"number","const":4,"description":"Measurement in cups, approximately 240 milliliters.","title":"Cup"},{"type":"number","const":5,"description":"Quantity measured in medium-sized eggs.","title":"Medium Egg"},{"type":"number","const":6,"description":"Quantity measured in large-sized eggs.","title":"Large Egg"},{"type":"number","const":7,"description":"Quantity measured in small-sized eggs.","title":"Small Egg"},{"type":"number","const":8,"description":"Measurement in milliliters, a metric unit of volume.","title":"Milliliter"},{"type":"number","const":9,"description":"Measurement in ounces, approximately 28 grams.","title":"Ounce"},{"type":"number","const":10,"description":"Quantity measured by individual count or number of items.","title":"Count"},{"type":"number","const":11,"description":"Quantity measured in scoops, typically used for protein powder or supplements.","title":"Scoop"},{"type":"number","const":12,"description":"Measurement in fluid ounces, approximately 30 milliliters.","title":"Fluid Ounce"}],"description":"Represents units used for nutrition measurements"},"NutritionMacros":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMacros.yaml","type":"object","properties":{"alcohol_g":{"type":"number","description":"Alcohol content of the associated food(s)."},"calories":{"type":"number","description":"Calorie content of the associated food(s)."},"carbohydrates_g":{"type":"number","description":"Carbohydrates content of the associated food(s)."},"cholesterol_mg":{"type":"number","description":"Cholesterol content of the associated food(s)."},"fat_g":{"type":"number","description":"Fat content of the associated food(s)."},"fiber_g":{"type":"number","description":"Fiber content of the associated food(s)."},"net_carbohydrates_g":{"type":"number","description":"Net carbs content of the associated food(s)."},"protein_g":{"type":"number","description":"Protein content of the associated food(s)."},"saturated_fat_g":{"type":"number","description":"Saturated fat content of the associated food(s)."},"sodium_mg":{"type":"number","description":"Sodium content of the associated food(s)."},"sugar_g":{"type":"number","description":"Sugar content of the associated food(s)."},"trans_fat_g":{"type":"number","description":"Trans fat content of the associated food(s)."}}},"NutritionMetadata":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMetadata.yaml","type":"object","properties":{"end_time":{"type":"string","description":"The end time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h after start_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"start_time":{"type":"string","description":"The start time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h before end_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"timestamp_localization":{"$ref":"#/components/schemas/TimestampLocalization"}},"required":["end_time","start_time"]},"TimestampLocalization":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml","type":"number","enum":[0,1],"description":"Indicates whether the timestamps in this payload are localized (LOCAL) or in UTC."},"NutritionSummary":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionSummary.yaml","type":"object","properties":{"macros":{"$ref":"#/components/schemas/NutritionMacros","description":"Summary of macronutrient information for a given day."},"micros":{"$ref":"#/components/schemas/NutritionMicros","description":"Summary of micronutrient information for a given day."},"water_ml":{"type":"number","description":"Water consumption of the user for a given day."},"drink_ml":{"type":"number","description":"Non-water drink consumption of the user for a given day."}}},"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]}}},"paths":{"/nutrition":{"post":{"tags":["Nutrition"],"operationId":"Nutrition_Write","description":"Used to post nutrition logs to a provider. This endpoint only works for users connected via Fitbit. Returns error for other providers.","summary":"Post nutrition logs to a provider","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"description":"Nutrition entry to post to data provider","type":"array","items":{"$ref":"#/components/schemas/Nutrition"}}},"required":["data"]}}},"required":true},"responses":{"201":{"description":"Returned when activity was successfully created on the provider","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"log_ids":{"description":"List of identifiers for the objects created, returned in the same order they were posted. I.e. Posting [ObjectA, ObjectB] will return [IdentifierA, IdentifierB]","type":"array","items":{"type":"string"}},"message":{"type":"string","default":"Nutrition successfully logged"}}}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Post body data to a provider

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"Body":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Body.yaml","type":"object","properties":{"blood_pressure_data":{"$ref":"#/components/schemas/BloodPressureData","description":"Object containing information on user's Blood Pressure."},"device_data":{"$ref":"#/components/schemas/DeviceData","description":"Object containing information on the device which recorded data for the payload."},"heart_data":{"$ref":"#/components/schemas/HeartData","description":"Object containing information on user's heart metrics."},"hydration_data":{"$ref":"#/components/schemas/HydrationData","description":"Object containing information on user's hydration (both internal & consumption of water) for the day."},"ketone_data":{"$ref":"#/components/schemas/KetoneData","description":"Object containing information on user's ketone data for the day."},"measurements_data":{"$ref":"#/components/schemas/MeasurementsData","description":"Object containing information on body measurements for the day."},"metadata":{"$ref":"#/components/schemas/BodyMetadata","description":"Object containing daily summary metadata."},"oxygen_data":{"$ref":"#/components/schemas/OxygenData","description":"Object containing information on user's oxygen-related data."},"temperature_data":{"$ref":"#/components/schemas/TemperatureData","description":"Object containing temperature information (core, skin, ambient) during the day."},"glucose_data":{"$ref":"#/components/schemas/GlucoseData","description":"Object containing information on user's blood glucose for the day."}},"required":["metadata"]},"BloodPressureData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BloodPressureData.yaml","type":"object","properties":{"blood_pressure_samples":{"type":"array","items":{"$ref":"#/components/schemas/BloodPressureSample"},"description":"List of Blood Pressure measurements sampled throughout the day."}}},"BloodPressureSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BloodPressureSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"diastolic_bp":{"type":"number","description":"User's diastolic blood pressure, in mmHg"},"systolic_bp":{"type":"number","description":"User's systolic blood pressure, in mmHg"}}},"DeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceData.yaml","type":"object","properties":{"activation_timestamp":{"type":"string","description":"Activation timestamp of the device, if applicable."},"data_provided":{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"},"description":"Data provided by the device, as enumerated types."},"hardware_version":{"type":"string","description":"Hardware version of the device."},"last_upload_date":{"type":"string","description":"Last upload date from the device."},"manufacturer":{"type":"string","description":"Device manufacturer name."},"name":{"type":"string","description":"Device name - note that this can also be the name of the application/package which the data comes from, if coming from a data aggregator such as Google Fit."},"other_devices":{"type":"array","items":{"$ref":"#/components/schemas/OtherDeviceData"},"description":"Data pertaining to other devices which may have contributed data for this workout."},"sensor_state":{"type":"string","description":"Sensor state of the device."},"serial_number":{"type":"string","description":"Device Serial Number."},"software_version":{"type":"string","description":"Device Software Version."}}},"DeviceDataType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceDataType.yaml","oneOf":[{"type":"string","const":"STEPS","description":"Count of steps taken by the user.","title":"Steps"},{"type":"string","const":"ACTIVE_MINUTES","description":"Duration of time the user spent in physical activity.","title":"Active Minutes"},{"type":"string","const":"BMR","description":"User's basal metabolic rate - calories burned at rest.","title":"Basal Metabolic Rate"},{"type":"string","const":"CALORIES","description":"Calories burned by the user during activity.","title":"Calories"},{"type":"string","const":"DISTANCE","description":"Distance traveled by the user during activity.","title":"Distance"},{"type":"string","const":"HEART_RATE","description":"User's heart rate measurements.","title":"Heart Rate"},{"type":"string","const":"OXYGEN_SATURATION","description":"Blood oxygen saturation level (SpO2) of the user.","title":"Oxygen Saturation"},{"type":"string","const":"SLEEP_TYPE","description":"Classification of user's sleep stages or types.","title":"Sleep Classification"},{"type":"string","const":"SPEED","description":"User's movement speed during activity.","title":"Speed"},{"type":"string","const":"CADENCE","description":"Rate of movement repetition during activity (steps per minute).","title":"Cadence"}],"description":"Represents data types that a certain device contributed to."},"OtherDeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OtherDeviceData.yaml","type":"object","properties":{"manufacturer":{"type":"string","description":"Device manufacturer name."},"hardware_version":{"type":"string","description":"Hardware version of the device."},"serial_number":{"type":"string","description":"Device Serial Number."},"name":{"type":"string","description":"Device name - note that this can also be the name of the application/package which the data comes from, if coming from a data aggregator such as Google Fit."},"software_version":{"type":"string","description":"Device Software Version."},"activation_timestamp":{"type":"string","description":"Activation timestamp of the device, if applicable."},"data_provided":{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"},"description":"Data provided by the device, as enumerated types."},"last_upload_date":{"type":"string","description":"Last upload date from the device."}}},"HeartData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartData.yaml","type":"object","properties":{"afib_classification_samples":{"type":"array","items":{"$ref":"#/components/schemas/AFibClassificationSample"},"description":"List of Atrial Fibrillation classification measurements sampled through the day."},"ecg_signal":{"type":"array","items":{"$ref":"#/components/schemas/ECGReading"},"description":"List of ECGReadings sampled through the day."},"heart_rate_data":{"$ref":"#/components/schemas/HeartRateData","description":"Object containing heart rate data."},"pulse_wave_velocity_samples":{"type":"array","items":{"$ref":"#/components/schemas/PulseVelocitySample"},"description":"List of Pulse Wave Velocity measurements sampled throughout the day. This represents a measurement of arterial stiffness that is an independent predictor of cardiovascular risk."},"rr_interval_samples":{"type":"array","items":{"$ref":"#/components/schemas/RRIntervalSample"},"description":"List of RR Interval samples throughout the day."}}},"AFibClassificationSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AFibClassificationSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"afib_classification":{"$ref":"#/components/schemas/AFibFlag","description":"Flag indicating the atrial fibrillation classification of the individual"}}},"AFibFlag":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AFibFlag.yaml","oneOf":[{"type":"number","const":0,"description":"AFib was not detected in the heart rhythm analysis.","title":"Negative"},{"type":"number","const":1,"description":"AFib was detected in the heart rhythm analysis.","title":"Positive"},{"type":"number","const":2,"description":"The heart rhythm analysis couldn't determine whether AFib was present or absent.","title":"Inconclusive"}],"description":"Flag indicating the atrial fibrillation classification of the individual"},"ECGReading":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ECGReading.yaml","type":"object","properties":{"start_timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"avg_hr_bpm":{"type":"number","description":"User's average heart rate throughout the day, in beats per minute (bpm)."},"afib_classification":{"$ref":"#/components/schemas/AFibFlag","description":"User's afib classification throught the day."},"raw_signal":{"type":"array","items":{"$ref":"#/components/schemas/RawECGSample"},"description":"List of raw ECG readings sampled through the day."}}},"RawECGSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RawECGSample.yaml","type":"object","properties":{"potential_uV":{"type":"number","description":"Potential uV in the RawECG Sample"},"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."}}},"HeartRateData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateData.yaml","type":"object","properties":{"detailed":{"$ref":"#/components/schemas/HeartRateDataDetailed","description":"Object containing detailed heart rate information for the associated workout."},"summary":{"$ref":"#/components/schemas/HeartRateDataSummary","description":"Object containing summary heart rate information for the associated workout."}}},"HeartRateDataDetailed":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataDetailed.yaml","type":"object","properties":{"hr_samples":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateDataSample"},"description":"Array of HeartRate data samples recorded for the user during the workout."},"hrv_samples_rmssd":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleRMSSD"},"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using RMSSD."},"hrv_samples_sdnn":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleSDNN"},"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using SDNN."}}},"HeartRateDataSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"bpm":{"type":"number","description":"User's heart rate in bpm"},"timer_duration_seconds":{"type":"number","description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"},"context":{"$ref":"#/components/schemas/HeartRateContext","description":"Represents the context in which heart rate was measured."}}},"HeartRateContext":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateContext.yaml","oneOf":[{"type":"number","const":0,"description":"Heart rate measurement context is not specified.","title":"Not Set"},{"type":"number","const":1,"description":"Heart rate was measured during physical activity or exercise.","title":"Active"},{"type":"number","const":2,"description":"Heart rate was measured during rest or non-active periods.","title":"Not Active"}],"description":"Represents the context in which heart rate was measured."},"HeartRateVariabilityDataSampleRMSSD":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleRMSSD.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hrv_rmssd":{"type":"number","description":"User's Heart Rate Variability, computed using RMSSD"}}},"HeartRateVariabilityDataSampleSDNN":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleSDNN.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hrv_sdnn":{"type":"number","description":"User's Heart Rate Variability, computed using SDNN"}}},"HeartRateDataSummary":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSummary.yaml","type":"object","properties":{"avg_hr_bpm":{"type":"number","minimum":0,"description":"Average HeartRate of the user during the workout."},"avg_hrv_rmssd":{"type":"number","description":"Average HeartRate Variability of the user during the workout, computed using RMSSD."},"avg_hrv_sdnn":{"type":"number","description":"Average HeartRate Variability of the user during the workout, computed using SDNN."},"hr_zone_data":{"type":"array","items":{"$ref":"#/components/schemas/HeartRateZoneData"},"description":"Array of time spent in various HR zones throughout the workout."},"max_hr_bpm":{"type":"number","minimum":0,"description":"Maximum HeartRate of the user during the workout."},"min_hr_bpm":{"type":"number","minimum":0,"description":"Minimum HeartRate of the user during the workout."},"resting_hr_bpm":{"type":"number","minimum":0,"description":"Resting HeartRate of the user, as determined by the fitness data provider."},"user_max_hr_bpm":{"type":"number","description":"User's maximum HeartRate based on their age, and other factors as determined by the fitness data provider."}}},"HeartRateZoneData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZoneData.yaml","type":"object","properties":{"zone":{"$ref":"#/components/schemas/HeartRateZone","description":"Heart rate zone designation"},"start_percentage":{"type":"number","minimum":0,"maximum":100,"description":"Start percentage (based off user's max HR) of the HR zone"},"end_percentage":{"type":"number","minimum":0,"maximum":100,"description":"End percentage (based off user's max HR) of the HR zone"},"name":{"type":"string","description":"Name of the associated heart rate zone"},"duration_seconds":{"type":"number","description":"Duration spent in the heart rate zone"}}},"HeartRateZone":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZone.yaml","oneOf":[{"type":"number","const":0,"description":"Resting heart rate zone.","title":"Zone 0"},{"type":"number","const":1,"description":"Very light activity zone.","title":"Zone 1"},{"type":"number","const":2,"description":"Light activity zone.","title":"Zone 2"},{"type":"number","const":3,"description":"Moderate activity zone.","title":"Zone 3"},{"type":"number","const":4,"description":"Hard activity zone.","title":"Zone 4"},{"type":"number","const":5,"description":"Maximum effort zone.","title":"Zone 5"},{"type":"number","const":6,"description":"Heart rate zone that doesn't fit into the standard zones or couldn't be classified.","title":"Other"}],"description":"Represents the heart rate zone the user is currently in during a workout or activity"},"PulseVelocitySample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PulseVelocitySample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"pulse_wave_velocity_meters_per_second":{"type":"number","description":"User's Pulse Wave Velocity measurement - velocity at which the blood pressure pulse propagates through the circulatory system"}}},"RRIntervalSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RRIntervalSample.yaml","type":"object","properties":{"rr_interval_ms":{"type":"number","description":"User's RR Interval for a specific heart beat in milliseconds."},"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hr_bpm":{"type":"number","description":"The heart beat value at that specific instance."}}},"HydrationData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HydrationData.yaml","type":"object","properties":{"day_total_water_consumption_ml":{"type":"number","description":"User's total water consumption throughout the day."},"hydration_amount_samples":{"type":"array","items":{"$ref":"#/components/schemas/HydrationMeasurementSample"},"description":"User's hydration level samples throughout the day."}}},"HydrationMeasurementSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HydrationMeasurementSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"hydration_kg":{"type":"number","description":"Total body water composition of the user, in kilograms."}}},"KetoneData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/KetoneData.yaml","type":"object","properties":{"ketone_samples":{"type":"array","items":{"$ref":"#/components/schemas/KetoneSample"},"description":"List of ketone data sampled through the day."}}},"KetoneSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/KetoneSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"ketone_mg_per_dL":{"type":"number","description":"Ketone in mg per dL"},"sample_type":{"$ref":"#/components/schemas/KetoneSampleType","description":"Flag indicating the ketone sample type (e.g. blood, breath, urine)"}}},"KetoneSampleType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/KetoneSampleType.yaml","oneOf":[{"type":"number","const":0,"description":"The type of ketone sample is unknown or not specified.","title":"Unknown"},{"type":"number","const":1,"description":"Ketone sample taken from blood.","title":"Blood"},{"type":"number","const":2,"description":"Ketone sample taken from urine.","title":"Urine"},{"type":"number","const":3,"description":"Ketone sample taken from breath.","title":"Breath"}],"description":"Flag indicating the ketone sample type (e.g. blood, breath, urine)"},"MeasurementsData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MeasurementsData.yaml","type":"object","properties":{"measurements":{"type":"array","items":{"$ref":"#/components/schemas/MeasurementDataSample"},"description":"List of body metrics & measurements taken throughout the associated day."}}},"MeasurementDataSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MeasurementDataSample.yaml","type":"object","properties":{"measurement_time":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"BMI":{"type":"number","description":"User's Body Mass Index (BMI)."},"BMR":{"type":"number","description":"User's Basal Metabolic Rate - minimum amount of calories that a person's body needs to perform necessary functions."},"RMR":{"type":"number","description":"User's Resting Metabolic Rate - amount of energy that a person's body needs to function while at rest. RMR accounts for additional low-effort daily activities on top of basic body functions."},"estimated_fitness_age":{"type":"string","description":"Estimate of how fit the user is compared to their actual age, as measured by the device."},"skin_fold_mm":{"type":"number","description":"User's skin fold measurement."},"bodyfat_percentage":{"type":"number","minimum":0,"maximum":100,"description":"User's body fat percentage."},"weight_kg":{"type":"number","description":"User's body weight."},"height_cm":{"type":"number","description":"User's height."},"bone_mass_g":{"type":"number","description":"User's total bone mass."},"muscle_mass_g":{"type":"number","description":"User's total muscle mass (i.e. skeletal muscle mass)."},"lean_mass_g":{"type":"number","description":"Total lean mass of the user - calculated as the difference between total body weight and body fat weight."},"water_percentage":{"type":"number","minimum":0,"maximum":100,"description":"Total amount of fluid in the user's body."},"insulin_units":{"type":"number","description":"Quantity of insulin administered to the user."},"insulin_type":{"type":"string","description":"Type of insulin administered to the user."},"urine_color":{"type":"string","description":"Color of the user's urine."},"user_notes":{"type":"string","description":"User notes associated with the measurement."}}},"BodyMetadata":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BodyMetadata.yaml","type":"object","properties":{"end_time":{"type":"string","description":"The end time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h after start_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"start_time":{"type":"string","description":"The start time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h before end_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"timestamp_localization":{"$ref":"#/components/schemas/TimestampLocalization"}},"required":["end_time","start_time"]},"TimestampLocalization":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml","type":"number","enum":[0,1],"description":"Indicates whether the timestamps in this payload are localized (LOCAL) or in UTC."},"OxygenData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenData.yaml","type":"object","properties":{"avg_saturation_percentage":{"type":"number","description":"Average Oxygen Saturation percentage of the user during the day (SpO2 or SmO2)."},"saturation_samples":{"type":"array","items":{"$ref":"#/components/schemas/OxygenSaturationSample"},"description":"Array of Oxygen Saturation percentage datapoints sampled throughout the day."},"vo2_samples":{"type":"array","items":{"$ref":"#/components/schemas/Vo2MaxSample"},"description":"Array of VO2 datapoints sampled throughout the day."},"vo2max_ml_per_min_per_kg":{"type":"number","description":"VO2Max for the given user."}}},"OxygenSaturationSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"percentage":{"type":"number","description":"User's oxygen saturation percentage - referring to either SpO2 or SmO2, based on the `type` field"},"type":{"$ref":"#/components/schemas/OxygenSaturationType","description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"}}},"OxygenSaturationType":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationType.yaml","oneOf":[{"type":"number","const":0,"description":"Oxygen saturation measurement for blood.","title":"Blood"},{"type":"number","const":1,"description":"Oxygen saturation measurement for muscle.","title":"Muscle"}],"description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"},"Vo2MaxSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Vo2MaxSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"vo2max_ml_per_min_per_kg":{"type":"number","description":"User's VO2Max - maximum amount of oxygen the user's body can utilize during exercise"}}},"TemperatureData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TemperatureData.yaml","type":"object","properties":{"ambient_temperature_samples":{"type":"array","items":{"$ref":"#/components/schemas/TemperatureSample"},"description":"List of ambient temperature measurements sampled throughout the day."},"body_temperature_samples":{"type":"array","items":{"$ref":"#/components/schemas/TemperatureSample"},"description":"List of body temperature measurements sampled throughout the day."},"skin_temperature_samples":{"type":"array","items":{"$ref":"#/components/schemas/TemperatureSample"},"description":"List of skin temperature measurements sampled throughout the day."}}},"TemperatureSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TemperatureSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"temperature_celsius":{"type":"number","description":"Temperature value in degrees Celsius."}}},"GlucoseData":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseData.yaml","type":"object","properties":{"blood_glucose_samples":{"type":"array","items":{"$ref":"#/components/schemas/GlucoseDataSample"},"description":"List of blood glucose readings sampled throughout the day."},"detailed_blood_glucose_samples":{"type":"array","items":{"$ref":"#/components/schemas/GlucoseDataSample"},"description":"List of blood glucose readings sampled throughout the day - this represents additional data points, potentially at higher frequency from the ones in blood_glucose_samples, which may come at a cost of reduced accuracy."},"day_avg_blood_glucose_mg_per_dL":{"type":"number","description":"User's average glucose level throughout the day."},"gmi":{"type":"number","description":"GMI (Glucose Management Indicator) is a metric derived from continuous glucose monitoring (CGM) data that estimates average glucose levels to help guide diabetes management, without implying a precise match to laboratory A1C."},"time_in_range":{"type":"number","description":"Time that the user's glucose is within acceptable range (not hyper or hypoglycemic)."},"sensor_usage":{"type":"integer","description":"Number of data points recorded by the sensor throughout the day."},"daily_patterns":{"type":"array","items":{"$ref":"#/components/schemas/DailyPatternSample"},"description":"List of glucose percentile samples throughout the day."}}},"GlucoseDataSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseDataSample.yaml","type":"object","properties":{"timestamp":{"type":"string","description":"Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time."},"blood_glucose_mg_per_dL":{"type":"integer","description":"User's blood glucose reading"},"glucose_level_flag":{"$ref":"#/components/schemas/GlucoseFlag","description":"Flag indicating state of user's blood glucose level"},"trend_arrow":{"$ref":"#/components/schemas/TrendArrow","description":"Flag indicating the current trend in the user's blood glucose level (e.g. rising, constant, falling)"}}},"GlucoseFlag":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseFlag.yaml","oneOf":[{"type":"number","const":0,"description":"Blood glucose level is within the normal/healthy range.","title":"Normal"},{"type":"number","const":1,"description":"Blood glucose level is above the normal range (hyperglycemia).","title":"High"},{"type":"number","const":2,"description":"Blood glucose level is below the normal range (hypoglycemia).","title":"Low"}],"description":"Flag indicating state of user's blood glucose level"},"TrendArrow":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TrendArrow.yaml","oneOf":[{"type":"number","const":0,"description":"Glucose trend cannot be determined.","title":"Unknown"},{"type":"number","const":1,"description":"Glucose level is decreasing rapidly.","title":"Falling Quickly"},{"type":"number","const":2,"description":"Glucose level is decreasing gradually.","title":"Falling"},{"type":"number","const":3,"description":"Glucose level is remaining stable.","title":"Flat"},{"type":"number","const":4,"description":"Glucose level is increasing gradually.","title":"Rising"},{"type":"number","const":5,"description":"Glucose level is increasing rapidly.","title":"Rising Quickly"}],"description":"Flag indicating the current trend in the user's blood glucose level (e.g. rising, constant, falling)"},"DailyPatternSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyPatternSample.yaml","type":"object","properties":{"time_from_midnight":{"type":"integer","minimum":0,"maximum":23,"description":"Hour of the day, represented as an integer from 0 to 23, where 0 is midnight and 23 is the hour before the next midnight."},"percentile_5":{"type":"integer","description":"Percentile 5 of the glucose level at the given time of day."},"percentile_25":{"type":"integer","description":"Percentile 25 of the glucose level at the given time of day."},"percentile_50":{"type":"integer","description":"Percentile 50 of the glucose level at the given time of day."},"percentile_75":{"type":"integer","description":"Percentile 75 of the glucose level at the given time of day."},"percentile_95":{"type":"integer","description":"Percentile 95 of the glucose level at the given time of day."}}},"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]}}},"paths":{"/body":{"post":{"tags":["Body"],"operationId":"Body_Write","description":"Used to post body data to a provider. This endpoint only works for users connected via Google Fit. Returns error for other providers.","summary":"Post body data to a provider","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"description":"Body measurement metrics to post to data provider","type":"array","items":{"$ref":"#/components/schemas/Body"}}},"required":["data"]}}},"required":true},"responses":{"201":{"description":"Returned when activity was successfully created on the provider","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"log_ids":{"description":"List of identifiers for the objects created, returned in the same order they were posted. I.e. Posting [ObjectA, ObjectB] will return [IdentifierA, IdentifierB]","type":"array","items":{"type":"string"}},"message":{"type":"string","default":"Body data successfully logged"}}}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Post workout plans to a provider

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"PlannedWorkout":{"type":"object","properties":{"steps":{"type":"array","description":"List of exercises/steps/intervals for the workout plan","items":{"$ref":"#/components/schemas/PlannedWorkoutSteps"}},"metadata":{"description":"Metadata for the workout plan","type":"object","allOf":[{"$ref":"#/components/schemas/PlannedWorkoutMetadata"}]}}},"PlannedWorkoutSteps":{"type":"object","properties":{},"oneOf":[{"$ref":"#/components/schemas/PlannedWorkoutStep"},{"$ref":"#/components/schemas/PlannedWorkoutRepeatStep"},{"$ref":"#/components/schemas/SwimmingPlannedWorkoutStep"},{"$ref":"#/components/schemas/CardioPlannedWorkoutStep"},{"$ref":"#/components/schemas/StrengthPlannedWorkoutStep"},{"$ref":"#/components/schemas/YogaPlannedWorkoutStep"},{"$ref":"#/components/schemas/PilatesPlannedWorkoutStep"},{"$ref":"#/components/schemas/RunningPlannedWorkoutStep"},{"$ref":"#/components/schemas/CyclingPlannedWorkoutStep"}],"discriminator":{"propertyName":"type","mapping":{"PlannedWorkoutStep":"#/components/schemas/PlannedWorkoutStep","PlannedWorkoutRepeatStep":"#/components/schemas/PlannedWorkoutRepeatStep","SwimmingPlannedWorkoutStep":"#/components/schemas/SwimmingPlannedWorkoutStep","CardioPlannedWorkoutStep":"#/components/schemas/CardioPlannedWorkoutStep","StrengthPlannedWorkoutStep":"#/components/schemas/StrengthPlannedWorkoutStep","YogaPlannedWorkoutStep":"#/components/schemas/YogaPlannedWorkoutStep","PilatesPlannedWorkoutStep":"#/components/schemas/PilatesPlannedWorkoutStep","RunningPlannedWorkoutStep":"#/components/schemas/RunningPlannedWorkoutStep","CyclingPlannedWorkoutStep":"#/components/schemas/CyclingPlannedWorkoutStep"}}},"PlannedWorkoutStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTargets"}},"type":{"description":"Type of workout step - either repeat or one-off","type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"description":"Planned intensity for the workout step","type":"string","enum":["REST","WARMUP","COOLDOWN","RECOVERY","INTERVAL","ACTIVE"]},"order":{"type":"integer","description":"Position of the workout step in the overall workout"},"description":{"type":"string","description":"Description of workout step"},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDurations"}},"name":{"type":"string","description":"Name of workout step"}}},"PlannedWorkoutStepTargets":{"type":"object","properties":{},"oneOf":[{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/CadencePlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/HRPlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/PowerPlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/SpeedPlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/PacePlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/TSSPlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/IFPlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/RepetitionPlannedWorkoutStepTarget"},{"$ref":"#/components/schemas/SwimStrokePlannedWorkoutStepTarget"}],"discriminator":{"propertyName":"type","mapping":{"PlannedWorkoutStepTarget":"#/components/schemas/PlannedWorkoutStepTarget","CadencePlannedWorkoutStepTarget":"#/components/schemas/CadencePlannedWorkoutStepTarget","HRPlannedWorkoutStepTarget":"#/components/schemas/HRPlannedWorkoutStepTarget","PowerPlannedWorkoutStepTarget":"#/components/schemas/PowerPlannedWorkoutStepTarget","SpeedPlannedWorkoutStepTarget":"#/components/schemas/SpeedPlannedWorkoutStepTarget","PacePlannedWorkoutStepTarget":"#/components/schemas/PacePlannedWorkoutStepTarget","TSSPlannedWorkoutStepTarget":"#/components/schemas/TSSPlannedWorkoutStepTarget","IFPlannedWorkoutStepTarget":"#/components/schemas/IFPlannedWorkoutStepTarget","RepetitionPlannedWorkoutStepTarget":"#/components/schemas/RepetitionPlannedWorkoutStepTarget","SwimStrokePlannedWorkoutStepTarget":"#/components/schemas/SwimStrokePlannedWorkoutStepTarget"}}},"PlannedWorkoutStepTarget":{"type":"object","properties":{"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]}}},"CadencePlannedWorkoutStepTarget":{"type":"object","properties":{"cadence":{"type":"integer","description":"Ideal cadence value to be maintained for the workout step","nullable":true},"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"cadence_low":{"type":"integer","description":"Minimum cadence threshold for the workout step - i.e. the user is to stay above this value during the workout","nullable":true},"cadence_high":{"type":"integer","description":"Maximum cadence threshold for the workout step - i.e. the user is to stay under this value during the workout step","nullable":true}}},"HRPlannedWorkoutStepTarget":{"type":"object","properties":{"hr_percentage_low":{"type":"number","description":"Maximum max heart rate percentage threshold for the workout step - i.e. the user is to stay under this value during the workout step","nullable":true},"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"hr_percentage_high":{"type":"number","description":"Minimum heart rate percentage threshold for the workout step - i.e. the user is to stay above this value during the workout","nullable":true},"hr_percentage":{"type":"number","description":"Ideal percentage of user's maximum HR to be maintained workout step","nullable":true},"hr_bpm_high":{"type":"integer","description":"Maximum heart rate threshold for the workout step - i.e. the user is to stay under this value during the workout step","nullable":true},"hr_bpm_low":{"type":"integer","description":"Minimum heart rate threshold for the workout step - i.e. the user is to stay above this value during the workout","nullable":true}}},"PowerPlannedWorkoutStepTarget":{"type":"object","properties":{"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"power_percentage_low":{"type":"number","description":"Maximum percentage of Functional Threshold Power for the workout step - i.e. the user is to stay under this value during the workout step","nullable":true},"power_percentage_high":{"type":"number","description":"Minimum percentage of Functional Threshold Power for the workout step - i.e. the user is to stay above this value during the workout","nullable":true},"power_watt_high":{"type":"integer","description":"Maximum power threshold for the workout step - i.e. the user is to stay under this value during the workout step","nullable":true},"power_watt_low":{"type":"integer","description":"Minimum power threshold for the workout step - i.e. the user is to stay above this value during the workout","nullable":true},"power_watt":{"type":"integer","default":null,"nullable":true},"power_percentage":{"type":"number","description":"Ideal percentage of user's Functional Threshold Power to be maintained workout step","nullable":true}}},"SpeedPlannedWorkoutStepTarget":{"type":"object","properties":{"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"speed_percentage_high":{"type":"number","description":"Maximum speed threshold for the workout step - i.e. the user is to stay under this value during the workout step","nullable":true},"speed_percentage_low":{"type":"number","description":"Minimum speed threshold for the workout step - i.e. the user is to stay above this value during the workout step","nullable":true},"speed_percentage":{"type":"number","description":"Ideal percentage of user's Threshold Speed, based off their Threshold Pace, to be maintained workout step. Usually, the Threshold Pace is defined as the pace one could race at for 50 to 60 minutes","nullable":true},"speed_meters_per_second":{"type":"number","description":"Ideal speed value to be maintained for the workout step","nullable":true}}},"PacePlannedWorkoutStepTarget":{"type":"object","properties":{"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"pace_minutes_per_kilometer":{"type":"number","description":"Ideal pace value to be maintained for the workout step","nullable":true}}},"TSSPlannedWorkoutStepTarget":{"type":"object","properties":{"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"tss":{"type":"number","description":"Planned Training Stress Score to be achieved for the workout step","nullable":true}}},"IFPlannedWorkoutStepTarget":{"type":"object","properties":{"if_high":{"type":"number","description":"Maximum Intensity Factor to be achieved for the workout step","nullable":true},"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"if_low":{"type":"number","description":"Minimum Intensity Factor to be achieved for the workout step","nullable":true}}},"RepetitionPlannedWorkoutStepTarget":{"type":"object","properties":{"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"repetitions":{"type":"number","description":"Number of repetitions of the workout step to be performed","nullable":true}}},"SwimStrokePlannedWorkoutStepTarget":{"type":"object","properties":{"target_type":{"description":"Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed","nullable":false,"type":"string","enum":["SPEED","HEART_RATE","OPEN","CADENCE","POWER","GRADE","RESISTANCE","POWER_LAP","SWIM_STROKE","SPEED_LAP","HEART_RATE_LAP","PACE","HEART_RATE_THRESHOLD_PERCENTAGE","HEART_RATE_MAX_PERCENTAGE","SPEED_PERCENTAGE","POWER_PERCENTAGE","REPETITION","TSS","IF"]},"swim_strokes":{"type":"integer","description":"Number of swim strokes to be performed during the workout step","nullable":true}}},"PlannedWorkoutStepDurations":{"type":"object","properties":{},"oneOf":[{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/TimePlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/PowerAbovePlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/PowerBelowPlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/FixedRestPlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/CaloriesPlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/HRAbovePlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/HRBelowPlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/RepsPlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/DistancePlannedWorkoutStepDuration"},{"$ref":"#/components/schemas/StepsPlannedWorkoutStepDuration"}],"discriminator":{"propertyName":"type","mapping":{"PlannedWorkoutStepDuration":"#/components/schemas/PlannedWorkoutStepDuration","TimePlannedWorkoutStepDuration":"#/components/schemas/TimePlannedWorkoutStepDuration","PowerAbovePlannedWorkoutStepDuration":"#/components/schemas/PowerAbovePlannedWorkoutStepDuration","PowerBelowPlannedWorkoutStepDuration":"#/components/schemas/PowerBelowPlannedWorkoutStepDuration","FixedRestPlannedWorkoutStepDuration":"#/components/schemas/FixedRestPlannedWorkoutStepDuration","CaloriesPlannedWorkoutStepDuration":"#/components/schemas/CaloriesPlannedWorkoutStepDuration","HRAbovePlannedWorkoutStepDuration":"#/components/schemas/HRAbovePlannedWorkoutStepDuration","HRBelowPlannedWorkoutStepDuration":"#/components/schemas/HRBelowPlannedWorkoutStepDuration","RepsPlannedWorkoutStepDuration":"#/components/schemas/RepsPlannedWorkoutStepDuration","DistancePlannedWorkoutStepDuration":"#/components/schemas/DistancePlannedWorkoutStepDuration","StepsPlannedWorkoutStepDuration":"#/components/schemas/StepsPlannedWorkoutStepDuration"}}},"PlannedWorkoutStepDuration":{"type":"object","properties":{"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"TimePlannedWorkoutStepDuration":{"type":"object","properties":{"seconds":{"type":"integer","description":"Time duration to be elapsed for the workout step","nullable":true},"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"PowerAbovePlannedWorkoutStepDuration":{"type":"object","properties":{"power_above_watts":{"type":"integer","description":"Threshold power goal to complete the workout step - once the user reaches above this power level, the step will be completed","nullable":true},"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"PowerBelowPlannedWorkoutStepDuration":{"type":"object","properties":{"power_below_watts":{"type":"integer","description":"Threshold power goal to complete the workout step - once the user reaches below this power level, the step will be completed","nullable":true},"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"FixedRestPlannedWorkoutStepDuration":{"type":"object","properties":{"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]},"rest_seconds":{"type":"integer","description":"Time duration to be elapsed for the rest period","nullable":true}}},"CaloriesPlannedWorkoutStepDuration":{"type":"object","properties":{"calories":{"type":"integer","description":"Calorie burn target for the workout step - once the user reaches the target, the step will be completed","nullable":true},"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"HRAbovePlannedWorkoutStepDuration":{"type":"object","properties":{"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]},"hr_above_bpm":{"type":"integer","description":"Threshold heart rate goal to complete the workout step - once the user's heart rate reaches above below this value, the step will be completed","nullable":true}}},"HRBelowPlannedWorkoutStepDuration":{"type":"object","properties":{"hr_below_bpm":{"type":"integer","description":"Threshold heart rate goal to complete the workout step - once the user's heart rate reaches below this value, the step will be completed","nullable":true},"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"RepsPlannedWorkoutStepDuration":{"type":"object","properties":{"reps":{"type":"integer","description":"Target number of reps for the workout step - once the user completes this rep target, the step will be completed","nullable":true},"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"DistancePlannedWorkoutStepDuration":{"type":"object","properties":{"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]},"distance_meters":{"type":"integer","description":"Target distance for the workout step - once the user covers this distance, the step will be completed","nullable":true}}},"StepsPlannedWorkoutStepDuration":{"type":"object","properties":{"steps":{"type":"integer","description":"Target number of steps for the workout step - once the user performs this number of steps, the step will be completed","nullable":true},"duration_type":{"description":"Type of condition that must be fulfilled to consider the workout step complete","nullable":false,"type":"string","enum":["TIME","DISTANCE_METERS","HR_LESS_THAN","HR_GREATER_THAN","CALORIES","OPEN","POWER_LESS_THAN","POWER_GREATER_THAN","REPETITION_TIME","REPS","FIXED_REST","TIME_AT_VALID_CDA","STEPS"]}}},"PlannedWorkoutRepeatStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"steps":{"type":"array","description":"List of steps to be repeated for this workout step - e.g. if a user wants to schedule 5 repetitions of 100m sprints plus 20s rest in between","items":{"$ref":"#/components/schemas/PlannedWorkoutStep"}},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"name":{"type":"string","description":"Name of workout step","nullable":true}}},"SwimmingPlannedWorkoutStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"equipment_type":{"description":"Workout equipment to be used during the workout step","nullable":false,"type":"string","enum":["NONE","SWIM_FINS","SWIM_KICKBOARD","SWIM_PADDLES","SWIM_PULL_BUOY","SWIM_SNORKEL"]},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"name":{"type":"string","description":"Name of workout step","nullable":true},"stroke_type":{"description":"Stroke type used for the workout step (e.g. breaststroke)","nullable":false,"type":"string","enum":["OTHER","FREESTYLE","BACKSTROKE","BREASTSTROKE","BUTTERFLY","REST"]}}},"CardioPlannedWorkoutStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"exercise_name":{"type":"string","description":"Name of exercise to be performed for the workout step","nullable":true},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"exercise_category":{"description":"Type of exercise to be performed for the workout step","nullable":false,"type":"string","enum":["UNKNOWN","BENCH_PRESS","CALF_RAISE","CARDIO","CARRY","CHOP","CORE","CRUNCH","CURL","DEADLIFT","FLYE","HIP_RAISE","HIP_STABILITY","HIP_SWING","HYPEREXTENSION","LATERAL_RAISE","LEG_CURL","LEG_RAISE","LUNGE","OLYMPIC_LIFT","PLANK","PLYO","PULL_UP","PUSH_UP","ROW","SHOULDER_PRESS","SHOULDER_STABILITY","SHRUG","SIT_UP","SQUAT","TOTAL_BODY","TRICEPS_EXTENSION","WARM_UP","RUN","BIKE","CARDIO_SENSORS"]},"name":{"type":"string","description":"Name of workout step","nullable":true}}},"StrengthPlannedWorkoutStep":{"type":"object","properties":{"weight_kg":{"type":"number","description":"Weight to be lifted for the exercise","nullable":true},"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"exercise_name":{"type":"string","description":"Name of strength exercise to be performed for the workout step","nullable":true},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"exercise_category":{"description":"Type of strength exercise to be performed for the workout step","nullable":false,"type":"string","enum":["UNKNOWN","BENCH_PRESS","CALF_RAISE","CARDIO","CARRY","CHOP","CORE","CRUNCH","CURL","DEADLIFT","FLYE","HIP_RAISE","HIP_STABILITY","HIP_SWING","HYPEREXTENSION","LATERAL_RAISE","LEG_CURL","LEG_RAISE","LUNGE","OLYMPIC_LIFT","PLANK","PLYO","PULL_UP","PUSH_UP","ROW","SHOULDER_PRESS","SHOULDER_STABILITY","SHRUG","SIT_UP","SQUAT","TOTAL_BODY","TRICEPS_EXTENSION","WARM_UP","RUN","BIKE","CARDIO_SENSORS"]},"name":{"type":"string","description":"Name of workout step","nullable":true}}},"YogaPlannedWorkoutStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"name":{"type":"string","description":"Name of workout step","nullable":true}}},"PilatesPlannedWorkoutStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"name":{"type":"string","description":"Name of workout step","nullable":true}}},"RunningPlannedWorkoutStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"name":{"type":"string","description":"Name of workout step","nullable":true}}},"CyclingPlannedWorkoutStep":{"type":"object","properties":{"targets":{"type":"array","description":"List of targets for the workout","items":{"$ref":"#/components/schemas/PlannedWorkoutStepTarget"}},"type":{"description":"Type of workout step - either repeat or one-off","nullable":false,"type":"string","enum":["STEP","REPEAT_STEP"]},"intensity":{"type":"integer","description":"Planned intensity for the workout step","nullable":true},"order":{"type":"integer","description":"Position of the workout step in the overall workout","nullable":true},"description":{"type":"string","description":"Description of workout step","nullable":true},"durations":{"type":"array","description":"List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed","items":{"$ref":"#/components/schemas/PlannedWorkoutStepDuration"}},"name":{"type":"string","description":"Name of workout step","nullable":true}}},"PlannedWorkoutMetadata":{"type":"object","properties":{"estimated_energy_kj":{"type":["number","null"],"description":"Estimated energy expenditure for the workout"},"estimated_speed_meters_per_second":{"type":["number","null"],"description":"Estimated speed for the workout"},"estimated_elevation_gain_meters":{"type":["number","null"],"description":"Estimated elevation gain for the workout"},"estimated_tss":{"type":["number","null"],"description":"Estimated Training Stress Score for the workout"},"estimated_calories":{"type":["integer","null"],"description":"Estimated calorie burn for the workout"},"created_date":{"type":["string","null"],"description":"The creation datetime of the associated workout, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time","format":"date-time"},"planned_date":{"type":"string","description":"The planned start datetime, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time","format":"date-time","nullable":true},"type":{"description":"The name - either user-entered or given by the fitness data provider - of the associated workout plan","nullable":false,"type":"string","enum":["IN_VEHICLE","BIKING","STILL","UNKNOWN","TILTING","WALKING","RUNNING","AEROBICS","BADMINTON","BASEBALL","BASKETBALL","BIATHLON","HANDBIKING","MOUNTAIN_BIKING","ROAD_BIKING","SPINNING","STATIONARY_BIKING","UTILITY_BIKING","BOXING","CALISTHENICS","CIRCUIT_TRAINING","CRICKET","DANCING","ELLIPTICAL","FENCING","AMERICAN_FOOTBALL","AUSTRALIAN_FOOTBALL","ENGLISH_FOOTBALL","FRISBEE","GARDENING","GOLF","GYMNASTICS","HANDBALL","HIKING","HOCKEY","HORSEBACK_RIDING","HOUSEWORK","JUMPING_ROPE","KAYAKING","KETTLEBELL_TRAINING","KICKBOXING","KITESURFING","MARTIAL_ARTS","MEDITATION","MIXED_MARTIAL_ARTS","P90X_EXERCISES","PARAGLIDING","PILATES","POLO","RACQUETBALL","ROCK_CLIMBING","ROWING","ROWING_MACHINE","RUGBY","JOGGING","RUNNING_ON_SAND","TREADMILL_RUNNING","SAILING","SCUBA_DIVING","SKATEBOARDING","SKATING","CROSS_SKATING","INDOOR_ROLLERBLADING","SKIING","BACK_COUNTRY_SKIING","CROSS_COUNTRY_SKIING","DOWNHILL_SKIING","KITE_SKIING","ROLLER_SKIING","SLEDDING","SNOWBOARDING","SNOWMOBILE","SNOWSHOEING","SQUASH","STAIR_CLIMBING","STAIR_CLIMBING_MACHINE","STAND_UP_PADDLEBOARDING","STRENGTH_TRAINING","SURFING","SWIMMING","SWIMMING_SWIMMING_POOL","SWIMMING_OPEN_WATER","TABLE_TENNIS","TEAM_SPORTS","TENNIS","TREADMILL","VOLLEYBALL","VOLLEYBALL_BEACH","VOLLEYBALL_INDOOR","WAKEBOARDING","WALKING_FITNESS","NORDIC_WALKING","WALKING_TREADMILL","WATERPOLO","WEIGHTLIFTING","WHEELCHAIR","WINDSURFING","YOGA","ZUMBA","DIVING","ERGOMETER","ICE_SKATING","INDOOR_SKATING","CURLING","OTHER","CROSSFIT","HIIT","INTERVAL_TRAINING","WALKING_STROLLER","ELEVATOR","ESCALATOR","ARCHERY","SOFTBALL","GUIDED_BREATHING","CARDIO_TRAINING","LACROSSE","STRETCHING","TRIATHLON","INLINE_SKATING","SKY_DIVING","PADDLING","MOUNTAINEERING","FISHING","WATER_SKIING","INDOOR_RUNNING"]},"id":{"type":["string","null"],"default":null},"estimated_duration_seconds":{"type":["integer","null"],"description":"Estimated workout duration"},"estimated_pace_minutes_per_kilometer":{"type":["number","null"],"description":"Estimated pace for the workout"},"provider":{"type":"string","description":"Name of the original source of the workout plan"},"estimated_tscore":{"type":["number","null"],"description":"Estimated training stress score for the workout (normalized power-based metric)"},"description":{"type":["string","null"],"description":"Description of the workout"},"name":{"type":["string","null"],"description":"Name of the workout plan"},"estimated_distance_meters":{"type":["integer","null"],"description":"Estimated distance for the workout"},"estimated_if":{"type":["number","null"],"description":"Estimated Intensity Factor for the workout"},"pool_length_meters":{"type":["integer","null"],"description":"Pool length of the pool used for the workout - only relevant for swimming activity types"}}},"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]}}},"paths":{"/plannedWorkout":{"post":{"tags":["PlannedWorkout"],"operationId":"PlannedWorkout_Write","description":"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)","summary":"Post workout plans to a provider","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (UUID format) to retrieve data for","schema":{"type":"string"},"required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"description":"PlannedWorkout entry to post to data provider","type":"array","items":{"$ref":"#/components/schemas/PlannedWorkout"}}},"required":["data"]}}},"required":true},"responses":{"201":{"description":"Returned when activity was successfully created on the provider","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"log_ids":{"description":"List of identifiers for the objects created, returned in the same order they were posted. I.e. Posting [ObjectA, ObjectB] will return [IdentifierA, IdentifierB]","type":"array","items":{"type":"string"}},"message":{"type":"string","default":"Planned workout successfully created"}}}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Delete nutrition logs for a given user ID

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]}}},"paths":{"/nutrition":{"delete":{"tags":["Nutrition"],"operationId":"Nutrition_Delete","description":"Used to delete nutrition logs the user has registered on their account","summary":"Delete nutrition logs for a given user ID","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (UUID format) to retrieve data for","schema":{"type":"string"},"required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","description":"List of identifiers for nutrition entries to be deleted","items":{"type":"string"},"required":["data"]}}}}},"required":true},"responses":{"200":{"description":"Returned when all records were deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"processed_data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Identifier of the nutrition log whose deletion was attempted"},"response_code":{"type":"integer","description":"Response code from the provider when attempting to delete the nutrition log"}}}}}}}}},"207":{"description":"Returned when multiple status codes were obtained from attempting to delete the requested records","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"processed_data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Identifier of the nutrition log whose deletion was attempted"},"response_code":{"type":"integer","description":"Response code from the provider when attempting to delete the nutrition log"}}}}}}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"401":{"description":"Returned when credentials (dev ID and API key) are invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"An error message","type":"string"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"enum":["success","error"],"type":"string","description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Delete body metrics for a given user ID

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]}}},"paths":{"/body":{"delete":{"tags":["Body"],"operationId":"Body_Delete","description":"Used to delete Body metrics the user has registered on their account","summary":"Delete body metrics for a given user ID","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (UUID format) to retrieve data for","schema":{"type":"string"},"required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"log_ids":{"type":"array","description":"List of identifiers for body metrics entries to be deleted","items":{"type":"string"},"required":["data"]}}}}},"required":true},"responses":{"200":{"description":"Returned when all records were deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"processed_data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Identifier of the body metric entries whose deletion was attempted"},"response_code":{"type":"integer","description":"Response code from the provider when attempting to delete the body metric entries"}}}}}}}}},"207":{"description":"Returned when multiple status codes were obtained from attempting to delete the requested records","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"processed_data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Identifier of the body metric entry whose deletion was attempted"},"response_code":{"type":"integer","description":"Response code from the provider when attempting to delete the body metric entry"}}}}}}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"401":{"description":"Returned when credentials (dev ID and API key) are invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"An error message","type":"string"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```

## Delete workout plans for a given user ID

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

```json
{"openapi":"3.1.0","info":{"title":"TerraAPI","version":"2022.03.16"},"servers":[{"url":"https://api.tryterra.co/v2"}],"security":[{"ApiKeyAuth":[]},{"DevID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your API key for authentication"},"DevID":{"type":"apiKey","in":"header","name":"dev-id","description":"Your developer ID for authentication and tracking"}},"schemas":{"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml","type":"object","properties":{"user_id":{"type":"string","minLength":1,"description":"Terra identifier for the wearable connection"},"provider":{"type":"string","minLength":1,"description":"Connection data source"},"last_webhook_update":{"type":"string","description":"Last time at which a webhook update was sent for the connection"},"scopes":{"type":"string","description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"type":"string","description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"type":"boolean","description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]}}},"paths":{"/plannedWorkout":{"delete":{"tags":["PlannedWorkout"],"operationId":"PlannedWorkout_Delete","description":"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)","summary":"Delete workout plans for a given user ID","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (UUID format) to retrieve data for","schema":{"type":"string"},"required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","description":"List of identifiers for planned workout entries to be deleted","items":{"type":"string"},"required":["data"]}}}}},"required":true},"responses":{"200":{"description":"Returned when all records were deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"processed_data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Identifier of the planned workout whose deletion was attempted"},"response_code":{"type":"integer","description":"Response code from the provider when attempting to delete the planned workout"}}}}}}}}},"207":{"description":"Returned when multiple status codes were obtained from attempting to delete the requested records","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/TerraUser"},"processed_data":{"type":"object","properties":{"id":{"type":"string","description":"Identifier of the planned workout whose deletion was attempted"},"response_code":{"type":"integer","description":"Response code from the provider when attempting to delete the planned workout"}}}}}}}},"400":{"description":"Returned when one or more parameters is malformed - an appropriate error message will be returned","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}},"401":{"description":"Returned when authorization with a data provider has failed","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"enum":["success","error"],"type":"string","description":"indicates that an error happened (value is error)"}}}}}},"404":{"description":"Returned when a parameter does not exist on Terra's end (e.g. user_id)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"a detailed message describing the error","type":"string"},"status":{"type":"string","enum":["error"],"description":"indicates that an error happened (value is error)"}}}}}}}}}}}
```
