> For the complete documentation index, see [llms.txt](https://docs.tryterra.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tryterra.co/reference/health-and-fitness-api/health-data.md).

# Health data

Read a user's activity, athlete profile, body, daily, menstruation, nutrition and sleep data over a date range.

## Retrieve activity data

> Returns a user's completed workout sessions in a date range, each with a start and end time and an activity type such as running or cycling.\
> \
> \- A range longer than one month is delivered in chunks, announced by \`large\_request\_processing\` and \`large\_request\_sending\` events.\
> \- Returns \`404\` if the user's provider does not offer this data type, and \`400\` if your environment does not collect it.

```json
{"openapi":"3.2.0","info":{"title":"Terra API","version":"2026.11.19"},"tags":[{"name":"HealthData","summary":"Health data","description":"Read a user's activity, athlete profile, body, daily, menstruation, nutrition and sleep data over a date range."}],"servers":[{"url":"https://access.tryterra.co/api/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","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"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Time at which the connection was created"},"last_webhook_update":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last time at which a webhook update was sent for the connection"},"scopes":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"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","type":"object","properties":{"active_durations_data":{"anyOf":[{"$ref":"#/components/schemas/ActiveDurationsData"},{"type":"null"}],"description":"Number of minutes spent at various intensities during the workout, as reported by the Fitness Data provider."},"calories_data":{"anyOf":[{"$ref":"#/components/schemas/CaloriesData"},{"type":"null"}],"description":"Object containing calorie-related information for the user during the specific workout."},"cheat_detection":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Cheat detection flag."},"data_enrichment":{"anyOf":[{"$ref":"#/components/schemas/DataEnrichment"},{"type":"null"}],"description":"Object containing Terra Scores."},"device_data":{"anyOf":[{"$ref":"#/components/schemas/DeviceData"},{"type":"null"}],"description":"Object containing information on the device which recorded the specific workout."},"distance_data":{"anyOf":[{"$ref":"#/components/schemas/DistanceData"},{"type":"null"}],"description":"Object containing information related to distance covered during the associated workout."},"energy_data":{"anyOf":[{"$ref":"#/components/schemas/EnergyData"},{"type":"null"}],"description":"Object containing information on the energy expended by the user during the workout."},"heart_rate_data":{"anyOf":[{"$ref":"#/components/schemas/HeartRateData"},{"type":"null"}],"description":"Object containing heartrate-related information for the workout."},"lap_data":{"anyOf":[{"$ref":"#/components/schemas/LapData"},{"type":"null"}],"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":{"anyOf":[{"$ref":"#/components/schemas/METData"},{"type":"null"}],"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":{"anyOf":[{"$ref":"#/components/schemas/MovementData"},{"type":"null"}],"description":"Object containing information on the user's movement throughout the workout."},"oxygen_data":{"anyOf":[{"$ref":"#/components/schemas/OxygenData"},{"type":"null"}],"description":"Object containing information on oxygen-related metrics for the workout."},"polyline_map_data":{"anyOf":[{"$ref":"#/components/schemas/PolylineMapData"},{"type":"null"}],"description":"Object containing polyline-representation map data, plotting the user's trajectory throughout the workout."},"position_data":{"anyOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"null"}],"description":"Object containing information on the user's position throughout the workout."},"strength_data":{"anyOf":[{"$ref":"#/components/schemas/ActivityStrengthData"},{"type":"null"}],"description":"Object containing the sets, reps and load performed during a strength workout. Absent when the activity carries no strength content, or when the source recorded no usable set breakdown."},"power_data":{"anyOf":[{"$ref":"#/components/schemas/PowerData"},{"type":"null"}],"description":"Object containing information on the power generated by the user during the workout."},"strain_data":{"anyOf":[{"$ref":"#/components/schemas/StrainData"},{"type":"null"}],"description":"Object containing information on the cardiovascular strain imposed on the user during the workout."},"TSS_data":{"anyOf":[{"$ref":"#/components/schemas/TSSData"},{"type":"null"}],"description":"Object containing information on the stress put on the user's body from a workout."},"work_data":{"anyOf":[{"$ref":"#/components/schemas/WorkData"},{"type":"null"}],"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","type":"object","properties":{"activity_levels_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ActivityLevelSample"}},{"type":"null"}],"description":"Array of detailed samples of the intensity the user was in at various points during the workout."},"activity_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in an active state during the workout."},"inactivity_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in an inactive state during the workout."},"low_intensity_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in a low intensity state during the workout."},"moderate_intensity_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in a moderate intensity state during the workout."},"num_continuous_inactive_periods":{"anyOf":[{"type":"integer"},{"type":"null"}],"minimum":0,"description":"Maximum number of continuous periods spent in an inactive state during the workout."},"rest_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent resting during the workout."},"vigorous_intensity_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in a state of vigorous intensity during the workout."},"standing_hours_count":{"anyOf":[{"type":"number"},{"type":"null"}]},"standing_seconds":{"anyOf":[{"type":"number"},{"type":"null"}]}}},"ActivityLevelSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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."},"activity_level":{"anyOf":[{"$ref":"#/components/schemas/ActivityLevel"},{"type":"null"}],"description":"The user's activity level for the sample."},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Duration the activity-level timer has been running, in seconds."}}},"ActivityLevel":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"BMR_calories":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Basal Metabolic Rate calories - calories burned at rest."},"calorie_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/CalorieSample"}},{"type":"null"}],"description":"Array of calorie data samples recorded throughout the time period."},"net_activity_calories":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Net calories burned through activity (excluding BMR)."},"net_intake_calories":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Net calories consumed through food and drink intake."},"total_burned_calories":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total calories burned including BMR and activity."}}},"CalorieSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Number of calories burned at the given timestamp."},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"efficiency_score":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Efficiency score for the workout."},"efficiency_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"Map of contributing factor name to its weighted contribution to the efficiency score."},"strain_score":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Strain score for the workout."},"strain_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"Map of contributing factor name to its weighted contribution to the strain score."},"rcrs_score":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Recovery-corrected relative strain (RCRS) score for the workout."},"rcrs_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"Map of contributing factor name to its weighted contribution to the RCRS score."},"trimp_score":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Training impulse (TRIMP) score for the workout."},"trimp_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"Map of contributing factor name to its weighted contribution to the TRIMP score."},"vo2max":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Estimated VO2max for the workout, in ml/kg/min. Absent when the workout gave too little reliable data."},"vo2max_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"The heart-rate anchors behind the VO2max estimate, in bpm: hr_max and hr_rest."},"vo2max_traffic_light":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Confidence in the VO2max estimate: GREEN (reliable) or AMBER (treat as an estimate)."},"vo2max_method":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"How the VO2max was estimated: RUN (pace and gradient) or RIDE (power-meter power and body weight)."},"vo2max_reasons":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Why the VO2max confidence is not GREEN, or which input was a stand-in: HR_MAX_ESTIMATED, NO_NEAR_MAX_EFFORT, LIMITED_SAMPLES, RESTING_HR_NOT_MEASURED."}},"$defs":{"RecordFloat":{"type":"object","properties":{},"unevaluatedProperties":{"type":"number"}}}},"RecordFloat":{"type":"object","properties":{},"unevaluatedProperties":{"type":"number"}},"DeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"activation_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Activation timestamp of the device, if applicable."},"data_provided":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"}},{"type":"null"}],"description":"Data provided by the device, as enumerated types."},"hardware_version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Hardware version of the device."},"last_upload_date":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last upload date from the device."},"manufacturer":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device manufacturer name."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/OtherDeviceData"}},{"type":"null"}],"description":"Data pertaining to other devices which may have contributed data for this workout."},"serial_number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Serial Number."},"software_version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Software Version."}}},"DeviceDataType":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"manufacturer":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device manufacturer name."},"hardware_version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Hardware version of the device."},"serial_number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Serial Number."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Software Version."},"data_provided":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"}},{"type":"null"}],"description":"Data provided by the device, as enumerated types."},"last_upload_date":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last upload date from the device."}}},"DistanceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"detailed":{"anyOf":[{"$ref":"#/components/schemas/DistanceDataDetailed"},{"type":"null"}],"description":"Object containing detailed distance information - this may included second-by-second samples."},"summary":{"anyOf":[{"$ref":"#/components/schemas/DistanceDataSummary"},{"type":"null"}],"description":"Object containing summary information related to distance covered throughout the workout."}}},"DistanceDataDetailed":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"distance_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/DistanceSample"}},{"type":"null"}],"description":"Array of detailed samples of distance covered throughout the workout."},"elevation_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ElevationSample"}},{"type":"null"}],"description":"Array of detailed samples of elevation throughout the workout."},"floors_climbed_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/FloorsClimbedSample"}},{"type":"null"}],"description":"Array of detailed samples of floors climbed throughout the workout, as determined by the fitness data provider."},"step_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/StepSample"}},{"type":"null"}],"description":"Array of detailed samples of steps performed throughout the workout."}}},"DistanceSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Cumulative distance covered up to associated timestamp, since the start of the payload"},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's altitude at a given point in time, in meters above sea level."},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Cumulative number of elevation gain measured in floors climbed up to associated timestamp, since the start of the payload"},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Cumulative number of steps taken up to associated timestamp, since the start of the payload"},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"distance_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total distance covered by the user throughout the workout."},"elevation":{"anyOf":[{"$ref":"#/components/schemas/ElevationData"},{"type":"null"}],"description":"Object containing information on the elevation of the user throughout the workout."},"floors_climbed":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Total number of elevation gain in floors climbed equivalent throughout the workout, as determined by the fitness data provider."},"steps":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Total number of steps performed during the workout."},"swimming":{"anyOf":[{"$ref":"#/components/schemas/SwimmingData"},{"type":"null"}],"description":"Summary information of the user's swimming statistics for the workout, if applicable."}}},"ElevationData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"avg_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average elevation of the user throughout the workout."},"gain_actual_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Planned elevation gain for the workout."},"loss_actual_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Elevation loss of the user throughout the workout."},"max_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Maximum elevation of the user during the workout."},"min_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Minimum elevation of the user during the workout."}}},"SwimmingData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"num_laps":{"anyOf":[{"type":"integer"},{"type":"null"}],"minimum":0,"description":"Total number of swimming laps performed during the day."},"num_strokes":{"anyOf":[{"type":"integer"},{"type":"null"}],"minimum":0,"description":"Total number of swimming strokes performed during the day."},"pool_length_meters":{"anyOf":[{"type":"integer"},{"type":"null"}],"minimum":0,"description":"Pool length for associated with the day."}}},"EnergyData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"energy_kilojoules":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total number of kiloJoules expended during the workout"},"energy_planned_kilojoules":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"detailed":{"anyOf":[{"$ref":"#/components/schemas/HeartRateDataDetailed"},{"type":"null"}],"description":"Object containing detailed heart rate information for the associated workout."},"summary":{"anyOf":[{"$ref":"#/components/schemas/HeartRateDataSummary"},{"type":"null"}],"description":"Object containing summary heart rate information for the associated workout."}}},"HeartRateDataDetailed":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"hr_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateDataSample"}},{"type":"null"}],"description":"Array of HeartRate data samples recorded for the user during the workout."},"hrv_samples_rmssd":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleRMSSD"}},{"type":"null"}],"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using RMSSD."},"hrv_samples_sdnn":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleSDNN"}},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's heart rate in bpm"},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"},"context":{"anyOf":[{"$ref":"#/components/schemas/HeartRateContext"},{"type":"null"}],"description":"Represents the context in which heart rate was measured."}}},"HeartRateContext":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's Heart Rate Variability, computed using RMSSD"}}},"HeartRateVariabilityDataSampleSDNN":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's Heart Rate Variability, computed using SDNN"}}},"HeartRateDataSummary":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"avg_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Average HeartRate of the user during the workout."},"avg_hrv_rmssd":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average HeartRate Variability of the user during the workout, computed using RMSSD."},"avg_hrv_sdnn":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average HeartRate Variability of the user during the workout, computed using SDNN."},"hr_zone_data":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateZoneData"}},{"type":"null"}],"description":"Array of time spent in various HR zones throughout the workout."},"max_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Maximum HeartRate of the user during the workout."},"min_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Minimum HeartRate of the user during the workout."},"resting_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Resting HeartRate of the user, as determined by the fitness data provider."},"user_max_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"zone":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Heart rate zone designation, as a zero-based zone index."},"start_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"maximum":100,"description":"Start percentage (based off user's max HR) of the HR zone"},"end_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"maximum":100,"description":"End percentage (based off user's max HR) of the HR zone"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Name of the associated heart rate zone"},"duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Duration spent in the heart rate zone"}}},"LapData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"laps":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/LapSample"}},{"type":"null"}],"description":"Array of datapoints for each lap performed by the user during the workout."}}},"LapSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"calories":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Calories burned during the lap"},"avg_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average heart rate in bpm, for the Lap sample"},"start_time":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average speed of the user during the lap"},"distance_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Distance covered during the lap"},"total_strokes":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Total strokes performed during the lap - only relevant for swimming activities"},"end_time":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Stroke type - only relevant for swimming activities"},"avg_watts":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average power output during the lap, in watts."},"active_duration_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Active duration of the lap, in seconds."},"trigger_method":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"What caused the lap to be recorded, where the device reports it: one of MANUAL, TIME, DISTANCE, POSITION_START, POSITION_LAP, POSITION_WAYPOINT, POSITION_MARKED, SESSION_END, FITNESS_EQUIPMENT, or UNSPECIFIED where the device reported a trigger we do not recognise. Devices commonly record automatic splits (DISTANCE, TIME) in the same activity as the laps the athlete pressed for (MANUAL), so filter on this to isolate one stream rather than treating every lap as equivalent. Null for providers that do not report a lap trigger."}}},"METData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"MET_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/METSample"}},{"type":"null"}],"description":"An array of Metabolic Equivalent Time samples, as calculated by the user's wearable."},"avg_level":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The average MET level of the activity."},"num_high_intensity_minutes":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Number of minutes spent in High Intensity during the workout - based off MET scale."},"num_inactive_minutes":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Number of minutes spent in state of Inactivity during the workout - based off MET scale."},"num_low_intensity_minutes":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Number of minutes spent in Low Intensity during the workout - based off MET scale."},"num_moderate_intensity_minutes":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Metabolic Equivalent of Task (MET) level at the given timestamp"}}},"ActivityMetadata":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"city":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The City in which the workout was performed."},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"$ref":"#/components/schemas/TimestampLocalization"},{"type":"null"}]},"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","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","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"},{"type":"number","const":149,"description":"Activity type for running on off-road or natural terrain trails.","title":"Trail Running"},{"type":"number","const":150,"description":"Activity type for cycling on gravel or mixed-surface roads.","title":"Gravel Cycling"},{"type":"number","const":151,"description":"Activity type for a multisport session combining more than one discipline.","title":"Multisport"},{"type":"number","const":152,"description":"Activity type for riding an electrically assisted bicycle.","title":"E-Biking"},{"type":"number","const":153,"description":"Activity type for riding an electrically assisted mountain bike.","title":"E-Mountain Biking"},{"type":"number","const":154,"description":"Activity type for a physical therapy or rehabilitation session.","title":"Physical Therapy"}],"description":"The type of activity performed for the associated workout."},"UploadType":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"adjusted_max_speed_meters_per_second":{"anyOf":[{"type":"number"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average cadence of the user during the workout, in RPM."},"avg_pace_minutes_per_kilometer":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average pace of the user during the workout."},"avg_speed_meters_per_second":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average speed of the user during the workout."},"avg_torque_newton_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average torque generated by the user during the workout - mainly relevant for cycling activities."},"avg_velocity_meters_per_second":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average velocity of the user during the workout - only calculated by certain providers, representing a separate quantity from speed."},"cadence_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/CadenceSample"}},{"type":"null"}],"description":"Array of cadence values recorded throughout the workout, sampled at intervals determined by the fitness data provider."},"max_cadence_rpm":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Maximum cadence of the user during the workout - mainly relevant for cycling activities."},"max_pace_minutes_per_kilometer":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Maximum pace of the user during the workout."},"max_speed_meters_per_second":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Maximum speed of the user during the workout."},"max_torque_newton_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Maximum torque generated by the user during the workout - mainly relevant for cycling activities."},"max_velocity_meters_per_second":{"anyOf":[{"type":"number"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average normalized speed of the user during the workout - only calculated by certain providers, representing a separate quantity from speed."},"speed_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/SpeedSample"}},{"type":"null"}],"description":"Array of the datapoints for the user's speed sampled throughout the workout."},"torque_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/TorqueSample"}},{"type":"null"}],"description":"Array of the datapoints for the user's torque sampled throughout the workout."}}},"CadenceSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's cadence at a given instant in time, in revolutions per minute"},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Speed of the user at a given instant in time, in meters per second"},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"},"torque_newton_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Torque generated at a given instant in time, in Newton-meters"}}},"OxygenData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"avg_saturation_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average Oxygen Saturation percentage of the user during the day (SpO2 or SmO2)."},"saturation_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/OxygenSaturationSample"}},{"type":"null"}],"description":"Array of Oxygen Saturation percentage datapoints sampled throughout the day."},"vo2_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/Vo2MaxSample"}},{"type":"null"}],"description":"Array of VO2 datapoints sampled throughout the day."},"vo2max_ml_per_min_per_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"VO2Max for the given user."},"day_avg_vo2max_ml_per_min_per_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average VO2 max, in millilitres per minute per kilogram."}}},"OxygenSaturationSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's oxygen saturation percentage - referring to either SpO2 or SmO2, based on the `type` field"},"type":{"anyOf":[{"$ref":"#/components/schemas/OxygenSaturationType"},{"type":"null"}],"description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"}}},"OxygenSaturationType":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"summary_polyline":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The polyline representation of the user's trajectory throughout the workout"}}},"PositionData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"center_pos_lat_lng_deg":{"anyOf":[{"type":"array","items":{"type":"number"}},{"type":"null"}],"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":{"anyOf":[{"type":"array","items":{"type":"number"}},{"type":"null"}],"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":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/PositionSample"}},{"type":"null"}],"description":"Array of datapoints of the position of the user, sampled throughout the workout."},"start_pos_lat_lng_deg":{"anyOf":[{"type":"array","items":{"type":"number"}},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"array","prefixItems":[{"type":"number"},{"type":"number"}]},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"}}},"ActivityStrengthData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"body_weight_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The user's bodyweight at the time of the workout, when the source records it. Needed to value bodyweight-based sets, and frequently absent."},"exercises":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/StrengthExercise"}},{"type":"null"}],"description":"The exercises performed, in the order they were started."}}},"StrengthExercise":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"exercise_name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The source's own label for the exercise, passed through verbatim. Present whenever the source names the exercise, whether or not it resolved to a movement. Intended for display."},"movements":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/StrengthMovement"}},{"type":"null"}],"description":"The joint actions performed, in the order one repetition performs them, with implement, grip, stance, tempo and position all carried in modifiers. Usually one; a clean and jerk is [clean, jerk]. This is the rollup axis, and membership is what to test: a clean and jerk belongs in both clean volume and jerk volume, so ask whether movements contains the value rather than equals it. Open enum — handle unknown values gracefully. Empty when the exercise could not be resolved, in which case exercise_name still says what the source called it."},"target":{"anyOf":[{"$ref":"#/components/schemas/StrengthTarget"},{"type":"null"}],"description":"The body part a stretch or mobility drill targets."},"modifiers":{"anyOf":[{"$ref":"#/components/schemas/StrengthExerciseModifiers"},{"type":"null"}],"description":"The axes that qualify the exercise. An axis that is absent was not reported by the source — it does NOT mean a default applies, so a squat with no implement is not the same as a bodyweight squat. Axes describe the exercise as performed rather than each movement separately: in a step up to a deficit reverse lunge only the lunge is at a deficit, but the axis describes the whole exercise and exercise_name carries the detail."},"primary_muscles":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/StrengthMuscle"}},{"type":"null"}],"description":"The muscles the exercise primarily works, as reported by the source. A list because providers differ: some name exactly one, some name several for the same exercise, and some name none. Empty means the source did not say, not that no muscle is worked. Open enum — handle unknown values gracefully."},"secondary_muscles":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/StrengthMuscle"}},{"type":"null"}],"description":"The muscles the exercise works without being the focus, as reported by the source. Kept apart from primary_muscles because the distinction drives recovery and volume-per-muscle, which merging the two would lose. Empty means the source did not say. Open enum — handle unknown values gracefully."},"group_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Exercises sharing a value were performed together, as a superset or circuit. Unique within this activity only."},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The user's note on the exercise."},"rpe":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Effort for the exercise as a whole, on a 0-10 scale, when the source records it once per exercise rather than per set."},"source":{"anyOf":[{"$ref":"#/components/schemas/StrengthSource"},{"type":"null"}],"description":"Where the exercise came from. Open enum — handle unknown values gracefully; the values in use today are user_logged, device_detected and unknown. Only user_logged is user-confirmed. Test for user_logged rather than testing against device_detected, so that a value added later is not trusted by default: anything that is not user_logged may have been inferred by a wearable and may be wrong, rep counts included."},"sets":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/StrengthSet"}},{"type":"null"}],"description":"The performed sets, in order."}}},"StrengthMovement":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"ab_rollout"},{"type":"string","const":"arm_circle"},{"type":"string","const":"around_the_world"},{"type":"string","const":"back_extension"},{"type":"string","const":"battle_rope_slam"},{"type":"string","const":"battle_rope_wave"},{"type":"string","const":"bear_crawl"},{"type":"string","const":"bicep_curl"},{"type":"string","const":"bicycle_crunch"},{"type":"string","const":"bike"},{"type":"string","const":"bird_dog"},{"type":"string","const":"body_saw"},{"type":"string","const":"bound"},{"type":"string","const":"box_jump"},{"type":"string","const":"broad_jump"},{"type":"string","const":"burpee"},{"type":"string","const":"butt_kick"},{"type":"string","const":"butt_scoot"},{"type":"string","const":"calf_raise"},{"type":"string","const":"carioca"},{"type":"string","const":"carry"},{"type":"string","const":"chest_fly"},{"type":"string","const":"chest_press"},{"type":"string","const":"chin_up"},{"type":"string","const":"clamshell"},{"type":"string","const":"clean"},{"type":"string","const":"clean_pull"},{"type":"string","const":"climb"},{"type":"string","const":"complex"},{"type":"string","const":"cossack_squat"},{"type":"string","const":"crunch"},{"type":"string","const":"dead_bug"},{"type":"string","const":"deadlift"},{"type":"string","const":"depth_jump"},{"type":"string","const":"diaphragmatic_breathing"},{"type":"string","const":"dip"},{"type":"string","const":"duck_walk"},{"type":"string","const":"elliptical"},{"type":"string","const":"face_pull"},{"type":"string","const":"farmers_carry"},{"type":"string","const":"fire_hydrant"},{"type":"string","const":"flutter_kick"},{"type":"string","const":"foam_roll"},{"type":"string","const":"frog_kick"},{"type":"string","const":"front_raise"},{"type":"string","const":"glute_bridge"},{"type":"string","const":"glute_ham_raise"},{"type":"string","const":"good_morning"},{"type":"string","const":"halo"},{"type":"string","const":"hand_walk"},{"type":"string","const":"handstand_hold"},{"type":"string","const":"handstand_push_up"},{"type":"string","const":"handstand_walk"},{"type":"string","const":"heel_slide"},{"type":"string","const":"heel_touch"},{"type":"string","const":"high_knee"},{"type":"string","const":"high_pull"},{"type":"string","const":"hike"},{"type":"string","const":"hip_abduction"},{"type":"string","const":"hip_adduction"},{"type":"string","const":"hip_circle"},{"type":"string","const":"hip_drop"},{"type":"string","const":"hip_extension"},{"type":"string","const":"hip_flexion"},{"type":"string","const":"hip_hinge"},{"type":"string","const":"hip_thrust"},{"type":"string","const":"hold"},{"type":"string","const":"hollow_hold"},{"type":"string","const":"hop"},{"type":"string","const":"i_raise"},{"type":"string","const":"inchworm"},{"type":"string","const":"jerk"},{"type":"string","const":"jump"},{"type":"string","const":"jump_rope"},{"type":"string","const":"jumping_jack"},{"type":"string","const":"kick"},{"type":"string","const":"knee_raise"},{"type":"string","const":"kneel_to_stand"},{"type":"string","const":"l_sit"},{"type":"string","const":"lat_pulldown"},{"type":"string","const":"lateral_raise"},{"type":"string","const":"lateral_walk"},{"type":"string","const":"leg_circle"},{"type":"string","const":"leg_curl"},{"type":"string","const":"leg_cycle"},{"type":"string","const":"leg_extension"},{"type":"string","const":"leg_press"},{"type":"string","const":"leg_raise"},{"type":"string","const":"leg_swing"},{"type":"string","const":"lunge"},{"type":"string","const":"march"},{"type":"string","const":"monster_walk"},{"type":"string","const":"mountain_climber"},{"type":"string","const":"muscle_up"},{"type":"string","const":"neck_extension"},{"type":"string","const":"neck_flexion"},{"type":"string","const":"neck_lateral_flexion"},{"type":"string","const":"oblique_crunch"},{"type":"string","const":"overhead_press"},{"type":"string","const":"pallof_press"},{"type":"string","const":"pike_up"},{"type":"string","const":"plank"},{"type":"string","const":"plate_flip"},{"type":"string","const":"plate_pinch"},{"type":"string","const":"pull_apart"},{"type":"string","const":"pull_through"},{"type":"string","const":"pull_up"},{"type":"string","const":"pullover"},{"type":"string","const":"punch"},{"type":"string","const":"push_press"},{"type":"string","const":"push_up"},{"type":"string","const":"rear_delt_fly"},{"type":"string","const":"reverse_crunch"},{"type":"string","const":"reverse_hyperextension"},{"type":"string","const":"romanian_deadlift"},{"type":"string","const":"rope_climb"},{"type":"string","const":"row"},{"type":"string","const":"row_erg"},{"type":"string","const":"run"},{"type":"string","const":"russian_twist"},{"type":"string","const":"scapular_pull_up"},{"type":"string","const":"scapular_push_up"},{"type":"string","const":"scapular_retraction"},{"type":"string","const":"scissor_kick"},{"type":"string","const":"shoulder_external_rotation"},{"type":"string","const":"shoulder_internal_rotation"},{"type":"string","const":"shrug"},{"type":"string","const":"shuffle"},{"type":"string","const":"sissy_squat"},{"type":"string","const":"sit_up"},{"type":"string","const":"ski_erg"},{"type":"string","const":"skip"},{"type":"string","const":"slam"},{"type":"string","const":"sled_drag"},{"type":"string","const":"sled_push"},{"type":"string","const":"snatch"},{"type":"string","const":"snatch_balance"},{"type":"string","const":"snatch_pull"},{"type":"string","const":"squat"},{"type":"string","const":"stair_climb"},{"type":"string","const":"star_jump"},{"type":"string","const":"step_down"},{"type":"string","const":"step_over"},{"type":"string","const":"step_up"},{"type":"string","const":"stiff_legged_deadlift"},{"type":"string","const":"stomach_vacuum"},{"type":"string","const":"straight_arm_pulldown"},{"type":"string","const":"stretch"},{"type":"string","const":"superman"},{"type":"string","const":"swim"},{"type":"string","const":"swimmer"},{"type":"string","const":"swing"},{"type":"string","const":"t_raise"},{"type":"string","const":"throw"},{"type":"string","const":"thruster"},{"type":"string","const":"tibialis_raise"},{"type":"string","const":"tire_flip"},{"type":"string","const":"toe_tap"},{"type":"string","const":"toe_walk"},{"type":"string","const":"tricep_extension"},{"type":"string","const":"trunk_lateral_flexion"},{"type":"string","const":"trunk_rotation"},{"type":"string","const":"turkish_get_up"},{"type":"string","const":"upright_row"},{"type":"string","const":"v_sit"},{"type":"string","const":"v_up"},{"type":"string","const":"w_raise"},{"type":"string","const":"walk"},{"type":"string","const":"walkout"},{"type":"string","const":"windmill"},{"type":"string","const":"windshield_wiper"},{"type":"string","const":"wood_chop"},{"type":"string","const":"wrist_curl"},{"type":"string","const":"y_raise"},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"The joint action an exercise performs, stripped of implement, grip, stance, tempo and position. Terra's own vocabulary, not the source's wording. Open enum — handle unknown values gracefully."},"StrengthTarget":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"abs"},{"type":"string","const":"adductors"},{"type":"string","const":"ankle"},{"type":"string","const":"back"},{"type":"string","const":"biceps"},{"type":"string","const":"calves"},{"type":"string","const":"chest"},{"type":"string","const":"forearms"},{"type":"string","const":"glutes"},{"type":"string","const":"hamstrings"},{"type":"string","const":"hip"},{"type":"string","const":"hip_abductor"},{"type":"string","const":"hip_adductor"},{"type":"string","const":"hip_flexor"},{"type":"string","const":"lat"},{"type":"string","const":"lower_back"},{"type":"string","const":"neck"},{"type":"string","const":"obliques"},{"type":"string","const":"quadriceps"},{"type":"string","const":"shoulders"},{"type":"string","const":"spine"},{"type":"string","const":"thoracic_spine"},{"type":"string","const":"triceps"},{"type":"string","const":"upper_back"},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"The body part a stretch or mobility drill acts on. For a stretch the body part IS the exercise, which is why it is reported separately from the muscles worked. Open enum — handle unknown values gracefully."},"StrengthExerciseModifiers":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"implement":{"anyOf":[{"$ref":"#/components/schemas/StrengthImplement"},{"type":"null"}],"description":"What provides the load. Open enum — handle unknown values gracefully; the published vocabulary lists the values in use, and a value outside it must pass through rather than be rejected."},"surface":{"anyOf":[{"$ref":"#/components/schemas/StrengthSurface"},{"type":"null"}],"description":"What the body is supported on, when it is not the floor. Open enum."},"grip_width":{"anyOf":[{"$ref":"#/components/schemas/StrengthGripWidth"},{"type":"null"}],"description":"How far apart the hands are. Open enum."},"grip_orientation":{"anyOf":[{"$ref":"#/components/schemas/StrengthGripOrientation"},{"type":"null"}],"description":"Which way the hands face. Open enum. Separate from grip_width because the two combine — a close-grip underhand pulldown needs both."},"laterality":{"anyOf":[{"$ref":"#/components/schemas/StrengthLaterality"},{"type":"null"}],"description":"Whether both limbs work together, alternately, or one at a time. Open enum."},"stance":{"anyOf":[{"$ref":"#/components/schemas/StrengthStance"},{"type":"null"}],"description":"Foot arrangement. Open enum."},"position":{"anyOf":[{"$ref":"#/components/schemas/StrengthPosition"},{"type":"null"}],"description":"Orientation of the body or bench. Open enum."},"bar_position":{"anyOf":[{"$ref":"#/components/schemas/StrengthBarPosition"},{"type":"null"}],"description":"Where the implement is carried. Open enum."},"tempo":{"anyOf":[{"$ref":"#/components/schemas/StrengthTempo"},{"type":"null"}],"description":"How the repetition is paced. Open enum."},"rom":{"anyOf":[{"$ref":"#/components/schemas/StrengthRangeOfMotion"},{"type":"null"}],"description":"How much of the movement is performed, or where it starts. Open enum."},"accommodating_resistance":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Bands or chains added to another implement — not a second implement. The reported weight_kg is the bar alone, since band tension is not expressed in kg, so this also signals that the recorded load understates the real resistance. Open enum."},"assistance":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"What makes the movement easier and how: machine, band, partner, balance_support. Names the source of assistance, not the fact of it. Open enum."},"programme":{"anyOf":[{"$ref":"#/components/schemas/StrengthProgramme"},{"type":"null"}],"description":"A programme or population the variant belongs to. Describes context, not a different movement, so it does not distinguish one exercise from another. Open enum."}}},"StrengthImplement":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"band"},{"type":"string","const":"barbell"},{"type":"string","const":"battle_rope"},{"type":"string","const":"belt"},{"type":"string","const":"bodyweight"},{"type":"string","const":"cable"},{"type":"string","const":"dumbbell"},{"type":"string","const":"ez_bar"},{"type":"string","const":"handle_band"},{"type":"string","const":"kettlebell"},{"type":"string","const":"landmine"},{"type":"string","const":"loop_band"},{"type":"string","const":"machine"},{"type":"string","const":"machine_assisted"},{"type":"string","const":"medicine_ball"},{"type":"string","const":"mini_band"},{"type":"string","const":"partner"},{"type":"string","const":"pvc"},{"type":"string","const":"safety_bar"},{"type":"string","const":"sled"},{"type":"string","const":"smith_machine"},{"type":"string","const":"suspension"},{"type":"string","const":"trap_bar"},{"type":"string","const":"weight_plate"},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"What provides the load. Open enum — handle unknown values gracefully."},"StrengthSurface":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"bench"},{"type":"string","const":"bosu"},{"type":"string","const":"box"},{"type":"string","const":"floor"},{"type":"string","const":"foam_roller"},{"type":"string","const":"glute_ham_machine"},{"type":"string","const":"preacher_bench"},{"type":"string","const":"swiss_ball"},{"type":"string","const":"treadmill"},{"type":"string","const":"wall"},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"What the body is supported on, when it is not the floor. Open enum — handle unknown values gracefully."},"StrengthGripWidth":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"close"},{"type":"string","const":"wide"},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"How far apart the hands are. Open enum — handle unknown values gracefully."},"StrengthGripOrientation":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"bottoms_up"},{"type":"string","const":"mixed"},{"type":"string","const":"neutral"},{"type":"string","const":"overhand"},{"type":"string","const":"pinch"},{"type":"string","const":"reverse"},{"type":"string","const":"underhand"},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"Which way the hands face. Separate from grip_width because the two combine. Open enum — handle unknown values gracefully."},"StrengthLaterality":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"alternating"},{"type":"string","const":"bilateral"},{"type":"string","const":"unilateral"},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"Whether both limbs work together, alternately, or one at a time. Open enum — handle unknown values gracefully."},"StrengthStance":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"crossover"},{"type":"string","const":"curtsy"},{"type":"string","const":"split"},{"type":"string","const":"sumo"},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"Foot arrangement. Open enum — handle unknown values gracefully."},"StrengthPosition":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"bent_over"},{"type":"string","const":"decline"},{"type":"string","const":"elevated"},{"type":"string","const":"flat"},{"type":"string","const":"forearm"},{"type":"string","const":"half_kneeling"},{"type":"string","const":"hanging"},{"type":"string","const":"incline"},{"type":"string","const":"inverted"},{"type":"string","const":"kneeling"},{"type":"string","const":"lying"},{"type":"string","const":"pike"},{"type":"string","const":"prone"},{"type":"string","const":"quadruped"},{"type":"string","const":"seated"},{"type":"string","const":"side_lying"},{"type":"string","const":"standing"},{"type":"string","const":"supine"},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"Orientation of the body or bench. Open enum — handle unknown values gracefully."},"StrengthBarPosition":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"behind_back"},{"type":"string","const":"behind_neck"},{"type":"string","const":"front_rack"},{"type":"string","const":"goblet"},{"type":"string","const":"overhead"},{"type":"string","const":"zercher"},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"Where the implement is carried. Open enum — handle unknown values gracefully."},"StrengthTempo":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"eccentric"},{"type":"string","const":"explosive"},{"type":"string","const":"isometric"},{"type":"string","const":"kipping"},{"type":"string","const":"paused"},{"type":"string","const":"pulse"},{"type":"string","const":"tempo_slow"},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"How the repetition is paced. Open enum — handle unknown values gracefully."},"StrengthRangeOfMotion":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"deficit"},{"type":"string","const":"from_blocks"},{"type":"string","const":"from_hang"},{"type":"string","const":"full"},{"type":"string","const":"partial"},{"type":"string","const":"to_bench"},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"How much of the movement is performed, or where it starts. Open enum — handle unknown values gracefully."},"StrengthProgramme":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"pregnancy"},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"A programme or population the variant belongs to. Descriptive only — it changes neither the movement nor the load. Open enum — handle unknown values gracefully."},"StrengthMuscle":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"abductors"},{"type":"string","const":"abs"},{"type":"string","const":"adductors"},{"type":"string","const":"back","description":"The back without a part named. Where a source distinguishes the lats or the upper back, `lat` or `upper_back` is reported instead."},{"type":"string","const":"biceps"},{"type":"string","const":"calves"},{"type":"string","const":"chest"},{"type":"string","const":"forearms"},{"type":"string","const":"glutes"},{"type":"string","const":"hamstrings"},{"type":"string","const":"hip_flexor","description":"Iliopsoas and sartorius. Its own group — not part of the quadriceps."},{"type":"string","const":"lat","description":"Latissimus dorsi. Reported separately from `back` and `upper_back`: a pulldown and a row are different work."},{"type":"string","const":"lower_back"},{"type":"string","const":"neck"},{"type":"string","const":"obliques"},{"type":"string","const":"quadriceps"},{"type":"string","const":"serratus","description":"Serratus anterior. Its own group — not part of the chest."},{"type":"string","const":"shoulders"},{"type":"string","const":"tibialis","description":"Tibialis anterior. Its own group — not part of the calves, which it opposes."},{"type":"string","const":"trapezius"},{"type":"string","const":"triceps"},{"type":"string","const":"upper_back","description":"The upper back — rhomboids and mid traps — as distinct from the lats."},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"A muscle group an exercise works, used by both primary_muscles and secondary_muscles. Open enum — handle unknown values gracefully.\n\nMembers are training groups rather than anatomy: a source naming a specific head reports the group it belongs to, so the same exercise groups the same way whichever app recorded it.\n\nMembers are added over time, and a new one changes the total of the member it is most closely related to. If you aggregate per muscle, plan for that.\n\nSome members are parts of a broader one and can be summed with it for a coarse view that stays stable: `lat` + `upper_back` + `back` covers the whole back, and `obliques` + `abs` the whole midsection.\n\nOthers are their own group and should not be folded into a neighbour — `serratus` is not part of the chest, `tibialis` is not part of the calves, and `hip_flexor` is not part of the quadriceps."},"StrengthSource":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"device_detected"},{"type":"string","const":"user_logged"},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"How the exercise came to be recorded. Open enum — handle unknown values gracefully."},"StrengthSet":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"distance_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Distance covered, for loaded carries."},"duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Duration of the set, for timed holds and carries."},"end_time":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"End of the set, ISO 8601. Null when the source does not timestamp sets."},"load_type":{"$ref":"#/components/schemas/StrengthLoadType","description":"How to read weight_kg. Always present: every set that happened was loaded somehow, so a set Terra could not classify reports `unknown` rather than omitting the field. Open enum — handle unknown values gracefully. Only external means weight_kg is load added to an otherwise unloaded body, so compute volume from external sets alone. Test for external rather than testing against the other values: a load type you do not recognise must be treated as unknown, because counting it as external overstates the load."},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The user's note on this specific set."},"reps":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Repetitions performed, exactly as the source recorded them. For unilateral movements this is per side."},"rest_after_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Rest taken after this set, within its exercise. Rest between exercises is not represented."},"rir":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Reps in reserve. Never converted to or from rpe."},"rpe":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Rate of perceived exertion, on a 0-10 scale."},"set_type":{"anyOf":[{"$ref":"#/components/schemas/StrengthSetType"},{"type":"null"}],"description":"The type of set as reported by the source, such as normal, warmup, dropset or failure. Open enum — handle unknown values gracefully. unknown when the source does not classify the set."},"start_time":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Start of the set, ISO 8601. Null when the source does not timestamp sets."},"weight_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Load as the source logged it: a barbell's total, or one dumbbell. Never negative. Null when load_type is unknown, and may also be null for a load_type you do not recognise."}},"required":["load_type"]},"StrengthLoadType":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"assisted"},{"type":"string","const":"bodyweight"},{"type":"string","const":"bodyweight_plus"},{"type":"string","const":"external"},{"type":"string","const":"unknown"},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"How to read weight_kg for this set. Open enum — handle unknown values gracefully."},"StrengthSetType":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"amrap"},{"type":"string","const":"cooldown"},{"type":"string","const":"dropset"},{"type":"string","const":"failure"},{"type":"string","const":"normal"},{"type":"string","const":"warmup"},{"type":"string","const":"unknown","description":"The source reported a value here but it could not be resolved. Distinct from the field being absent, which means the source reported nothing at all."},{"type":"string","description":"A value Terra has added since this schema was published."}],"description":"What kind of set this was. Open enum — handle unknown values gracefully."},"PowerData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"avg_watts":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average power output of the user during the workout."},"max_watts":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Maximum power output of the user during the workout."},"power_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/PowerSample"}},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Power generated at a given instant in time, in Watts"},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"strain_level":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Level of cardiovascular strain imposed on the user during the day."}}},"TSSData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"TSS_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/TSSSample"}},{"type":"null"}],"description":"Array of TSS information sampled throughout the workout"}}},"TSSSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"planned":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Planned Training Stress Score value"},"actual":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Actual Training Stress Score value achieved"},"method":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Method used to calculate the TSS"},"intensity_factor_planned":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Planned intensity factor for the training session"},"intensity_factor_actual":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Actual intensity factor achieved during the training session"},"normalized_power_watts":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Normalized power output in watts"}}},"WorkData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"work_kilojoules":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total work output of the user for the workout, in kilojoules."}}},"DataSentToWebhook":{"type":"object","required":["reference","status","trace_id","type","user"],"description":"Acknowledgement returned when `to_webhook` is true (the default): the requested data is fetched asynchronously and delivered to your configured destination, and this body confirms the request was accepted.\n","properties":{"status":{"type":"string","enum":["success"]},"type":{"type":"string","description":"The data type that was requested (e.g. `activity`, `sleep`)."},"reference":{"type":"string","description":"Payload reference, tying this request to the webhook payload you will receive."},"trace_id":{"type":"string","description":"Trace identifier for this request (equal to `reference`)."},"message":{"type":"string","description":"Present only for large requests (date range over one month), which are delivered in chunks."},"user":{"type":"object","description":"Summary of the connection the data was requested for.","properties":{"user_id":{"type":"string"},"provider":{"type":"string"},"reference_id":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"active":{"type":"boolean"},"scopes":{"type":"string","description":"Comma-separated list of granted scopes."},"last_webhook_update":{"type":["string","null"],"format":"date-time"}}}}},"Problem":{"type":"object","description":"An error response, following RFC 9457 (Problem Details for HTTP APIs, which obsoletes RFC 7807). Returned with `Content-Type: application/problem+json` on every 4xx/5xx response. The HTTP status line carries the status code; it is intentionally not repeated in the body. `type`, `title` and `instance` are always present; `detail` is included when a specific explanation is available.\n","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance"]},"UnauthorizedProblem":{"type":"object","description":"A refused credential, always with its code.","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance","code"]}},"responses":{"BadRequest":{"description":"One or more parameters is malformed. The `detail` field describes the specific problem.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"Unauthorized":{"description":"The credential is missing, invalid, expired or revoked (code `unauthorized`).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorizedProblem"}}}},"Forbidden":{"description":"The credential is not authorized (code scope_missing or audience_restricted), the environment is disabled (environment_disabled), or the required product entitlement is missing (entitlement_required).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"NotFound":{"description":"A referenced resource does not exist on Terra's end.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"AuthorizationUnavailable":{"description":"The credential or the product access could not be checked (code `authorization_unavailable`). Retry after the service recovers.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"paths":{"/activity":{"get":{"summary":"Retrieve activity data","description":"Returns a user's completed workout sessions in a date range, each with a start and end time and an activity type such as running or cycling.\n\n- A range longer than one month is delivered in chunks, announced by `large_request_processing` and `large_request_sending` events.\n- Returns `404` if the user's provider does not offer this data type, and `400` if your environment does not collect it.","tags":["HealthData"],"operationId":"Activity_Get","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (a UUID) of the user to retrieve data for.","schema":{"type":"string"},"required":true},{"name":"start_date","in":"query","description":"Start of the period to retrieve, as an ISO 8601 date (YYYY-MM-DD) or a 10-digit unix timestamp in seconds. A date in the future is refused with `400`.","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":true},{"name":"end_date","in":"query","description":"End of the period to retrieve, as an ISO 8601 date (YYYY-MM-DD) or a 10-digit unix timestamp in seconds. Defaults to one day after `start_date`; a future value is clamped to the current time, and a value before `start_date` is refused with `400`.","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":false},{"name":"to_webhook","in":"query","description":"Whether to deliver the data to your destinations as data events instead of in the response. Defaults to `true`. `false` with a range longer than one month is refused with `400`, as is `true` when your environment has no destination.","schema":{"type":"boolean"},"required":false},{"name":"with_samples","in":"query","description":"Whether to include detailed samples in the returned data. Omit it to follow your environment's samples setting for this data type.","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"]}},"required":["data"]},{"$ref":"#/components/schemas/DataSentToWebhook"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/AuthorizationUnavailable"}}}}}}
```

## Retrieve athlete profile

> Returns a user's profile from their provider, such as first and last name, birth date and gender.\
> \
> \- Returns \`404\` if the user's provider does not offer a profile.

```json
{"openapi":"3.2.0","info":{"title":"Terra API","version":"2026.11.19"},"tags":[{"name":"HealthData","summary":"Health data","description":"Read a user's activity, athlete profile, body, daily, menstruation, nutrition and sleep data over a date range."}],"servers":[{"url":"https://access.tryterra.co/api/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","required":["athlete"],"properties":{"athlete":{"description":"Object containing the user's information","type":"object","allOf":[{"$ref":"#/components/schemas/Athlete"}]},"type":{"type":["string","null"]},"user":{"description":"Terra User object","type":"object","allOf":[{"$ref":"#/components/schemas/TerraUser"}]}}},"Athlete":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"age":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"User's age."},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"User's country of residence."},"bio":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"User's bio - a short description they display on their profile."},"state":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"User's state of residence."},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"User's last name."},"sex":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"User's sex."},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"User's city of residence."},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"User's email."},"date_of_birth":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"User's date of birth, in ISO8601 format."},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"User's first name."},"gender":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"User's gender."},"account_creation_date":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"User's account creation date with the provider, in ISO8601 format."},"provider_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The user's unique identifier as assigned by the data provider."}}},"TerraUser":{"$schema":"https://json-schema.org/draft/2020-12/schema","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"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Time at which the connection was created"},"last_webhook_update":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last time at which a webhook update was sent for the connection"},"scopes":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"whether the user is active or not (inactive users will not receive any data updates and are in considered "}},"required":["user_id","provider"]},"DataSentToWebhook":{"type":"object","required":["reference","status","trace_id","type","user"],"description":"Acknowledgement returned when `to_webhook` is true (the default): the requested data is fetched asynchronously and delivered to your configured destination, and this body confirms the request was accepted.\n","properties":{"status":{"type":"string","enum":["success"]},"type":{"type":"string","description":"The data type that was requested (e.g. `activity`, `sleep`)."},"reference":{"type":"string","description":"Payload reference, tying this request to the webhook payload you will receive."},"trace_id":{"type":"string","description":"Trace identifier for this request (equal to `reference`)."},"message":{"type":"string","description":"Present only for large requests (date range over one month), which are delivered in chunks."},"user":{"type":"object","description":"Summary of the connection the data was requested for.","properties":{"user_id":{"type":"string"},"provider":{"type":"string"},"reference_id":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"active":{"type":"boolean"},"scopes":{"type":"string","description":"Comma-separated list of granted scopes."},"last_webhook_update":{"type":["string","null"],"format":"date-time"}}}}},"Problem":{"type":"object","description":"An error response, following RFC 9457 (Problem Details for HTTP APIs, which obsoletes RFC 7807). Returned with `Content-Type: application/problem+json` on every 4xx/5xx response. The HTTP status line carries the status code; it is intentionally not repeated in the body. `type`, `title` and `instance` are always present; `detail` is included when a specific explanation is available.\n","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance"]},"UnauthorizedProblem":{"type":"object","description":"A refused credential, always with its code.","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance","code"]}},"responses":{"BadRequest":{"description":"One or more parameters is malformed. The `detail` field describes the specific problem.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"Unauthorized":{"description":"The credential is missing, invalid, expired or revoked (code `unauthorized`).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorizedProblem"}}}},"Forbidden":{"description":"The credential is not authorized (code scope_missing or audience_restricted), the environment is disabled (environment_disabled), or the required product entitlement is missing (entitlement_required).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"NotFound":{"description":"A referenced resource does not exist on Terra's end.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"AuthorizationUnavailable":{"description":"The credential or the product access could not be checked (code `authorization_unavailable`). Retry after the service recovers.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"paths":{"/athlete":{"get":{"summary":"Retrieve athlete profile","description":"Returns a user's profile from their provider, such as first and last name, birth date and gender.\n\n- Returns `404` if the user's provider does not offer a profile.","tags":["HealthData"],"operationId":"Athlete_Get","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (a UUID) of the user to retrieve data for.","schema":{"type":"string"},"required":true},{"name":"to_webhook","in":"query","description":"Whether to deliver the profile to your destinations as an `athlete` event instead of in the response. Defaults to `true`; `true` when your environment has no destination is refused with `400`.","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/DataSentToWebhook"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/AuthorizationUnavailable"}}}}}}
```

## Retrieve body metrics

> Returns a user's body metrics in a date range, such as weight, height and body-fat percentage.\
> \
> \- A range longer than one month is delivered in chunks, announced by \`large\_request\_processing\` and \`large\_request\_sending\` events.\
> \- Returns \`404\` if the user's provider does not offer this data type, and \`400\` if your environment does not collect it.

```json
{"openapi":"3.2.0","info":{"title":"Terra API","version":"2026.11.19"},"tags":[{"name":"HealthData","summary":"Health data","description":"Read a user's activity, athlete profile, body, daily, menstruation, nutrition and sleep data over a date range."}],"servers":[{"url":"https://access.tryterra.co/api/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","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"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Time at which the connection was created"},"last_webhook_update":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last time at which a webhook update was sent for the connection"},"scopes":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"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","type":"object","properties":{"blood_pressure_data":{"anyOf":[{"$ref":"#/components/schemas/BloodPressureData"},{"type":"null"}],"description":"Object containing information on user's Blood Pressure."},"device_data":{"anyOf":[{"$ref":"#/components/schemas/DeviceData"},{"type":"null"}],"description":"Object containing information on the device which recorded data for the payload."},"heart_data":{"anyOf":[{"$ref":"#/components/schemas/HeartData"},{"type":"null"}],"description":"Object containing information on user's heart metrics."},"hydration_data":{"anyOf":[{"$ref":"#/components/schemas/HydrationData"},{"type":"null"}],"description":"Object containing information on user's hydration (both internal & consumption of water) for the day."},"ketone_data":{"anyOf":[{"$ref":"#/components/schemas/KetoneData"},{"type":"null"}],"description":"Object containing information on user's ketone data for the day."},"measurements_data":{"anyOf":[{"$ref":"#/components/schemas/MeasurementsData"},{"type":"null"}],"description":"Object containing information on body measurements for the day."},"metadata":{"$ref":"#/components/schemas/BodyMetadata","description":"Object containing daily summary metadata."},"oxygen_data":{"anyOf":[{"$ref":"#/components/schemas/OxygenData"},{"type":"null"}],"description":"Object containing information on user's oxygen-related data."},"temperature_data":{"anyOf":[{"$ref":"#/components/schemas/TemperatureData"},{"type":"null"}],"description":"Object containing temperature information (core, skin, ambient) during the day."},"glucose_data":{"anyOf":[{"$ref":"#/components/schemas/GlucoseData"},{"type":"null"}],"description":"Object containing information on user's blood glucose for the day."}},"required":["metadata"]},"BloodPressureData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"blood_pressure_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/BloodPressureSample"}},{"type":"null"}],"description":"List of Blood Pressure measurements sampled throughout the day."},"day_avg_systolic_bp":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average systolic blood pressure, in mmHg."},"day_avg_diastolic_bp":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average diastolic blood pressure, in mmHg."}}},"BloodPressureSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's diastolic blood pressure, in mmHg"},"systolic_bp":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's systolic blood pressure, in mmHg"}}},"DeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"activation_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Activation timestamp of the device, if applicable."},"data_provided":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"}},{"type":"null"}],"description":"Data provided by the device, as enumerated types."},"hardware_version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Hardware version of the device."},"last_upload_date":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last upload date from the device."},"manufacturer":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device manufacturer name."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/OtherDeviceData"}},{"type":"null"}],"description":"Data pertaining to other devices which may have contributed data for this workout."},"serial_number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Serial Number."},"software_version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Software Version."}}},"DeviceDataType":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"manufacturer":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device manufacturer name."},"hardware_version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Hardware version of the device."},"serial_number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Serial Number."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Software Version."},"data_provided":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"}},{"type":"null"}],"description":"Data provided by the device, as enumerated types."},"last_upload_date":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last upload date from the device."}}},"HeartData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"afib_classification_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/AFibClassificationSample"}},{"type":"null"}],"description":"List of Atrial Fibrillation classification measurements sampled through the day."},"ecg_signal":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ECGReading"}},{"type":"null"}],"description":"List of ECGReadings sampled through the day."},"heart_rate_data":{"anyOf":[{"$ref":"#/components/schemas/HeartRateData"},{"type":"null"}],"description":"Object containing heart rate data."},"pulse_wave_velocity_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/PulseVelocitySample"}},{"type":"null"}],"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":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/RRIntervalSample"}},{"type":"null"}],"description":"List of RR Interval samples throughout the day."}}},"AFibClassificationSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"$ref":"#/components/schemas/AFibFlag"},{"type":"null"}],"description":"Flag indicating the atrial fibrillation classification of the individual"}}},"AFibFlag":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"start_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's average heart rate throughout the day, in beats per minute (bpm)."},"afib_classification":{"anyOf":[{"$ref":"#/components/schemas/AFibFlag"},{"type":"null"}],"description":"User's afib classification throught the day."},"raw_signal":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/RawECGSample"}},{"type":"null"}],"description":"List of raw ECG readings sampled through the day."}}},"RawECGSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"potential_uV":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Potential uV in the RawECG Sample"},"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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","type":"object","properties":{"detailed":{"anyOf":[{"$ref":"#/components/schemas/HeartRateDataDetailed"},{"type":"null"}],"description":"Object containing detailed heart rate information for the associated workout."},"summary":{"anyOf":[{"$ref":"#/components/schemas/HeartRateDataSummary"},{"type":"null"}],"description":"Object containing summary heart rate information for the associated workout."}}},"HeartRateDataDetailed":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"hr_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateDataSample"}},{"type":"null"}],"description":"Array of HeartRate data samples recorded for the user during the workout."},"hrv_samples_rmssd":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleRMSSD"}},{"type":"null"}],"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using RMSSD."},"hrv_samples_sdnn":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleSDNN"}},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's heart rate in bpm"},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"},"context":{"anyOf":[{"$ref":"#/components/schemas/HeartRateContext"},{"type":"null"}],"description":"Represents the context in which heart rate was measured."}}},"HeartRateContext":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's Heart Rate Variability, computed using RMSSD"}}},"HeartRateVariabilityDataSampleSDNN":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's Heart Rate Variability, computed using SDNN"}}},"HeartRateDataSummary":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"avg_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Average HeartRate of the user during the workout."},"avg_hrv_rmssd":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average HeartRate Variability of the user during the workout, computed using RMSSD."},"avg_hrv_sdnn":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average HeartRate Variability of the user during the workout, computed using SDNN."},"hr_zone_data":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateZoneData"}},{"type":"null"}],"description":"Array of time spent in various HR zones throughout the workout."},"max_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Maximum HeartRate of the user during the workout."},"min_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Minimum HeartRate of the user during the workout."},"resting_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Resting HeartRate of the user, as determined by the fitness data provider."},"user_max_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"zone":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Heart rate zone designation, as a zero-based zone index."},"start_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"maximum":100,"description":"Start percentage (based off user's max HR) of the HR zone"},"end_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"maximum":100,"description":"End percentage (based off user's max HR) of the HR zone"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Name of the associated heart rate zone"},"duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Duration spent in the heart rate zone"}}},"PulseVelocitySample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"rr_interval_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's RR Interval for a specific heart beat in milliseconds."},"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The heart beat value at that specific instance."}}},"HydrationData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"day_total_water_consumption_ml":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's total water consumption throughout the day."},"hydration_amount_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HydrationMeasurementSample"}},{"type":"null"}],"description":"User's hydration level samples throughout the day."},"day_avg_hydration_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average body hydration, in kilograms."}}},"HydrationMeasurementSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total body water composition of the user, in kilograms."}}},"KetoneData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"ketone_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/KetoneSample"}},{"type":"null"}],"description":"List of ketone data sampled through the day."},"day_avg_ketone_mg_per_dL":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average ketone concentration, in mg/dL."}}},"KetoneSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Ketone in mg per dL"},"sample_type":{"anyOf":[{"$ref":"#/components/schemas/KetoneSampleType"},{"type":"null"}],"description":"Flag indicating the ketone sample type (e.g. blood, breath, urine)"}}},"KetoneSampleType":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"measurements":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/MeasurementDataSample"}},{"type":"null"}],"description":"List of body metrics & measurements taken throughout the associated day."},"day_avg_bmi":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average body mass index (BMI)."},"day_avg_bmr":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average basal metabolic rate (BMR), in kilocalories."},"day_avg_rmr":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average resting metabolic rate (RMR), in kilocalories."},"day_avg_estimated_fitness_age":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average estimated fitness age, in years."},"day_avg_skin_fold_mm":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average skin fold thickness, in millimetres."},"day_avg_bodyfat_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average body-fat percentage."},"day_avg_weight_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average weight, in kilograms."},"day_avg_height_cm":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average height, in centimetres."},"day_avg_bone_mass_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average bone mass, in grams."},"day_avg_muscle_mass_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average muscle mass, in grams."},"day_avg_lean_mass_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average lean mass, in grams."},"day_avg_water_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average body-water percentage."},"day_avg_insulin_units":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average insulin, in units."},"day_avg_visceral_fat_level":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average visceral fat level."}}},"MeasurementDataSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"measurement_time":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's Body Mass Index (BMI)."},"BMR":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's Basal Metabolic Rate - minimum amount of calories that a person's body needs to perform necessary functions."},"RMR":{"anyOf":[{"type":"number"},{"type":"null"}],"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":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Estimate of how fit the user is compared to their actual age, as measured by the device."},"skin_fold_mm":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's skin fold measurement."},"bodyfat_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"maximum":100,"description":"User's body fat percentage."},"weight_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's body weight."},"height_cm":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's height."},"bone_mass_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's total bone mass."},"muscle_mass_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's total muscle mass (i.e. skeletal muscle mass)."},"lean_mass_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total lean mass of the user - calculated as the difference between total body weight and body fat weight."},"water_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"maximum":100,"description":"Total amount of fluid in the user's body."},"water_mass_g":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Mass of fluid in the user's body. Reported instead of water_percentage by sources that measure water as a mass; converting between the two needs a total body weight, which is a separate reading and often absent."},"waist_circumference_cm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Circumference of the user's waist."},"insulin_units":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Quantity of insulin administered to the user."},"insulin_type":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Type of insulin administered to the user."},"urine_color":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Color of the user's urine."},"user_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"User notes associated with the measurement."},"visceral_fat_level":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Visceral fat level of the user."},"visceral_fat_category":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Categorical visceral fat rating of the user."}}},"BodyMetadata":{"$schema":"https://json-schema.org/draft/2020-12/schema","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":{"anyOf":[{"$ref":"#/components/schemas/TimestampLocalization"},{"type":"null"}]}},"required":["end_time","start_time"]},"TimestampLocalization":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"avg_saturation_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average Oxygen Saturation percentage of the user during the day (SpO2 or SmO2)."},"saturation_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/OxygenSaturationSample"}},{"type":"null"}],"description":"Array of Oxygen Saturation percentage datapoints sampled throughout the day."},"vo2_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/Vo2MaxSample"}},{"type":"null"}],"description":"Array of VO2 datapoints sampled throughout the day."},"vo2max_ml_per_min_per_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"VO2Max for the given user."},"day_avg_vo2max_ml_per_min_per_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average VO2 max, in millilitres per minute per kilogram."}}},"OxygenSaturationSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's oxygen saturation percentage - referring to either SpO2 or SmO2, based on the `type` field"},"type":{"anyOf":[{"$ref":"#/components/schemas/OxygenSaturationType"},{"type":"null"}],"description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"}}},"OxygenSaturationType":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"ambient_temperature_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/TemperatureSample"}},{"type":"null"}],"description":"List of ambient temperature measurements sampled throughout the day."},"body_temperature_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/TemperatureSample"}},{"type":"null"}],"description":"List of body temperature measurements sampled throughout the day."},"skin_temperature_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/TemperatureSample"}},{"type":"null"}],"description":"List of skin temperature measurements sampled throughout the day."},"day_avg_ambient_temperature_celsius":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average ambient temperature, in degrees Celsius."},"day_avg_body_temperature_celsius":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average body temperature, in degrees Celsius."},"day_avg_skin_temperature_celsius":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average skin temperature, in degrees Celsius."}}},"TemperatureSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Temperature value in degrees Celsius."}}},"GlucoseData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"blood_glucose_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/GlucoseDataSample"}},{"type":"null"}],"description":"List of blood glucose readings sampled throughout the day."},"detailed_blood_glucose_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/GlucoseDataSample"}},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's average glucose level throughout the day."},"day_avg_detailed_blood_glucose_mg_per_dL":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's average glucose level throughout the day, computed from the higher-frequency detailed sample stream."},"gmi":{"anyOf":[{"type":"number"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Time that the user's glucose is within acceptable range (not hyper or hypoglycemic)."},"sensor_usage":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Number of data points recorded by the sensor throughout the day."},"daily_patterns":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/DailyPatternSample"}},{"type":"null"}],"description":"List of glucose percentile samples throughout the day."}}},"GlucoseDataSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's blood glucose reading"},"glucose_level_flag":{"anyOf":[{"$ref":"#/components/schemas/GlucoseFlag"},{"type":"null"}],"description":"Flag indicating state of user's blood glucose level"},"trend_arrow":{"anyOf":[{"$ref":"#/components/schemas/TrendArrow"},{"type":"null"}],"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","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","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","type":"object","properties":{"time_from_midnight":{"anyOf":[{"type":"integer"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Percentile 5 of the glucose level at the given time of day."},"percentile_25":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Percentile 25 of the glucose level at the given time of day."},"percentile_50":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Percentile 50 of the glucose level at the given time of day."},"percentile_75":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Percentile 75 of the glucose level at the given time of day."},"percentile_95":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Percentile 95 of the glucose level at the given time of day."}}},"DataSentToWebhook":{"type":"object","required":["reference","status","trace_id","type","user"],"description":"Acknowledgement returned when `to_webhook` is true (the default): the requested data is fetched asynchronously and delivered to your configured destination, and this body confirms the request was accepted.\n","properties":{"status":{"type":"string","enum":["success"]},"type":{"type":"string","description":"The data type that was requested (e.g. `activity`, `sleep`)."},"reference":{"type":"string","description":"Payload reference, tying this request to the webhook payload you will receive."},"trace_id":{"type":"string","description":"Trace identifier for this request (equal to `reference`)."},"message":{"type":"string","description":"Present only for large requests (date range over one month), which are delivered in chunks."},"user":{"type":"object","description":"Summary of the connection the data was requested for.","properties":{"user_id":{"type":"string"},"provider":{"type":"string"},"reference_id":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"active":{"type":"boolean"},"scopes":{"type":"string","description":"Comma-separated list of granted scopes."},"last_webhook_update":{"type":["string","null"],"format":"date-time"}}}}},"Problem":{"type":"object","description":"An error response, following RFC 9457 (Problem Details for HTTP APIs, which obsoletes RFC 7807). Returned with `Content-Type: application/problem+json` on every 4xx/5xx response. The HTTP status line carries the status code; it is intentionally not repeated in the body. `type`, `title` and `instance` are always present; `detail` is included when a specific explanation is available.\n","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance"]},"UnauthorizedProblem":{"type":"object","description":"A refused credential, always with its code.","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance","code"]}},"responses":{"BadRequest":{"description":"One or more parameters is malformed. The `detail` field describes the specific problem.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"Unauthorized":{"description":"The credential is missing, invalid, expired or revoked (code `unauthorized`).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorizedProblem"}}}},"Forbidden":{"description":"The credential is not authorized (code scope_missing or audience_restricted), the environment is disabled (environment_disabled), or the required product entitlement is missing (entitlement_required).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"NotFound":{"description":"A referenced resource does not exist on Terra's end.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"AuthorizationUnavailable":{"description":"The credential or the product access could not be checked (code `authorization_unavailable`). Retry after the service recovers.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"paths":{"/body":{"get":{"summary":"Retrieve body metrics","description":"Returns a user's body metrics in a date range, such as weight, height and body-fat percentage.\n\n- A range longer than one month is delivered in chunks, announced by `large_request_processing` and `large_request_sending` events.\n- Returns `404` if the user's provider does not offer this data type, and `400` if your environment does not collect it.","tags":["HealthData"],"operationId":"Body_Get","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (a UUID) of the user to retrieve data for.","schema":{"type":"string"},"required":true},{"name":"start_date","in":"query","description":"Start of the period to retrieve, as an ISO 8601 date (YYYY-MM-DD) or a 10-digit unix timestamp in seconds. A date in the future is refused with `400`.","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":true},{"name":"end_date","in":"query","description":"End of the period to retrieve, as an ISO 8601 date (YYYY-MM-DD) or a 10-digit unix timestamp in seconds. Defaults to one day after `start_date`; a future value is clamped to the current time, and a value before `start_date` is refused with `400`.","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":false},{"name":"to_webhook","in":"query","description":"Whether to deliver the data to your destinations as data events instead of in the response. Defaults to `true`. `false` with a range longer than one month is refused with `400`, as is `true` when your environment has no destination.","schema":{"type":"boolean"},"required":false},{"name":"with_samples","in":"query","description":"Whether to include detailed samples in the returned data. Omit it to follow your environment's samples setting for this data type.","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"]}},"required":["data"]},{"$ref":"#/components/schemas/DataSentToWebhook"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/AuthorizationUnavailable"}}}}}}
```

## Retrieve daily summaries

> Returns a user's daily activity summaries in a date range, such as steps, distance and calories burned.\
> \
> \- A range longer than one month is delivered in chunks, announced by \`large\_request\_processing\` and \`large\_request\_sending\` events.\
> \- Returns \`404\` if the user's provider does not offer this data type, and \`400\` if your environment does not collect it.

```json
{"openapi":"3.2.0","info":{"title":"Terra API","version":"2026.11.19"},"tags":[{"name":"HealthData","summary":"Health data","description":"Read a user's activity, athlete profile, body, daily, menstruation, nutrition and sleep data over a date range."}],"servers":[{"url":"https://access.tryterra.co/api/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","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"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Time at which the connection was created"},"last_webhook_update":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last time at which a webhook update was sent for the connection"},"scopes":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"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","type":"object","properties":{"active_durations_data":{"anyOf":[{"$ref":"#/components/schemas/ActiveDurationsData"},{"type":"null"}],"description":"Object containing information related to the time spent in different activity intensities during over the day."},"calories_data":{"anyOf":[{"$ref":"#/components/schemas/CaloriesData"},{"type":"null"}],"description":"Object containing calorie-related information for the user during the specific day."},"data_enrichment":{"anyOf":[{"$ref":"#/components/schemas/DailyDataEnrichment"},{"type":"null"}],"description":"Object containing additional enrichment data for the day."},"trends":{"anyOf":[{"$ref":"#/components/schemas/TrendsData"},{"type":"null"}],"description":"Personal 30-day baselines and trends for the user as of this day (trends product). Null for customers without the product enabled."},"device_data":{"anyOf":[{"$ref":"#/components/schemas/DeviceData"},{"type":"null"}],"description":"Object containing information on the device which recorded data for the day."},"distance_data":{"anyOf":[{"$ref":"#/components/schemas/DailyDistanceData"},{"type":"null"}],"description":"Object containing information related to distance covered during the associated day."},"heart_rate_data":{"anyOf":[{"$ref":"#/components/schemas/HeartRateData"},{"type":"null"}],"description":"Object containing heartrate-related information for the day."},"MET_data":{"anyOf":[{"$ref":"#/components/schemas/METData"},{"type":"null"}],"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":{"anyOf":[{"$ref":"#/components/schemas/OxygenData"},{"type":"null"}],"description":"Object containing information on oxygen-related metrics for the day."},"scores":{"anyOf":[{"$ref":"#/components/schemas/ScoresData"},{"type":"null"}],"description":"Scores for the user's performance on different metrics for the given day, as calculated by the fitness data provider."},"strain_data":{"anyOf":[{"$ref":"#/components/schemas/StrainData"},{"type":"null"}],"description":"Object containing information on the strain put on the user's body over a day."},"stress_data":{"anyOf":[{"$ref":"#/components/schemas/StressData"},{"type":"null"}],"description":"Object containing information on the stress put on the user over a day."},"tag_data":{"anyOf":[{"$ref":"#/components/schemas/TagData"},{"type":"null"}],"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","type":"object","properties":{"activity_levels_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ActivityLevelSample"}},{"type":"null"}],"description":"Array of detailed samples of the intensity the user was in at various points during the workout."},"activity_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in an active state during the workout."},"inactivity_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in an inactive state during the workout."},"low_intensity_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in a low intensity state during the workout."},"moderate_intensity_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in a moderate intensity state during the workout."},"num_continuous_inactive_periods":{"anyOf":[{"type":"integer"},{"type":"null"}],"minimum":0,"description":"Maximum number of continuous periods spent in an inactive state during the workout."},"rest_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent resting during the workout."},"vigorous_intensity_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in a state of vigorous intensity during the workout."},"standing_hours_count":{"anyOf":[{"type":"number"},{"type":"null"}]},"standing_seconds":{"anyOf":[{"type":"number"},{"type":"null"}]}}},"ActivityLevelSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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."},"activity_level":{"anyOf":[{"$ref":"#/components/schemas/ActivityLevel"},{"type":"null"}],"description":"The user's activity level for the sample."},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Duration the activity-level timer has been running, in seconds."}}},"ActivityLevel":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"BMR_calories":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Basal Metabolic Rate calories - calories burned at rest."},"calorie_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/CalorieSample"}},{"type":"null"}],"description":"Array of calorie data samples recorded throughout the time period."},"net_activity_calories":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Net calories burned through activity (excluding BMR)."},"net_intake_calories":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Net calories consumed through food and drink intake."},"total_burned_calories":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total calories burned including BMR and activity."}}},"CalorieSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Number of calories burned at the given timestamp."},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"total_stress_score":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total stress score for the day."},"stress_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"Map of contributing factor name to its weighted contribution to the stress score."},"respiratory_score":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Respiratory health score for the day."},"respiratory_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"Map of contributing factor name to its weighted contribution to the respiratory score."},"immune_index":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Immune system health index for the day."},"immune_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"Map of contributing factor name to its weighted contribution to the immune index."},"resilience_score":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Resilience score for the day."},"resilience_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"Map of contributing factor name to its weighted contribution to the resilience score."},"strain_index":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Strain index for the day."},"strain_traffic_light":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Categorical strain rating for the day (e.g. GREEN, AMBER, RED)."},"strain_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"Map of contributing factor name to its weighted contribution to the strain index."},"total_stress_score_v2":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total stress score for the day, computed by the v2 model."},"total_stress_score_v2_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"Map of contributing factor name to its weighted contribution to the v2 total stress score."},"vo2max":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Resting VO2max estimate for the day, in ml/kg/min, from the ratio of max to measured resting heart rate. Absent without a measured resting heart rate in the last 30 days."},"vo2max_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"The heart-rate anchors behind the VO2max estimate, in bpm: hr_max and hr_rest."},"vo2max_traffic_light":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Confidence in the VO2max estimate. A resting estimate is always AMBER: no workout near max heart rate backs it."},"vo2max_method":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"How the VO2max was estimated: REST (resting and max heart rate)."},"vo2max_reasons":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Why the VO2max confidence is not GREEN: RESTING_ESTIMATE, and HR_MAX_ESTIMATED when max heart rate came from age."}},"$defs":{"RecordFloat":{"type":"object","properties":{},"unevaluatedProperties":{"type":"number"}}}},"RecordFloat":{"type":"object","properties":{},"unevaluatedProperties":{"type":"number"}},"TrendsData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"window_days":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"Length of each window in days."},"window_end":{"type":"string","description":"Inclusive ISO date (yyyy-mm-dd) the trailing window ends on: the last completed local day before the record's own."},"resting_heart_rate":{"anyOf":[{"$ref":"#/components/schemas/MetricTrend"},{"type":"null"}],"description":"Resting heart rate trend, in bpm. Source: daily summaries."},"hrv_rmssd":{"anyOf":[{"$ref":"#/components/schemas/MetricTrend"},{"type":"null"}],"description":"Heart-rate variability (RMSSD) trend, in ms. Source: sleep sessions."},"hrv_sdnn":{"anyOf":[{"$ref":"#/components/schemas/MetricTrend"},{"type":"null"}],"description":"Heart-rate variability (SDNN) trend, in ms. Source: sleep sessions. Apple Health reports SDNN rather than RMSSD."},"sleep_duration":{"anyOf":[{"$ref":"#/components/schemas/MetricTrend"},{"type":"null"}],"description":"Time asleep per session trend, in seconds (matches sleep_durations_data.asleep_time). Source: sleep sessions."}},"required":["window_days","window_end"],"description":"Personal baselines and trends for the user, as of the record. Present on sleep and daily payloads for customers with the trends product enabled; null otherwise."},"MetricTrend":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"baseline":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Median of the trailing window, in the metric's own units (bpm, ms, seconds)."},"average":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Mean of the trailing window."},"previous_average":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Mean of the window immediately preceding the trailing window."},"delta":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"average minus previous_average. Present only when both averages are."},"days_with_data":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"Number of days with data in the trailing window."},"previous_days_with_data":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"Number of days with data in the preceding window."}},"required":["days_with_data","previous_days_with_data"],"description":"Personal trend for one metric, computed by Terra from the user's own stored daily values. Both windows are trailing calendar-day windows that end the day BEFORE the record's own local day, so the record's value is never inside its own baseline. Statistics are absent (null) when the window has no data; the day counts say how much history stands behind each number."},"DeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"activation_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Activation timestamp of the device, if applicable."},"data_provided":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"}},{"type":"null"}],"description":"Data provided by the device, as enumerated types."},"hardware_version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Hardware version of the device."},"last_upload_date":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last upload date from the device."},"manufacturer":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device manufacturer name."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/OtherDeviceData"}},{"type":"null"}],"description":"Data pertaining to other devices which may have contributed data for this workout."},"serial_number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Serial Number."},"software_version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Software Version."}}},"DeviceDataType":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"manufacturer":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device manufacturer name."},"hardware_version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Hardware version of the device."},"serial_number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Serial Number."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Software Version."},"data_provided":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"}},{"type":"null"}],"description":"Data provided by the device, as enumerated types."},"last_upload_date":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last upload date from the device."}}},"DailyDistanceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"detailed":{"anyOf":[{"$ref":"#/components/schemas/DistanceDataDetailed"},{"type":"null"}],"description":"Object containing detailed distance information - this may include second-by-second samples."},"distance_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total distance covered by the user throughout the day."},"elevation":{"anyOf":[{"$ref":"#/components/schemas/ElevationData"},{"type":"null"}],"description":"Object containing information on the elevation of the user throughout the day."},"floors_climbed":{"anyOf":[{"type":"integer"},{"type":"null"}],"minimum":0,"description":"Total number of elevation gain in floors climbed equivalent throughout the day, as determined by the fitness data provider."},"steps":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Total number of steps performed during the day."},"swimming":{"anyOf":[{"$ref":"#/components/schemas/SwimmingData"},{"type":"null"}],"description":"Summary information of the user's swimming statistics for the day, if applicable."}}},"DistanceDataDetailed":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"distance_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/DistanceSample"}},{"type":"null"}],"description":"Array of detailed samples of distance covered throughout the workout."},"elevation_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ElevationSample"}},{"type":"null"}],"description":"Array of detailed samples of elevation throughout the workout."},"floors_climbed_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/FloorsClimbedSample"}},{"type":"null"}],"description":"Array of detailed samples of floors climbed throughout the workout, as determined by the fitness data provider."},"step_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/StepSample"}},{"type":"null"}],"description":"Array of detailed samples of steps performed throughout the workout."}}},"DistanceSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Cumulative distance covered up to associated timestamp, since the start of the payload"},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's altitude at a given point in time, in meters above sea level."},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Cumulative number of elevation gain measured in floors climbed up to associated timestamp, since the start of the payload"},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Cumulative number of steps taken up to associated timestamp, since the start of the payload"},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"avg_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average elevation of the user throughout the workout."},"gain_actual_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Planned elevation gain for the workout."},"loss_actual_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Elevation loss of the user throughout the workout."},"max_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Maximum elevation of the user during the workout."},"min_meters":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Minimum elevation of the user during the workout."}}},"SwimmingData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"num_laps":{"anyOf":[{"type":"integer"},{"type":"null"}],"minimum":0,"description":"Total number of swimming laps performed during the day."},"num_strokes":{"anyOf":[{"type":"integer"},{"type":"null"}],"minimum":0,"description":"Total number of swimming strokes performed during the day."},"pool_length_meters":{"anyOf":[{"type":"integer"},{"type":"null"}],"minimum":0,"description":"Pool length for associated with the day."}}},"HeartRateData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"detailed":{"anyOf":[{"$ref":"#/components/schemas/HeartRateDataDetailed"},{"type":"null"}],"description":"Object containing detailed heart rate information for the associated workout."},"summary":{"anyOf":[{"$ref":"#/components/schemas/HeartRateDataSummary"},{"type":"null"}],"description":"Object containing summary heart rate information for the associated workout."}}},"HeartRateDataDetailed":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"hr_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateDataSample"}},{"type":"null"}],"description":"Array of HeartRate data samples recorded for the user during the workout."},"hrv_samples_rmssd":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleRMSSD"}},{"type":"null"}],"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using RMSSD."},"hrv_samples_sdnn":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleSDNN"}},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's heart rate in bpm"},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"},"context":{"anyOf":[{"$ref":"#/components/schemas/HeartRateContext"},{"type":"null"}],"description":"Represents the context in which heart rate was measured."}}},"HeartRateContext":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's Heart Rate Variability, computed using RMSSD"}}},"HeartRateVariabilityDataSampleSDNN":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's Heart Rate Variability, computed using SDNN"}}},"HeartRateDataSummary":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"avg_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Average HeartRate of the user during the workout."},"avg_hrv_rmssd":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average HeartRate Variability of the user during the workout, computed using RMSSD."},"avg_hrv_sdnn":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average HeartRate Variability of the user during the workout, computed using SDNN."},"hr_zone_data":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateZoneData"}},{"type":"null"}],"description":"Array of time spent in various HR zones throughout the workout."},"max_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Maximum HeartRate of the user during the workout."},"min_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Minimum HeartRate of the user during the workout."},"resting_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Resting HeartRate of the user, as determined by the fitness data provider."},"user_max_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"zone":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Heart rate zone designation, as a zero-based zone index."},"start_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"maximum":100,"description":"Start percentage (based off user's max HR) of the HR zone"},"end_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"maximum":100,"description":"End percentage (based off user's max HR) of the HR zone"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Name of the associated heart rate zone"},"duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Duration spent in the heart rate zone"}}},"METData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"MET_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/METSample"}},{"type":"null"}],"description":"An array of Metabolic Equivalent Time samples, as calculated by the user's wearable."},"avg_level":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The average MET level of the activity."},"num_high_intensity_minutes":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Number of minutes spent in High Intensity during the workout - based off MET scale."},"num_inactive_minutes":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Number of minutes spent in state of Inactivity during the workout - based off MET scale."},"num_low_intensity_minutes":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Number of minutes spent in Low Intensity during the workout - based off MET scale."},"num_moderate_intensity_minutes":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Metabolic Equivalent of Task (MET) level at the given timestamp"}}},"DailyMetadata":{"$schema":"https://json-schema.org/draft/2020-12/schema","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":{"anyOf":[{"$ref":"#/components/schemas/TimestampLocalization"},{"type":"null"}]},"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","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","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","type":"object","properties":{"avg_saturation_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average Oxygen Saturation percentage of the user during the day (SpO2 or SmO2)."},"saturation_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/OxygenSaturationSample"}},{"type":"null"}],"description":"Array of Oxygen Saturation percentage datapoints sampled throughout the day."},"vo2_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/Vo2MaxSample"}},{"type":"null"}],"description":"Array of VO2 datapoints sampled throughout the day."},"vo2max_ml_per_min_per_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"VO2Max for the given user."},"day_avg_vo2max_ml_per_min_per_kg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Day-average VO2 max, in millilitres per minute per kilogram."}}},"OxygenSaturationSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's oxygen saturation percentage - referring to either SpO2 or SmO2, based on the `type` field"},"type":{"anyOf":[{"$ref":"#/components/schemas/OxygenSaturationType"},{"type":"null"}],"description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"}}},"OxygenSaturationType":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"activity":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"maximum":100,"description":"Activity score for the given day."},"recovery":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"maximum":100,"description":"Recovery score for the given day."},"sleep":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"maximum":100,"description":"Sleep score for the given day, pertaining to the previous night's sleep."}}},"StrainData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"strain_level":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Level of cardiovascular strain imposed on the user during the day."}}},"StressData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"avg_stress_level":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average stress level for the day."},"activity_stress_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in a stressed state while active during the day."},"low_stress_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in a state of low stress during the day."},"max_stress_level":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Maximum stress level recorded during the day."},"medium_stress_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in a state of medium stress during the day."},"samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/StressSample"}},{"type":"null"}],"description":"Array of stress level data points sampled throughout the day."},"rest_stress_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in a stressed state while at rest during the day."},"high_stress_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in a state of high stress during the day."},"stress_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Total number of seconds spent in any stressed state during the day."},"stress_rating":{"anyOf":[{"$ref":"#/components/schemas/StressLevel"},{"type":"null"}],"description":"Stress rating for the day."},"body_battery_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/BodyBatterySample"}},{"type":"null"}],"description":"Array of Body Battery data points sampled throughout the day."}}},"StressSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Stress level measurement at the given timestamp"}}},"StressLevel":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Body battery energy level at the given timestamp"}}},"TagData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"tags":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/TagEntry"}},{"type":"null"}],"description":"Array of user-entered tags for the day."}}},"TagEntry":{"$schema":"https://json-schema.org/draft/2020-12/schema","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"]},"DataSentToWebhook":{"type":"object","required":["reference","status","trace_id","type","user"],"description":"Acknowledgement returned when `to_webhook` is true (the default): the requested data is fetched asynchronously and delivered to your configured destination, and this body confirms the request was accepted.\n","properties":{"status":{"type":"string","enum":["success"]},"type":{"type":"string","description":"The data type that was requested (e.g. `activity`, `sleep`)."},"reference":{"type":"string","description":"Payload reference, tying this request to the webhook payload you will receive."},"trace_id":{"type":"string","description":"Trace identifier for this request (equal to `reference`)."},"message":{"type":"string","description":"Present only for large requests (date range over one month), which are delivered in chunks."},"user":{"type":"object","description":"Summary of the connection the data was requested for.","properties":{"user_id":{"type":"string"},"provider":{"type":"string"},"reference_id":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"active":{"type":"boolean"},"scopes":{"type":"string","description":"Comma-separated list of granted scopes."},"last_webhook_update":{"type":["string","null"],"format":"date-time"}}}}},"Problem":{"type":"object","description":"An error response, following RFC 9457 (Problem Details for HTTP APIs, which obsoletes RFC 7807). Returned with `Content-Type: application/problem+json` on every 4xx/5xx response. The HTTP status line carries the status code; it is intentionally not repeated in the body. `type`, `title` and `instance` are always present; `detail` is included when a specific explanation is available.\n","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance"]},"UnauthorizedProblem":{"type":"object","description":"A refused credential, always with its code.","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance","code"]}},"responses":{"BadRequest":{"description":"One or more parameters is malformed. The `detail` field describes the specific problem.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"Unauthorized":{"description":"The credential is missing, invalid, expired or revoked (code `unauthorized`).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorizedProblem"}}}},"Forbidden":{"description":"The credential is not authorized (code scope_missing or audience_restricted), the environment is disabled (environment_disabled), or the required product entitlement is missing (entitlement_required).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"NotFound":{"description":"A referenced resource does not exist on Terra's end.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"AuthorizationUnavailable":{"description":"The credential or the product access could not be checked (code `authorization_unavailable`). Retry after the service recovers.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"paths":{"/daily":{"get":{"summary":"Retrieve daily summaries","description":"Returns a user's daily activity summaries in a date range, such as steps, distance and calories burned.\n\n- A range longer than one month is delivered in chunks, announced by `large_request_processing` and `large_request_sending` events.\n- Returns `404` if the user's provider does not offer this data type, and `400` if your environment does not collect it.","tags":["HealthData"],"operationId":"Daily_Get","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (a UUID) of the user to retrieve data for.","schema":{"type":"string"},"required":true},{"name":"start_date","in":"query","description":"Start of the period to retrieve, as an ISO 8601 date (YYYY-MM-DD) or a 10-digit unix timestamp in seconds. A date in the future is refused with `400`.","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":true},{"name":"end_date","in":"query","description":"End of the period to retrieve, as an ISO 8601 date (YYYY-MM-DD) or a 10-digit unix timestamp in seconds. Defaults to one day after `start_date`; a future value is clamped to the current time, and a value before `start_date` is refused with `400`.","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":false},{"name":"to_webhook","in":"query","description":"Whether to deliver the data to your destinations as data events instead of in the response. Defaults to `true`. `false` with a range longer than one month is refused with `400`, as is `true` when your environment has no destination.","schema":{"type":"boolean"},"required":false},{"name":"with_samples","in":"query","description":"Whether to include detailed samples in the returned data. Omit it to follow your environment's samples setting for this data type.","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"]}},"required":["data"]},{"$ref":"#/components/schemas/DataSentToWebhook"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/AuthorizationUnavailable"}}}}}}
```

## Retrieve menstruation data

> Returns a user's menstruation data in a date range, such as cycle length, period length and ovulation date.\
> \
> \- A range longer than one month is delivered in chunks, announced by \`large\_request\_processing\` and \`large\_request\_sending\` events.\
> \- Returns \`404\` if the user's provider does not offer this data type, and \`400\` if your environment does not collect it.

```json
{"openapi":"3.2.0","info":{"title":"Terra API","version":"2026.11.19"},"tags":[{"name":"HealthData","summary":"Health data","description":"Read a user's activity, athlete profile, body, daily, menstruation, nutrition and sleep data over a date range."}],"servers":[{"url":"https://access.tryterra.co/api/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","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"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Time at which the connection was created"},"last_webhook_update":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last time at which a webhook update was sent for the connection"},"scopes":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"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","type":"object","properties":{"metadata":{"$ref":"#/components/schemas/MenstruationMetadata","description":"Object containing daily summary metadata."},"menstruation_data":{"anyOf":[{"$ref":"#/components/schemas/MenstruationData"},{"type":"null"}],"description":"Object containing information on user's menstruation for a given day."}},"required":["metadata"]},"MenstruationMetadata":{"$schema":"https://json-schema.org/draft/2020-12/schema","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":{"anyOf":[{"$ref":"#/components/schemas/TimestampLocalization"},{"type":"null"}]}},"required":["end_time","start_time"]},"TimestampLocalization":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"period_length_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Total length of period (i.e. menstrual bleeding)."},"current_phase":{"anyOf":[{"$ref":"#/components/schemas/MenstruationInterval"},{"type":"null"}],"description":"Phase in associated cycle, (i.e. menstruation, fertile etc)."},"length_of_current_phase_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Length of current phase."},"days_until_next_phase":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Number of days to reach the next phase (predicted)."},"period_start_date":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Start date of menstrual cycle, in ISO8601 format."},"predicted_cycle_length_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Prediction of the cycle's total length."},"day_in_cycle":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Number of day in cycle this object is associated with."},"last_updated_time":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last time when the user recorded information regarding their cycle, in ISO8601 format, with microseconds precision."},"cycle_length_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Total cycle length in days."},"is_predicted_cycle":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Flag indicating whether associated object is a prediction or user-logged information."},"menstruation_flow":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/MenstruationFlowSample"}},{"type":"null"}],"description":"List of user logs of information related to the strength of user's menstrual flow."},"intervals":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/MenstruationIntervalSample"}},{"type":"null"}],"description":"List of cycle phase intervals, each spanning a contiguous date range within the cycle."},"fertility_window_start":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Start of the fertility window, in ISO8601 format."},"fertility_window_end":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"End of the fertility window, in ISO8601 format."},"ovulation_day":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Predicted ovulation day, in ISO8601 format."}}},"MenstruationInterval":{"$schema":"https://json-schema.org/draft/2020-12/schema","oneOf":[{"type":"number","const":0,"description":"Cycle phase is unknown or could not be determined.","title":"Unknown"},{"type":"number","const":1,"description":"Menstrual bleeding (period) phase.","title":"Period"},{"type":"number","const":2,"description":"Follicular phase, when ovarian follicles develop.","title":"Follicular"},{"type":"number","const":3,"description":"Fertile window, when conception is most likely.","title":"Fertile Window"},{"type":"number","const":4,"description":"Ovulation phase, when an egg is released.","title":"Ovulation"},{"type":"number","const":5,"description":"Luteal phase, following ovulation.","title":"Luteal"},{"type":"number","const":6,"description":"Premenstrual syndrome phase before menstruation begins.","title":"PMS"},{"type":"number","const":7,"description":"First third of pregnancy, weeks 1-12.","title":"First Trimester"},{"type":"number","const":8,"description":"Middle third of pregnancy, weeks 13-26.","title":"Second Trimester"},{"type":"number","const":9,"description":"Final third of pregnancy, weeks 27-40.","title":"Third Trimester"}],"description":"Represents menstrual cycle phases."},"MenstruationFlowSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"$ref":"#/components/schemas/MenstruationFlow"},{"type":"null"}],"description":"Flag indicating the strength of the user's menstrual flow."}}},"MenstruationFlow":{"$schema":"https://json-schema.org/draft/2020-12/schema","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"},"MenstruationIntervalSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"start_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Start of the cycle-phase interval, in ISO8601 format."},"end_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"End of the cycle-phase interval, in ISO8601 format."},"phase":{"anyOf":[{"$ref":"#/components/schemas/MenstruationInterval"},{"type":"null"}],"description":"Cycle phase covered by this interval."}}},"DataSentToWebhook":{"type":"object","required":["reference","status","trace_id","type","user"],"description":"Acknowledgement returned when `to_webhook` is true (the default): the requested data is fetched asynchronously and delivered to your configured destination, and this body confirms the request was accepted.\n","properties":{"status":{"type":"string","enum":["success"]},"type":{"type":"string","description":"The data type that was requested (e.g. `activity`, `sleep`)."},"reference":{"type":"string","description":"Payload reference, tying this request to the webhook payload you will receive."},"trace_id":{"type":"string","description":"Trace identifier for this request (equal to `reference`)."},"message":{"type":"string","description":"Present only for large requests (date range over one month), which are delivered in chunks."},"user":{"type":"object","description":"Summary of the connection the data was requested for.","properties":{"user_id":{"type":"string"},"provider":{"type":"string"},"reference_id":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"active":{"type":"boolean"},"scopes":{"type":"string","description":"Comma-separated list of granted scopes."},"last_webhook_update":{"type":["string","null"],"format":"date-time"}}}}},"Problem":{"type":"object","description":"An error response, following RFC 9457 (Problem Details for HTTP APIs, which obsoletes RFC 7807). Returned with `Content-Type: application/problem+json` on every 4xx/5xx response. The HTTP status line carries the status code; it is intentionally not repeated in the body. `type`, `title` and `instance` are always present; `detail` is included when a specific explanation is available.\n","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance"]},"UnauthorizedProblem":{"type":"object","description":"A refused credential, always with its code.","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance","code"]}},"responses":{"BadRequest":{"description":"One or more parameters is malformed. The `detail` field describes the specific problem.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"Unauthorized":{"description":"The credential is missing, invalid, expired or revoked (code `unauthorized`).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorizedProblem"}}}},"Forbidden":{"description":"The credential is not authorized (code scope_missing or audience_restricted), the environment is disabled (environment_disabled), or the required product entitlement is missing (entitlement_required).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"NotFound":{"description":"A referenced resource does not exist on Terra's end.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"AuthorizationUnavailable":{"description":"The credential or the product access could not be checked (code `authorization_unavailable`). Retry after the service recovers.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"paths":{"/menstruation":{"get":{"summary":"Retrieve menstruation data","description":"Returns a user's menstruation data in a date range, such as cycle length, period length and ovulation date.\n\n- A range longer than one month is delivered in chunks, announced by `large_request_processing` and `large_request_sending` events.\n- Returns `404` if the user's provider does not offer this data type, and `400` if your environment does not collect it.","tags":["HealthData"],"operationId":"Menstruation_Get","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (a UUID) of the user to retrieve data for.","schema":{"type":"string"},"required":true},{"name":"start_date","in":"query","description":"Start of the period to retrieve, as an ISO 8601 date (YYYY-MM-DD) or a 10-digit unix timestamp in seconds. A date in the future is refused with `400`.","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":true},{"name":"end_date","in":"query","description":"End of the period to retrieve, as an ISO 8601 date (YYYY-MM-DD) or a 10-digit unix timestamp in seconds. Defaults to one day after `start_date`; a future value is clamped to the current time, and a value before `start_date` is refused with `400`.","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":false},{"name":"to_webhook","in":"query","description":"Whether to deliver the data to your destinations as data events instead of in the response. Defaults to `true`. `false` with a range longer than one month is refused with `400`, as is `true` when your environment has no destination.","schema":{"type":"boolean"},"required":false},{"name":"with_samples","in":"query","description":"Whether to include detailed samples in the returned data. Omit it to follow your environment's samples setting for this data type.","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"]}},"required":["data"]},{"$ref":"#/components/schemas/DataSentToWebhook"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/AuthorizationUnavailable"}}}}}}
```

## Retrieve nutrition data

> Returns a user's nutrition logs in a date range, such as meal type, calories and macronutrients.\
> \
> \- A range longer than one month is delivered in chunks, announced by \`large\_request\_processing\` and \`large\_request\_sending\` events.\
> \- Returns \`404\` if the user's provider does not offer this data type, and \`400\` if your environment does not collect it.

```json
{"openapi":"3.2.0","info":{"title":"Terra API","version":"2026.11.19"},"tags":[{"name":"HealthData","summary":"Health data","description":"Read a user's activity, athlete profile, body, daily, menstruation, nutrition and sleep data over a date range."}],"servers":[{"url":"https://access.tryterra.co/api/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","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"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Time at which the connection was created"},"last_webhook_update":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last time at which a webhook update was sent for the connection"},"scopes":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"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","type":"object","properties":{"drink_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/DrinkSample"}},{"type":"null"}],"description":"Information on drinks the user consumed throughout the day."},"meals":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/Meal"}},{"type":"null"}],"description":"Information on individual foods consumed throughout a given day."},"metadata":{"$ref":"#/components/schemas/NutritionMetadata","description":"Object containing daily summary metadata."},"summary":{"anyOf":[{"$ref":"#/components/schemas/NutritionSummary"},{"type":"null"}],"description":"Summative nutritional information for a given day."}},"required":["metadata"]},"DrinkSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Volume of drink consumed"},"drink_unit":{"anyOf":[{"$ref":"#/components/schemas/NutritionUnits"},{"type":"null"}],"description":"Unit of measurement for the drink volume."},"drink_name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Name of drink consumed."}}},"NutritionUnits":{"$schema":"https://json-schema.org/draft/2020-12/schema","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"},"Meal":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"biotin_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Biotin content of the associated food(s)."},"caffeine_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Caffeine content of the associated food(s)."},"calcium_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Calcium content of the associated food(s)."},"sodium_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Sodium content of the associated food(s)."},"chloride_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Chloride content of the associated food(s)."},"chromium_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Chromium content of the associated food(s)."},"copper_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Copper content of the associated food(s)."},"folate_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Folate content of the associated food(s)."},"folic_acid_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Folic Acid content of the associated food(s)."},"iodine_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Iodine content of the associated food(s)."},"iron_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Iron content of the associated food(s)."},"magnesium_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Magnesium content of the associated food(s)."},"manganese_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Manganese content of the associated food(s)."},"molybdenum_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Molybdenum content of the associated food(s)."},"niacin_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Niacin content of the associated food(s)."},"pantothenic_acid_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Pantothenic content of the associated food(s)."},"phosphorus_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Phosphorus content of the associated food(s)."},"potassium_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Potassium content of the associated food(s)."},"riboflavin_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Riboflavin content of the associated food(s)."},"selenium_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Selenium content of the associated food(s)."},"thiamin_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Thiamin content of the associated food(s)."},"vitamin_A_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Vitamin A content of the associated food(s)."},"vitamin_B12_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Vitamin B12 content of the associated food(s)."},"vitamin_B6_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Vitamin B6 content of the associated food(s)."},"vitamin_C_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Vitamin C content of the associated food(s)."},"vitamin_D_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Vitamin D content of the associated food(s)."},"vitamin_D2_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Vitamin D2 content of the associated food(s)."},"vitamin_D3_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Vitamin D3 content of the associated food(s)."},"vitamin_E_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Vitamin E content of the associated food(s)."},"vitamin_K_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Vitamin K content of the associated food(s)."},"zinc_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Zinc content of the associated food(s)."},"cystine_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Cystine content of the associated food(s)."},"histidine_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Histidine content of the associated food(s)."},"isoleucine_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Isoleucine content of the associated food(s)."},"leucine_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Leucine content of the associated food(s)."},"lysine_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Lysine content of the associated food(s)."},"methionine_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Methionine content of the associated food(s)."},"phenylalanine_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Phenylalanine content of the associated food(s)."},"threonine_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Threonine content of the associated food(s)."},"tryptophan_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Tryptophan content of the associated food(s)."},"tyrosine_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Tyrosine content of the associated food(s)."},"valine_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Valine content of the associated food(s)."},"monounsaturated_fat_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Monounsaturated fat content of the associated food(s)."},"polyunsaturated_fat_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Polyunsaturated fat content of the associated food(s)."},"omega3_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Omega3 content of the associated food(s)."},"omega6_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Omega6 content of the associated food(s)."},"starch_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Starch content of the associated food(s)."}}},"MealType":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"unit":{"$ref":"#/components/schemas/NutritionUnits"},"amount":{"type":"number"}},"required":["unit","amount"]},"NutritionMacros":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"alcohol_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Alcohol content of the associated food(s)."},"calories":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Calorie content of the associated food(s)."},"carbohydrates_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Carbohydrates content of the associated food(s)."},"cholesterol_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Cholesterol content of the associated food(s)."},"fat_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Fat content of the associated food(s)."},"fiber_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Fiber content of the associated food(s)."},"net_carbohydrates_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Net carbs content of the associated food(s)."},"protein_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Protein content of the associated food(s)."},"saturated_fat_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Saturated fat content of the associated food(s)."},"sodium_mg":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Sodium content of the associated food(s)."},"sugar_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Sugar content of the associated food(s)."},"trans_fat_g":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Trans fat content of the associated food(s)."}}},"NutritionMetadata":{"$schema":"https://json-schema.org/draft/2020-12/schema","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":{"anyOf":[{"$ref":"#/components/schemas/TimestampLocalization"},{"type":"null"}]}},"required":["end_time","start_time"]},"TimestampLocalization":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"macros":{"anyOf":[{"$ref":"#/components/schemas/NutritionMacros"},{"type":"null"}],"description":"Summary of macronutrient information for a given day."},"micros":{"anyOf":[{"$ref":"#/components/schemas/NutritionMicros"},{"type":"null"}],"description":"Summary of micronutrient information for a given day."},"water_ml":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Water consumption of the user for a given day."},"drink_ml":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Non-water drink consumption of the user for a given day."}}},"DataSentToWebhook":{"type":"object","required":["reference","status","trace_id","type","user"],"description":"Acknowledgement returned when `to_webhook` is true (the default): the requested data is fetched asynchronously and delivered to your configured destination, and this body confirms the request was accepted.\n","properties":{"status":{"type":"string","enum":["success"]},"type":{"type":"string","description":"The data type that was requested (e.g. `activity`, `sleep`)."},"reference":{"type":"string","description":"Payload reference, tying this request to the webhook payload you will receive."},"trace_id":{"type":"string","description":"Trace identifier for this request (equal to `reference`)."},"message":{"type":"string","description":"Present only for large requests (date range over one month), which are delivered in chunks."},"user":{"type":"object","description":"Summary of the connection the data was requested for.","properties":{"user_id":{"type":"string"},"provider":{"type":"string"},"reference_id":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"active":{"type":"boolean"},"scopes":{"type":"string","description":"Comma-separated list of granted scopes."},"last_webhook_update":{"type":["string","null"],"format":"date-time"}}}}},"Problem":{"type":"object","description":"An error response, following RFC 9457 (Problem Details for HTTP APIs, which obsoletes RFC 7807). Returned with `Content-Type: application/problem+json` on every 4xx/5xx response. The HTTP status line carries the status code; it is intentionally not repeated in the body. `type`, `title` and `instance` are always present; `detail` is included when a specific explanation is available.\n","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance"]},"UnauthorizedProblem":{"type":"object","description":"A refused credential, always with its code.","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance","code"]}},"responses":{"BadRequest":{"description":"One or more parameters is malformed. The `detail` field describes the specific problem.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"Unauthorized":{"description":"The credential is missing, invalid, expired or revoked (code `unauthorized`).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorizedProblem"}}}},"Forbidden":{"description":"The credential is not authorized (code scope_missing or audience_restricted), the environment is disabled (environment_disabled), or the required product entitlement is missing (entitlement_required).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"NotFound":{"description":"A referenced resource does not exist on Terra's end.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"AuthorizationUnavailable":{"description":"The credential or the product access could not be checked (code `authorization_unavailable`). Retry after the service recovers.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"paths":{"/nutrition":{"get":{"summary":"Retrieve nutrition data","description":"Returns a user's nutrition logs in a date range, such as meal type, calories and macronutrients.\n\n- A range longer than one month is delivered in chunks, announced by `large_request_processing` and `large_request_sending` events.\n- Returns `404` if the user's provider does not offer this data type, and `400` if your environment does not collect it.","tags":["HealthData"],"operationId":"Nutrition_Get","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (a UUID) of the user to retrieve data for.","schema":{"type":"string"},"required":true},{"name":"start_date","in":"query","description":"Start of the period to retrieve, as an ISO 8601 date (YYYY-MM-DD) or a 10-digit unix timestamp in seconds. A date in the future is refused with `400`.","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":true},{"name":"end_date","in":"query","description":"End of the period to retrieve, as an ISO 8601 date (YYYY-MM-DD) or a 10-digit unix timestamp in seconds. Defaults to one day after `start_date`; a future value is clamped to the current time, and a value before `start_date` is refused with `400`.","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":false},{"name":"to_webhook","in":"query","description":"Whether to deliver the data to your destinations as data events instead of in the response. Defaults to `true`. `false` with a range longer than one month is refused with `400`, as is `true` when your environment has no destination.","schema":{"type":"boolean"},"required":false},{"name":"with_samples","in":"query","description":"Whether to include detailed samples in the returned data. Omit it to follow your environment's samples setting for this data type.","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"]}},"required":["data"]},{"$ref":"#/components/schemas/DataSentToWebhook"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/AuthorizationUnavailable"}}}}}}
```

## Retrieve sleep sessions

> Returns a user's sleep sessions in a date range, each with a start and end time, covering duration, stages and quality.\
> \
> \- A range longer than one month is delivered in chunks, announced by \`large\_request\_processing\` and \`large\_request\_sending\` events.\
> \- Returns \`404\` if the user's provider does not offer this data type, and \`400\` if your environment does not collect it.

```json
{"openapi":"3.2.0","info":{"title":"Terra API","version":"2026.11.19"},"tags":[{"name":"HealthData","summary":"Health data","description":"Read a user's activity, athlete profile, body, daily, menstruation, nutrition and sleep data over a date range."}],"servers":[{"url":"https://access.tryterra.co/api/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","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"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Time at which the connection was created"},"last_webhook_update":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last time at which a webhook update was sent for the connection"},"scopes":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"(when available) Permissions granted by the user during authentication - to be used as debugging metadata"},"reference_id":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Connection identifier on the developer's end, used to tie connection back to a user on the developer's platform"},"active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"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","type":"object","properties":{"data_enrichment":{"anyOf":[{"$ref":"#/components/schemas/SleepDataEnrichment"},{"type":"null"}],"description":"Object containing additional enrichment data for the sleep session."},"trends":{"anyOf":[{"$ref":"#/components/schemas/TrendsData"},{"type":"null"}],"description":"Personal 30-day baselines and trends for the user as of this session (trends product). Null for customers without the product enabled."},"device_data":{"anyOf":[{"$ref":"#/components/schemas/DeviceData"},{"type":"null"}],"description":"Object containing information on the device which recorded data for the payload."},"heart_rate_data":{"anyOf":[{"$ref":"#/components/schemas/HeartRateData"},{"type":"null"}],"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":{"anyOf":[{"$ref":"#/components/schemas/ReadinessData"},{"type":"null"}],"description":"Object containing information on the user's readiness for the day, based off the quality and duration of their sleep."},"respiration_data":{"anyOf":[{"$ref":"#/components/schemas/RespirationData"},{"type":"null"}],"description":"Object containing information on the user's respiration throughout the sleep session."},"scores":{"anyOf":[{"$ref":"#/components/schemas/SleepScores"},{"type":"null"}],"description":"Scores summarising the user's sleep session."},"sleep_durations_data":{"anyOf":[{"$ref":"#/components/schemas/SleepDurationsData"},{"type":"null"}],"description":"Object containing information on the user's duration spent in various sleep stages."},"temperature_data":{"anyOf":[{"$ref":"#/components/schemas/SleepTemperatureData"},{"type":"null"}],"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","type":"object","properties":{"sleep_score":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Sleep score for the session."},"sleep_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"Map of contributing factor name to its weighted contribution to the sleep score."},"readiness_score":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Readiness score resulting from the sleep session."},"readiness_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"Map of contributing factor name to its weighted contribution to the readiness score."},"sleep_score_v2":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Sleep score for the session, computed by the v2 model."},"sleep_score_v2_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"Map of contributing factor name to its weighted contribution to the v2 sleep score."},"respiratory_score_v2":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Respiratory score for the session, computed by the v2 model."},"respiratory_score_v2_contributors":{"anyOf":[{"$ref":"#/components/schemas/RecordFloat"},{"type":"null"}],"description":"Map of contributing factor name to its weighted contribution to the v2 respiratory score."}},"$defs":{"RecordFloat":{"type":"object","properties":{},"unevaluatedProperties":{"type":"number"}}}},"RecordFloat":{"type":"object","properties":{},"unevaluatedProperties":{"type":"number"}},"TrendsData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"window_days":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"Length of each window in days."},"window_end":{"type":"string","description":"Inclusive ISO date (yyyy-mm-dd) the trailing window ends on: the last completed local day before the record's own."},"resting_heart_rate":{"anyOf":[{"$ref":"#/components/schemas/MetricTrend"},{"type":"null"}],"description":"Resting heart rate trend, in bpm. Source: daily summaries."},"hrv_rmssd":{"anyOf":[{"$ref":"#/components/schemas/MetricTrend"},{"type":"null"}],"description":"Heart-rate variability (RMSSD) trend, in ms. Source: sleep sessions."},"hrv_sdnn":{"anyOf":[{"$ref":"#/components/schemas/MetricTrend"},{"type":"null"}],"description":"Heart-rate variability (SDNN) trend, in ms. Source: sleep sessions. Apple Health reports SDNN rather than RMSSD."},"sleep_duration":{"anyOf":[{"$ref":"#/components/schemas/MetricTrend"},{"type":"null"}],"description":"Time asleep per session trend, in seconds (matches sleep_durations_data.asleep_time). Source: sleep sessions."}},"required":["window_days","window_end"],"description":"Personal baselines and trends for the user, as of the record. Present on sleep and daily payloads for customers with the trends product enabled; null otherwise."},"MetricTrend":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"baseline":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Median of the trailing window, in the metric's own units (bpm, ms, seconds)."},"average":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Mean of the trailing window."},"previous_average":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Mean of the window immediately preceding the trailing window."},"delta":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"average minus previous_average. Present only when both averages are."},"days_with_data":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"Number of days with data in the trailing window."},"previous_days_with_data":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"Number of days with data in the preceding window."}},"required":["days_with_data","previous_days_with_data"],"description":"Personal trend for one metric, computed by Terra from the user's own stored daily values. Both windows are trailing calendar-day windows that end the day BEFORE the record's own local day, so the record's value is never inside its own baseline. Statistics are absent (null) when the window has no data; the day counts say how much history stands behind each number."},"DeviceData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"activation_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Activation timestamp of the device, if applicable."},"data_provided":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"}},{"type":"null"}],"description":"Data provided by the device, as enumerated types."},"hardware_version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Hardware version of the device."},"last_upload_date":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last upload date from the device."},"manufacturer":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device manufacturer name."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/OtherDeviceData"}},{"type":"null"}],"description":"Data pertaining to other devices which may have contributed data for this workout."},"serial_number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Serial Number."},"software_version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Software Version."}}},"DeviceDataType":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"manufacturer":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device manufacturer name."},"hardware_version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Hardware version of the device."},"serial_number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Serial Number."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Device Software Version."},"data_provided":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/DeviceDataType"}},{"type":"null"}],"description":"Data provided by the device, as enumerated types."},"last_upload_date":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last upload date from the device."}}},"HeartRateData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"detailed":{"anyOf":[{"$ref":"#/components/schemas/HeartRateDataDetailed"},{"type":"null"}],"description":"Object containing detailed heart rate information for the associated workout."},"summary":{"anyOf":[{"$ref":"#/components/schemas/HeartRateDataSummary"},{"type":"null"}],"description":"Object containing summary heart rate information for the associated workout."}}},"HeartRateDataDetailed":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"hr_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateDataSample"}},{"type":"null"}],"description":"Array of HeartRate data samples recorded for the user during the workout."},"hrv_samples_rmssd":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleRMSSD"}},{"type":"null"}],"description":"Array of HeartRate Variability data samples recorded for the user during the workout, computed using RMSSD."},"hrv_samples_sdnn":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateVariabilityDataSampleSDNN"}},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's heart rate in bpm"},"timer_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Time elapsed since the start of the workout, subtracting time during which the recording was paused"},"context":{"anyOf":[{"$ref":"#/components/schemas/HeartRateContext"},{"type":"null"}],"description":"Represents the context in which heart rate was measured."}}},"HeartRateContext":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's Heart Rate Variability, computed using RMSSD"}}},"HeartRateVariabilityDataSampleSDNN":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's Heart Rate Variability, computed using SDNN"}}},"HeartRateDataSummary":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"avg_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Average HeartRate of the user during the workout."},"avg_hrv_rmssd":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average HeartRate Variability of the user during the workout, computed using RMSSD."},"avg_hrv_sdnn":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average HeartRate Variability of the user during the workout, computed using SDNN."},"hr_zone_data":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/HeartRateZoneData"}},{"type":"null"}],"description":"Array of time spent in various HR zones throughout the workout."},"max_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Maximum HeartRate of the user during the workout."},"min_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Minimum HeartRate of the user during the workout."},"resting_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"description":"Resting HeartRate of the user, as determined by the fitness data provider."},"user_max_hr_bpm":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"zone":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Heart rate zone designation, as a zero-based zone index."},"start_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"maximum":100,"description":"Start percentage (based off user's max HR) of the HR zone"},"end_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"maximum":100,"description":"End percentage (based off user's max HR) of the HR zone"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Name of the associated heart rate zone"},"duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Duration spent in the heart rate zone"}}},"SleepMetadata":{"$schema":"https://json-schema.org/draft/2020-12/schema","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":{"anyOf":[{"type":"boolean"},{"type":"null"}],"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":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"A unique identifier for the sleep session."},"timestamp_localization":{"anyOf":[{"$ref":"#/components/schemas/TimestampLocalization"},{"type":"null"}]},"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","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","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","type":"object","properties":{"readiness":{"anyOf":[{"type":"number"},{"type":"null"}],"minimum":0,"maximum":100,"description":"User's readiness score for a given day, resulting from the sleep session."},"recovery_level":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's recovery score for a given day, resulting from the sleep session."}}},"RespirationData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"breaths_data":{"anyOf":[{"$ref":"#/components/schemas/BreathsData"},{"type":"null"}],"description":"Object containing information on breathing rate for the sleep session."},"oxygen_saturation_data":{"anyOf":[{"$ref":"#/components/schemas/OxygenSaturationData"},{"type":"null"}],"description":"Object containing information on saturation metrics for the sleep session."},"snoring_data":{"anyOf":[{"$ref":"#/components/schemas/SnoringData"},{"type":"null"}],"description":"Object containing information on snoring metrics for the sleep session."}}},"BreathsData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"avg_breaths_per_min":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average breathing rate of the user during the sleep session."},"max_breaths_per_min":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Maximum breathing rate of the user during the sleep session."},"min_breaths_per_min":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Minimum breathing rate of the user during the sleep session."},"on_demand_reading":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Flag indicating if the reading was performed on demand, or if it was automatically captured by the device."},"samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/BreathSample"}},{"type":"null"}],"description":"List of breathing rate information sampled throughout the sleep session."},"start_time":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"string"},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's respiration rate"}}},"OxygenSaturationData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"avg_saturation_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Average Oxygen Saturation percentage of the user during the sleep session."},"end_time":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/OxygenSaturationSample"}},{"type":"null"}],"description":"Array of Oxygen Saturation percentage datapoints sampled throughout the sleep session."},"start_time":{"anyOf":[{"type":"string"},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's oxygen saturation percentage - referring to either SpO2 or SmO2, based on the `type` field"},"type":{"anyOf":[{"$ref":"#/components/schemas/OxygenSaturationType"},{"type":"null"}],"description":"Type of oxygen saturation measurement (i.e. blood vs muscle)"}}},"OxygenSaturationType":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"start_time":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Number of times over the sleep period when the user started snoring, as determined by the device."},"samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/SnoringSample"}},{"type":"null"}],"description":"List of snoring information data points sampled throughout the sleep session."},"total_snoring_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total duration for which the user was snoring."}}},"SnoringSample":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Duration of snoring episode, in seconds"}}},"SleepScores":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"sleep":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"User's sleep score for the session."}}},"SleepDurationsData":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"asleep":{"anyOf":[{"$ref":"#/components/schemas/AsleepDurations"},{"type":"null"}],"description":"Object containing information on the duration the user spent asleep during the sleep recording session."},"awake":{"anyOf":[{"$ref":"#/components/schemas/AwakeDurations"},{"type":"null"}],"description":"Object containing information on the duration the user spent awake during the sleep recording session."},"hypnogram_samples":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/SleepHypnogramSample"}},{"type":"null"}],"description":"List of sleep stage (Hypnogram) samples recorded during the user's sleep session."},"other":{"anyOf":[{"$ref":"#/components/schemas/OtherSleepDurations"},{"type":"null"}],"description":"Object containing information on the miscellaneous duration data for the sleep recording session."},"sleep_efficiency":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"duration_asleep_state_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total duration for which the user was asleep, in any state."},"duration_deep_sleep_state_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total duration for which the user was in a state of deep sleep."},"duration_light_sleep_state_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total duration for which the user was in a state of light sleep."},"duration_REM_sleep_state_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total duration for which the user was in a state of REM sleep."},"num_REM_events":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Number of periods of REM sleep captured during the sleep session."}}},"AwakeDurations":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"duration_awake_state_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total duration for which the user was awake during the sleep session."},"duration_long_interruption_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"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":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Number of times the user got out of bed during the sleep session."},"num_wakeup_events":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Number of times the user woke up during the sleep session."},"sleep_latency_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"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":{"anyOf":[{"$ref":"#/components/schemas/SleepLevel"},{"type":"null"}]}}},"SleepLevel":{"$schema":"https://json-schema.org/draft/2020-12/schema","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","type":"object","properties":{"duration_in_bed_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Total duration of time spent in bed."},"duration_unmeasurable_sleep_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"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","type":"object","properties":{"delta":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Variation in user's skin temperature from their baseline."},"avg_skin_temperature_celsius":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Mean absolute skin temperature in degrees Celsius over the sleep window. Null for providers that only report a baseline deviation."}}},"DataSentToWebhook":{"type":"object","required":["reference","status","trace_id","type","user"],"description":"Acknowledgement returned when `to_webhook` is true (the default): the requested data is fetched asynchronously and delivered to your configured destination, and this body confirms the request was accepted.\n","properties":{"status":{"type":"string","enum":["success"]},"type":{"type":"string","description":"The data type that was requested (e.g. `activity`, `sleep`)."},"reference":{"type":"string","description":"Payload reference, tying this request to the webhook payload you will receive."},"trace_id":{"type":"string","description":"Trace identifier for this request (equal to `reference`)."},"message":{"type":"string","description":"Present only for large requests (date range over one month), which are delivered in chunks."},"user":{"type":"object","description":"Summary of the connection the data was requested for.","properties":{"user_id":{"type":"string"},"provider":{"type":"string"},"reference_id":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"active":{"type":"boolean"},"scopes":{"type":"string","description":"Comma-separated list of granted scopes."},"last_webhook_update":{"type":["string","null"],"format":"date-time"}}}}},"Problem":{"type":"object","description":"An error response, following RFC 9457 (Problem Details for HTTP APIs, which obsoletes RFC 7807). Returned with `Content-Type: application/problem+json` on every 4xx/5xx response. The HTTP status line carries the status code; it is intentionally not repeated in the body. `type`, `title` and `instance` are always present; `detail` is included when a specific explanation is available.\n","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance"]},"UnauthorizedProblem":{"type":"object","description":"A refused credential, always with its code.","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance","code"]}},"responses":{"BadRequest":{"description":"One or more parameters is malformed. The `detail` field describes the specific problem.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"Unauthorized":{"description":"The credential is missing, invalid, expired or revoked (code `unauthorized`).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorizedProblem"}}}},"Forbidden":{"description":"The credential is not authorized (code scope_missing or audience_restricted), the environment is disabled (environment_disabled), or the required product entitlement is missing (entitlement_required).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"NotFound":{"description":"A referenced resource does not exist on Terra's end.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"AuthorizationUnavailable":{"description":"The credential or the product access could not be checked (code `authorization_unavailable`). Retry after the service recovers.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"paths":{"/sleep":{"get":{"summary":"Retrieve sleep sessions","description":"Returns a user's sleep sessions in a date range, each with a start and end time, covering duration, stages and quality.\n\n- A range longer than one month is delivered in chunks, announced by `large_request_processing` and `large_request_sending` events.\n- Returns `404` if the user's provider does not offer this data type, and `400` if your environment does not collect it.","tags":["HealthData"],"operationId":"Sleep_Get","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (a UUID) of the user to retrieve data for.","schema":{"type":"string"},"required":true},{"name":"start_date","in":"query","description":"Start of the period to retrieve, as an ISO 8601 date (YYYY-MM-DD) or a 10-digit unix timestamp in seconds. A date in the future is refused with `400`.","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":true},{"name":"end_date","in":"query","description":"End of the period to retrieve, as an ISO 8601 date (YYYY-MM-DD) or a 10-digit unix timestamp in seconds. Defaults to one day after `start_date`; a future value is clamped to the current time, and a value before `start_date` is refused with `400`.","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date"}]},"required":false},{"name":"to_webhook","in":"query","description":"Whether to deliver the data to your destinations as data events instead of in the response. Defaults to `true`. `false` with a range longer than one month is refused with `400`, as is `true` when your environment has no destination.","schema":{"type":"boolean"},"required":false},{"name":"with_samples","in":"query","description":"Whether to include detailed samples in the returned data. Omit it to follow your environment's samples setting for this data type.","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"]}},"required":["data"]},{"$ref":"#/components/schemas/DataSentToWebhook"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/AuthorizationUnavailable"}}}}}}
```

## List clinical records

> Returns a user's clinical records (Apple Health Records) as the raw FHIR resources their health systems served, oldest received first.\
> \
> \- Records arrive only by SDK upload, so this reads what Terra has received: there is no date range and nothing is fetched from the device.\
> \- Page with \`next\_cursor\`, and read \`has\_more\` to know whether more records are available now. A page can hold fewer than \`limit\` records and still have more, because pages are also bounded by the size of the resources they carry.\
> \- \`next\_cursor\` is always returned, including on the last page and on an empty one, so it doubles as a polling position: store it and send it on the next poll to receive only what arrived since. An empty page returns the position you asked from (your \`cursor\`, or the \`received\_since\` boundary).\
> \- A record whose content changes moves to the end of the order with a new \`received\_at\`, so a consumer following \`next\_cursor\` sees the record again, at its latest content, after each change. Revisions made between two polls collapse into the latest one. An unchanged re-upload does not move it, and neither does an upload of an older version than the one stored.\
> \- Records received in the last 60 seconds are not returned yet. Holding them back means a record still becoming visible cannot land behind a \`next\_cursor\` already issued, so a consumer following the cursor never misses one; a record uploaded now appears in this list about a minute later. The webhook is not delayed.\
> \- A record whose stored resource Terra cannot read is still returned, with \`fhir\_resource\` null and \`fhir\_resource\_error\` set, so the rest of the page and paging past it are unaffected.\
> \- Upsert on \`record\_id\`. Records are never deleted.\
> \- Returns \`400\` if your environment does not collect clinical records.

```json
{"openapi":"3.2.0","info":{"title":"Terra API","version":"2026.11.19"},"tags":[{"name":"HealthData","summary":"Health data","description":"Read a user's activity, athlete profile, body, daily, menstruation, nutrition and sleep data over a date range."}],"servers":[{"url":"https://access.tryterra.co/api/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":{"ClinicalRecordType":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"string","const":"allergy"},{"type":"string","const":"condition"},{"type":"string","const":"immunization"},{"type":"string","const":"lab_result"},{"type":"string","const":"medication"},{"type":"string","const":"procedure"},{"type":"string","const":"vital_sign"},{"type":"string","const":"coverage"},{"type":"string","const":"clinical_note"},{"type":"string"}],"description":"The kind of clinical record, from HealthKit's clinical type identifiers, in snake_case. The values may be extended: a type Apple adds is stored and served in the same snake_case spelling before it is listed here."},"ClinicalRecord":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"record_id":{"type":"string","description":"Stable identifier of this record for this user, derived from its source and FHIR resource type and identifier. Re-uploads and revisions of the same resource keep it: treat it as the upsert key."},"clinical_type":{"$ref":"#/components/schemas/ClinicalRecordType","description":"The kind of clinical record."},"display_name":{"type":"string","description":"The record's display name as the phone's health store shows it."},"source_name":{"type":"string","description":"Name of the health system the record came from."},"source_bundle_id":{"type":"string","description":"Bundle identifier of the health system's source in the phone's health store."},"downloaded_at":{"type":"string","description":"When the phone's health store downloaded the resource, in ISO8601 format with microsecond precision. Not a clinical date: those are inside fhir_resource. A device time later than when Terra received the upload is replaced by the receive time."},"received_at":{"type":"string","description":"When Terra stored this content of the record, in ISO8601 format with microsecond precision. Moves only when the content changes."},"fhir":{"$ref":"#/components/schemas/ClinicalRecordFhir","description":"Metadata about the FHIR resource."},"fhir_resource":{"anyOf":[{"$ref":"#/components/schemas/RecordUnknown"},{"type":"null"}],"description":"The FHIR resource as served by the health system, as a JSON object: the downloaded bytes with insignificant whitespace removed and nothing else changed (strings, markup and decimal precision are as served). Clinical notes can embed large attachments. Null only when fhir_resource_error is set."},"fhir_resource_error":{"anyOf":[{"type":"string","const":"fhir_resource_unavailable"},{"type":"null"}],"description":"Why fhir_resource is null: `fhir_resource_unavailable` when Terra could not read the stored resource. The record's metadata is still served so the rest of the page, and paging past it, are unaffected. Null when fhir_resource is present."}},"required":["record_id","clinical_type","display_name","source_name","source_bundle_id","downloaded_at","received_at","fhir","fhir_resource","fhir_resource_error"],"$defs":{"RecordUnknown":{"type":"object","properties":{},"unevaluatedProperties":{}}}},"ClinicalRecordFhir":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"resource_type":{"type":"string","description":"The FHIR resource type."},"identifier":{"type":"string","description":"The resource's identifier at the health system. Unique only within one source: two health systems can reuse an identifier."},"release":{"anyOf":[{"type":"string","const":"R4"},{"type":"string","const":"DSTU2"},{"type":"string"},{"type":"null"}],"description":"The FHIR release of the resource as the phone reported it, today R4 or DSTU2. The values may be extended: a release a newer iOS reports is stored as received. Null when the phone did not report one (iOS before 14)."},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Where the health system served the resource from, when reported."},"content_sha256":{"type":"string","description":"Hex SHA-256 of the resource bytes exactly as the phone downloaded them, which fhir_resource carries with insignificant whitespace removed, so hashing fhir_resource does not reproduce it. Changes when, and only when, the downloaded resource changes."},"byte_size":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"Size of the resource bytes as downloaded, before whitespace is removed for fhir_resource."}},"required":["resource_type","identifier","release","source_url","content_sha256","byte_size"]},"RecordUnknown":{"type":"object","properties":{},"unevaluatedProperties":{}},"Problem":{"type":"object","description":"An error response, following RFC 9457 (Problem Details for HTTP APIs, which obsoletes RFC 7807). Returned with `Content-Type: application/problem+json` on every 4xx/5xx response. The HTTP status line carries the status code; it is intentionally not repeated in the body. `type`, `title` and `instance` are always present; `detail` is included when a specific explanation is available.\n","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance"]},"UnauthorizedProblem":{"type":"object","description":"A refused credential, always with its code.","properties":{"type":{"type":"string","description":"A URI reference identifying the problem type. Defaults to `about:blank`."},"title":{"type":"string","description":"A short, human-readable summary of the problem type (the lowercased HTTP status text)."},"instance":{"type":"string","description":"The request path, including any query string, that produced this problem."},"code":{"type":"string","description":"Stable error classification: branch on this, not on `detail`. A refused credential returns unauthorized (401: missing, invalid, expired or revoked), scope_missing (403: the credential lacks the scope the operation requires) or audience_restricted (403: the credential is not granted for this dev-id). authorization_unavailable (503) means the credential or the product access could not be checked; retry later. Product gates return entitlement_required (403) or environment_disabled (403). service_unavailable (503) means the request never reached the service; dependency_failed (502 or 504) means the service did not complete it, though it may already have acted on it. Report uploads return validation_failed, unsupported_file_type or too_many_files (400), payload_too_large (413) and rate_limited (429)."},"product":{"type":"string","description":"The product checked by the authorization gate, when classified."},"detail":{"type":"string","description":"A human-readable explanation specific to this occurrence of the problem."}},"required":["type","title","instance","code"]}},"responses":{"BadRequest":{"description":"One or more parameters is malformed. The `detail` field describes the specific problem.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"Unauthorized":{"description":"The credential is missing, invalid, expired or revoked (code `unauthorized`).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/UnauthorizedProblem"}}}},"Forbidden":{"description":"The credential is not authorized (code scope_missing or audience_restricted), the environment is disabled (environment_disabled), or the required product entitlement is missing (entitlement_required).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"NotFound":{"description":"A referenced resource does not exist on Terra's end.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"AuthorizationUnavailable":{"description":"The credential or the product access could not be checked (code `authorization_unavailable`). Retry after the service recovers.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"paths":{"/clinicalRecord":{"get":{"summary":"List clinical records","description":"Returns a user's clinical records (Apple Health Records) as the raw FHIR resources their health systems served, oldest received first.\n\n- Records arrive only by SDK upload, so this reads what Terra has received: there is no date range and nothing is fetched from the device.\n- Page with `next_cursor`, and read `has_more` to know whether more records are available now. A page can hold fewer than `limit` records and still have more, because pages are also bounded by the size of the resources they carry.\n- `next_cursor` is always returned, including on the last page and on an empty one, so it doubles as a polling position: store it and send it on the next poll to receive only what arrived since. An empty page returns the position you asked from (your `cursor`, or the `received_since` boundary).\n- A record whose content changes moves to the end of the order with a new `received_at`, so a consumer following `next_cursor` sees the record again, at its latest content, after each change. Revisions made between two polls collapse into the latest one. An unchanged re-upload does not move it, and neither does an upload of an older version than the one stored.\n- Records received in the last 60 seconds are not returned yet. Holding them back means a record still becoming visible cannot land behind a `next_cursor` already issued, so a consumer following the cursor never misses one; a record uploaded now appears in this list about a minute later. The webhook is not delayed.\n- A record whose stored resource Terra cannot read is still returned, with `fhir_resource` null and `fhir_resource_error` set, so the rest of the page and paging past it are unaffected.\n- Upsert on `record_id`. Records are never deleted.\n- Returns `400` if your environment does not collect clinical records.","tags":["HealthData"],"operationId":"ClinicalRecord_List","parameters":[{"name":"user_id","in":"query","description":"Terra user ID (a UUID) of the user to retrieve clinical records for.","schema":{"type":"string"},"required":true},{"name":"resource_type","in":"query","description":"Only records of this FHIR resource type, such as `Observation` or `AllergyIntolerance`.","schema":{"type":"string"},"required":false},{"name":"clinical_type","in":"query","description":"Only records of this clinical type. Any snake_case value is accepted, including one not yet listed in the enum, because a type Apple adds is stored under its snake_case spelling before Terra lists it; the match is exact.","schema":{"$ref":"#/components/schemas/ClinicalRecordType"},"required":false},{"name":"received_since","in":"query","description":"Only records Terra received at or after this time, as an ISO 8601 timestamp or date, or a unix timestamp in seconds. A number of more than 10 digits (a timestamp in milliseconds), or a time before 1970, is a `400`. Ignored when `cursor` is sent.","schema":{"oneOf":[{"type":"integer"},{"type":"string","format":"date-time"}]},"required":false},{"name":"cursor","in":"query","description":"The previous page's `next_cursor`. Send it with the same `user_id`, `resource_type` and `clinical_type` it was issued for; with different ones it is a `400`.","schema":{"type":"string"},"required":false},{"name":"limit","in":"query","description":"Records per page. Defaults to 50; a larger value than 100 is served as 100.","schema":{"type":"integer","minimum":1,"default":50},"required":false}],"responses":{"200":{"description":"One page of clinical records.","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","const":"clinical_record"},"user_id":{"type":"string","description":"The Terra user ID the records belong to."},"data":{"type":"array","items":{"$ref":"#/components/schemas/ClinicalRecord"}},"next_cursor":{"type":"string","description":"Pass as `cursor` for the next page or the next poll. Always present; on an empty page it is the position the request asked from."},"has_more":{"type":"boolean","description":"More records are available now. False on the last page; poll again later with `next_cursor` for records received since."}},"required":["type","user_id","data","next_cursor","has_more"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/AuthorizationUnavailable"}}}}}}
```
