---
title: "Calorie Tracking API: How to Get Calorie Data"
canonical: "https://aifitnessapi.com/data/calorie-tracking-api"
cluster: "Health Data"
primary_query: "calorie tracking api"
last_reviewed: "2026-07-24"
description: "Get calorie data from HealthKit, Health Connect and wearables. Burned calories are estimates; consumed needs a nutrition API like Nutritionix."
publisher: "AIFitnessAPI — independent, not sponsored"
cite_as: "\"Calorie Tracking API: How to Get Calorie Data\", AIFitnessAPI, https://aifitnessapi.com/data/calorie-tracking-api"
---

# Calorie Tracking API: How to Get Calorie Data

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

- Canonical: https://aifitnessapi.com/data/calorie-tracking-api
- Last reviewed: 2026-07-24
- Publisher: AIFitnessAPI (https://aifitnessapi.com) — independent, not sponsored
- Cite as: "Calorie Tracking API: How to Get Calorie Data", AIFitnessAPI, https://aifitnessapi.com/data/calorie-tracking-api

---

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

| Source | How you access it | Notes |
| --- | --- | --- |
| Apple HealthKit (iOS) | On-device read, per-type permission | `activeEnergyBurned` (active/exercise energy) and `basalEnergyBurned` (resting energy); `HKWorkout.totalEnergyBurned` for a single workout. No cloud pull — read in-app. |
| Android Health Connect | On-device read, per-record permission | `ActiveCaloriesBurnedRecord` (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.0 | Calories exposed in each vendor's API, available after the device syncs. Verify exact fields per provider. |
| Aggregators (Terra, Junction, Rook) | One cloud OAuth + normalized schema | Normalize burned-calorie data across many sources behind one schema. See [wearable data APIs](/fitness-apis/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](/integrate/nutritionix-api)** — 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](/fitness-apis/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](/fitness-apis/health-data-aggregator-apis) when you need the data without the user's phone in the loop.
- **Calories consumed:** a dedicated [nutrition API](/fitness-apis/nutrition-apis) — [Nutritionix](/integrate/nutritionix-api) 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](/learn/how-fitness-apps-estimate-calories).

## FAQ

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

[Permalink](https://aifitnessapi.com/data/calorie-tracking-api#faq-1)

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

[Permalink](https://aifitnessapi.com/data/calorie-tracking-api#faq-2)

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

[Permalink](https://aifitnessapi.com/data/calorie-tracking-api#faq-3)

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

[Permalink](https://aifitnessapi.com/data/calorie-tracking-api#faq-4)

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

[Permalink](https://aifitnessapi.com/data/calorie-tracking-api#faq-5)
