Skip to content
AFAIFitnessAPI
Health Data

Calorie Tracking API: How to Get Calorie Data

Updated July 24, 2026

Calorie tracking is two different problems. Calories burned is a modeled estimate, not a measurement: read it on-device (Apple HealthKit activeEnergyBurned and basalEnergyBurned; Android Health Connect ActiveCaloriesBurnedRecord and TotalCaloriesBurnedRecord) or from cloud wearable APIs after sync. Calories consumed never comes from a wearable and needs a dedicated nutrition API such as Nutritionix or Edamam. Best pick: read the on-device energy types for burn and pair a nutrition API for intake. Both burn figures are estimates that differ across devices.

"Calorie tracking" is really two different problems behind one word, and they use completely different data sources. Calories burned (energy expenditure) is an estimate — a model, never a measurement — derived from heart rate, motion, and your user's profile. You read it from the on-device stores (Apple HealthKit activeEnergyBurned and basalEnergyBurned; Android Health Connect ActiveCaloriesBurnedRecord and TotalCaloriesBurnedRecord) or from cloud wearable APIs. Calories consumed (food intake) never comes from a wearable at all — no sensor measures what someone eats — so it needs a dedicated nutrition API like Nutritionix or Edamam. Best pick: read the on-device energy types for burn with the widest coverage, and pair a nutrition API for intake. For why burn figures differ between devices, see how fitness apps estimate calories — this page is about getting the data.

Calories burned: where you can get it (and why it's an estimate)

Lead with the caveat: calories burned are modeled estimates, not measurements. The same workout yields different numbers on different devices because each vendor uses a proprietary algorithm over heart rate, motion, activity type, and user profile (age, weight, sex). Basal/resting energy in particular is a modeled baseline from a BMR formula, not anything sensed live. Never publish an accuracy percentage — none is sourced — and treat every field name below as "as of 2026, verify" against the provider's live data dictionary.

SourceHow you access itNotes
Apple HealthKit (iOS)On-device read, per-type permissionactiveEnergyBurned (active/exercise energy) and basalEnergyBurned (resting energy); HKWorkout.totalEnergyBurned for a single workout. No cloud pull — read in-app.
Android Health ConnectOn-device read, per-record permissionActiveCaloriesBurnedRecord (active only) and TotalCaloriesBurnedRecord (active + basal/BMR). Apps differ: some write "total," some write "active," so the same activity can appear under different records.
Cloud wearables (Garmin, Fitbit, etc.)Cloud OAuth 2.0Calories exposed in each vendor's API, available after the device syncs. Verify exact fields per provider.
Aggregators (Terra, Junction, Rook)One cloud OAuth + normalized schemaNormalize burned-calorie data across many sources behind one schema. See wearable data APIs.

The developer gotcha here is active versus total. On HealthKit, activeEnergyBurned and basalEnergyBurned are separate — sum them yourself if you want an all-day total, and don't double-count against a workout's totalEnergyBurned. On Health Connect, TotalCaloriesBurnedRecord already includes basal while ActiveCaloriesBurnedRecord does not, so mixing them, or summing across apps that populate them differently, will inflate the number. Verify how each source populates these before you add anything up.

Calories consumed: this needs a nutrition API, not a wearable

No wearable, phone sensor, or on-device motion model can tell you what someone ate. Calories consumed comes from food-logging against a nutrition database, which means a dedicated REST API:

  • Nutritionix — a food/nutrition database with natural-language food logging. Verify current endpoints, pricing, and terms in its developer docs.
  • Edamam — a Nutrition Analysis API that parses natural-language food ("1 cup rice, 10 oz chickpeas") and returns calories plus roughly 28 macro- and micronutrients, with a food-logging nutrition mode. Verify current fields and quotas in its docs.

You can also store and read logged intake on-device: HealthKit exposes dietary energy (dietaryEnergyConsumed) and Health Connect has a NutritionRecord — verify exact field names in each platform's data dictionary. But those are stores for intake a user or app already logged, not a source of nutrition facts; the facts still come from a nutrition database. Compare providers in nutrition APIs rather than duplicating that here.

Measured or estimated?

  • Calories burned: estimated / modeled. Derived from heart rate, motion, activity type, and user profile via proprietary per-vendor algorithms. Numbers disagree across devices for the same activity; basal energy is a formula-based baseline. Say this plainly to your users and never present it as a measurement.
  • Calories consumed: as good as the food database and the user's logging. A nutrition API returns database values for the item logged — accurate for the matched food, but dependent on the user picking the right item and portion. It is a lookup, not a measurement of the specific meal.

Neither figure is sensor ground truth. Framing calorie data as a precise readout is misleading; treat both as wellness estimates.

Which should you pick?

  • Calories burned, widest coverage: read the on-device platform energy types (active + basal on HealthKit; active + total on Health Connect) so you inherit whatever a paired wearable wrote. Keep on-device data on the user's phone until you choose to upload it.
  • Calories burned, server-side: pull from the wearable vendor's cloud API or an aggregator when you need the data without the user's phone in the loop.
  • Calories consumed: a dedicated nutrition APINutritionix or Edamam. A wearable API will never give you intake, so this is a separate integration.

Before you ship

Re-verify each provider's current energy field names, records, and OAuth scopes against its live data dictionary — these change. Distinguish active from total/basal so you don't double-count. Be explicit with users that calories burned are a modeled estimate that varies by device, and that calories consumed depend on a nutrition database plus accurate logging. For the mechanics of the burn estimate itself, hand off to how fitness apps estimate calories.

Frequently asked questions

Are calories burned measured or estimated?
Estimated. Calories burned is a model derived from heart rate, motion, activity type, and your profile (age, weight, sex) via a proprietary per-vendor algorithm, so the same workout yields different numbers on different devices. Basal or resting energy is a formula-based baseline, not a live measurement. Present it as a wellness estimate, never as a precise readout.
How do I get calories consumed from a fitness API?
You do not get intake from a wearable or phone sensor, because nothing measures what a person eats. Calories consumed comes from food logging against a nutrition database, which means a dedicated nutrition API such as Nutritionix or Edamam. On-device stores (HealthKit dietaryEnergyConsumed, Health Connect NutritionRecord) can hold intake a user already logged, but the nutrition facts still come from the database.
What is the difference between active and total calories?
Active energy is exercise/movement calories only; total energy includes basal (resting) energy on top. On HealthKit, activeEnergyBurned and basalEnergyBurned are separate types you sum yourself. On Health Connect, TotalCaloriesBurnedRecord already includes basal while ActiveCaloriesBurnedRecord does not, so mixing them double-counts. Verify how each source populates these before adding anything up.
Why do calorie counts differ between my devices?
Because they are estimates, not measurements. Each vendor uses a different proprietary model over heart rate, motion, and user profile, so an Apple Watch, a Garmin, and a Fitbit can report different calories for the same activity. Do not treat any single figure as ground truth, and avoid publishing accuracy percentages, as none are reliably sourced.
Which API is best for calorie tracking?
For calories burned with the widest coverage, read the on-device platform energy types (active plus basal on HealthKit, active plus total on Health Connect); use a wearable vendor API or an aggregator when you need it server-side. For calories consumed, use a dedicated nutrition API like Nutritionix or Edamam, since a wearable API will never give you intake.

Keep reading

Independent comparison, last reviewed July 24, 2026. Pricing, rate limits, and feature availability change often — confirm current details in each provider’s official documentation before you commit. Product and company names are trademarks of their respective owners; AIFitnessAPI is not affiliated with, endorsed by, or sponsored by any product listed here.

← All health data · by AIFitnessAPI