• Unified API
  • Mobile SDK
  • Connection Widget
  • Streaming
  • Blood Report API
  • Graph API
  • Health Scores
  • Health Rewards
  • Planned Workouts
  • Lab Testing
  • AI Interface
  • Enterprise
  • Insurance
  • Integrations
  • Research
  • Podcast
  • Blog
  • Reports
  • Events
  • Documentation
  • Community
  • Wearable Data
  • About
  • Customers
  • Partners
  • Careers
  • Support
  • Pricing
Terra
Pricing
Become an integrationGet started
next ventures
pioneer fund
samsung next
y combinator
general catalyst

The world's best health apps run on Terra data

Get started
ProductsIntegrations AI Interface Authentication Mobile Development Documentation GraphAPI
DocumentationAPI SDK Quickstart
CommunityBlog Research Community Podcast Github
CompanyAboutCareersCustomersBecome an IntegrationCookies PolicyGDPRPrivacy PolicyTerms of Purchase
© Terra API. 2026 — All rights reserved.

Cookie Preferences

Essential CookiesAlways On
Advertisement Cookies
Analytics Cookies

Crunch Time: Embrace the Cookie Monster Within!

We use cookies to enhance your browsing experience and analyse our traffic. By clicking “Accept All”, you consent to our use of cookies according to our Cookie Policy. You can change your mind any time by visiting out cookie policy.

Cookies Policy
< Blogs
Elliott Yu
Elliott Yu

April 29, 2022

Behind the Scenes: New Data Models

Update: Mark II

As a fitness and health API provider, the most important thing in our service would not be the reliability or the response time from our service, but rather the data models. They are in essence, our core. Our servers can be absolutely flawless, but with meaningless data models, no developer would ever want to use Terra.

The Beginning

Our data models existed before our API service was even available. We went through meticulous planning on how we should structure fitness data and how to provide them in a manner such that developers can understand and parse them intuitively.

The structure we came up with consisted of a few datatypes: Activity, Daily, Sleep, Body, Athlete, Menstruation, and Nutrition. We structured them in such a way that each of them contains a metadata field that describes the payload we send along with the day or period in which the payload falls under. This way developers instantly know if this is a payload that they require or not. We then populate the rest of the payload with fields that are commonly or in some cases even rarely provided by fitness data providers (for example, MET scores are only provided by two of our providers: Oura and Peloton) such that developers could get every piece of data possible. The names for each data field are then defined along with their units (for example, when we provide distance data, we provide it as distance_meters or Vo2Max data as vo2max_ml_per_min_kg) for maximum transparency.

Same Structure, Twice the Meaning

A couple months ago, we started integrating with more body measurement tracking data providers (such as FatSecret). This led us to finding out that our Body data model had a massive flaw where we only provide a singular data point for every measurement per day. We scrambled and instantly revised the model such that it returns as many data points as possible without loss of data for our developers.

From then, we launched a large scale data model revision. We started going through every field, in every data type provided by every provider to make sure they make sense and are standardised correctly.

This eventually led us to our Mark II models you now find in our docs. We had to make this a completely different version as there was a massive scale name changing for already existing fields and thus our developers would run into error trying to parse them.

A few main changes included: adding seconds to the sleep durations

"asleep": {
    "duration_deep_sleep_state_seconds": Number,
    "duration_REM_sleep_state_seconds": Number,  
    "duration_asleep_state_seconds": Number,
    "num_REM_events": Number,
    "duration_light_sleep_state_seconds": Number
}

splitting a popular data field: HeartRate Variability into both calculation methods SDNN and RMSDD and adding units for heart rate measurements

"heart_rate_data": {
    "summary": {
        "user_max_hr_bpm": Number,
        "min_hr_bpm": Number,
        "avg_hrv_rmssd": Number,
        "avg_hrvy_sdnn": Number,
        "avg_hr_bpm": Number,
        "resting_hr_bpm": Number,
        "max_hr_bpm": Number
    },
    "detailed": {
        "hrv_samples_rmssd": Array,
        "hrv_samples_sdnn": Array,
        "hr_samples": Array
    }
}

and we also made sure that the distance in every distance samples provided are cumulative across every provider!

                                ...
{
    "timestamp": "2022-04-29T07:37:07.179606+00:00",
    "distance_meters": 0,
    "timer_duration_seconds": 0
},
{
    "timestamp": "2022-04-29T07:45:07.179606+00:00",
    "distance_meters": 34.147968322316025,
    "timer_duration_seconds": 8
},
{
    "timestamp": "2022-04-29T07:53:07.179606+00:00",
    "distance_meters": 82.24246883413225,
    "timer_duration_seconds": 16
},
                                ...

We also added a few new data fields, such as micros for our nutrition model to accommodate with the new data we were getting from our new integrations: Cronometer, MyFitnessPal and FatSecret.

"micros": {
    "vitamin_C_mg": Number,
    "calcium_mg": Number,
    "vitamin_A_mg":Number,
    "potassium_mg": Number, 
    "vitamin_B6_mg": Number,
    "zinc_mg": Number,
    "chloride_mg": Number,
    "vitamin_E_mg": Number,
    "phosphorus_mg": Number,
    "manganese_mg": Number,
    "magnesium_mg": Number,
    "riboflavin_mg": Number,
    "biotin_mg": Number,
    "vitamin_K_mg": Number,
    "chromium_mg":Number,
    "niacin_mg": Number,
    "pantothenic_acid_mg": Number,
    "selenium_mg": Number,
    "thiamin_mg": Number,
    "folate_mg": Number,
    "caffeine_mg": Number,
    "vitamin_B12_mg": Number,
    "copper_mg": Number,
    "iodine_mg":Number,
    "iron_mg": Number,
    "folic_acid_mg": Number,
    "vitamin_D_mg": Number,
    "molybdenum_mg": Number,
},

and readiness data due to customer requests:

"readiness_data":{
    "readiness": Number,
    "recovery_level": RecoveryLevel
}

Final Thoughts

The core of our service has never been stronger with our data models in Mark II. The meaning of every field is made a lot more explicit and comprehensible than Mark I, not mentioning the fact that they are also much more consistent across every datatype.

We will always strive to keep making our models better by adding new data fields, or even new data types as per request or per added integration while maintaining the same style: consistency, explicit and comprehensibility. This will always be an everlasting project on our end: providing as much fitness and health data as possible to the world!

Related Articles

The complete guide: How the new Google Health API works

May 18, 2026

The complete guide: How the new Google Health API works

Google Health API replaces the Fitbit Web API. This is the field guide with code, schemas, and a migration playbook to help you understand where Google Health is heading.

Vanessa Neeff
5 Lessons for Standing Out at HLTH

December 5, 2024

5 Lessons for Standing Out at HLTH

5 lessons from team Terra API for making a lasting impact at HLTH: from engaging senses to building real touch points, here’s what we learned from the HLTH event.

Vanessa Neeff
Strava Pulls the Plug on their API: What This Means for Developers

November 21, 2024

Strava Pulls the Plug on their API: What This Means for Developers

Strava discontinued their API service, changing the ecosystem of third-party apps that have relied on their platform. How can developers react to this?

Terra APITerra API

More Topics

All Blogs
Team Spotlight
Startup Spotlight
How To
Blog
Podcast
Product Updates
Wearables
See All >
The complete guide: How the new Google Health API works

The complete guide: How the new Google Health API works

Google Health API replaces the Fitbit Web API. This is the field guide with code, schemas, and a migration playbook to help you understand where Google Health is heading.

Vanessa NeeffVanessa Neeff
May 18, 2026
September 2025 updates

September 2025 updates

July: Terra Research launches, Lab Reports land in the dashboard with PDF/Image → JSON, and Samsung Health moves to the new Data SDK for a tighter Android integration. 🚀

Alex VenetidisAlex Venetidis
October 1, 2025
August 2025 updates

August 2025 updates

🎉 July Highlights: InBody Goes Global, Faster APIs, and Rock-Solid Data 💪📊

Alex VenetidisAlex Venetidis
September 1, 2025
July 2025 updates

July 2025 updates

July = rock-solid Terra: WHOOP V2, Garmin & Fitbit bug fixes, faster SDKs, plus bulk blood-report uploads with smarter reference ranges. Reliability + data power-ups! 💪🩸

Alex VenetidisAlex Venetidis
August 2, 2025
June 2025 Updates

June 2025 Updates

June brings Terra MCPs for AI-driven setup, Fern-powered Python/JS SDKs with strong typing, and official Expo plugin support—build faster with less friction. 🚀🧰📱

Alex VenetidisAlex Venetidis
July 1, 2025