Body Fat Percentage API — Calculate Body Fat via Mobile Camera (2026)
How AI body fat APIs work, how accurate they are compared to DEXA and calipers, a full breakdown of the API response schema, and a working integration example.
Understand the science and engineering behind estimating body fat percentages using standard mobile camera photos. Includes a step-by-step REST API response breakdown and a working Python script for client-side integration.
Body Fat % via Camera vs Traditional Methods
Body fat percentage is the single most meaningful metric in fitness tracking — more informative than weight alone, more actionable than BMI. Yet for decades, measuring it accurately required either an expensive lab visit (DEXA, hydrostatic weighing) or an error-prone technique (calipers, BIA scales). The result: most fitness apps simply ask users to type in a number they don't actually know.
AI body fat APIs change this. By submitting a front-facing photo and basic biometrics, an app can return a body fat percentage estimate in under two seconds — with accuracy comparable to consumer-grade BIA scales, and far better than a self-reported guess.
How AI Calculates Body Fat From a Single Photo
Camera-based body fat estimation is not a single model — it's a layered pipeline:
Stage 1 — Pose detection & landmark extraction
A pose estimation model (MediaPipe Pose or equivalent) identifies 33 skeletal landmarks in the image: joints, limb endpoints, facial keypoints, and torso reference points. This produces a 2D skeleton overlay that maps to pixel coordinates.
Stage 2 — Digital anthropometry
Using the landmark positions and the supplied height, the pipeline calculates a pixels-per-centimeter ratio. This ratio is used to estimate circumferences at standard measurement sites — waist, chest, hips, thighs, biceps, and more. This is the core of digital anthropometry: the automated application of the science of body measurement (anthropometry) using computer vision instead of a tape measure.
The accuracy of this step is highly dependent on photo quality — distance, pose, clothing, and lighting all affect how cleanly the landmarks are detected.
Stage 3 — Formula ensemble
Multiple validated body fat estimation formulas are applied simultaneously, each using the estimated measurements as inputs:
- US Navy method: Uses waist, neck (for men) or waist, hips, neck (for women) circumferences
- Deurenberg formula: Uses BMI, age, and sex
- Gallagher formula: A BMI-based regression validated across ethnic groups
- Jackson-Pollock adapted: Uses estimated skinfold-proxy circumferences
Results are averaged with weighting based on how well each formula's inputs were estimated from the image. The ensemble approach reduces the impact of any single formula's error mode.
Stage 4 — Vision model calibration
A vision language model performs a qualitative pass — assessing visible muscle definition, fat distribution pattern, and body type — and applies a calibration adjustment to the ensemble output. This stage adds nuance that pure formula approaches miss: the visual difference between a 20% body fat "skinny-fat" physique and a 20% body fat athletic physique is detectable visually even when circumference measurements are identical.
DEXA Correlation: How Accurate Is the API?
DEXA (Dual-Energy X-ray Absorptiometry) is the clinical gold standard for body composition measurement. WorkoutX Body Scan API was validated against DEXA reference measurements across a 10,000+ subject dataset representing diverse ages (18–65), BMI ranges (17–40), and ethnicities.
| Method | Avg error vs DEXA | Hardware cost | At-home possible | API available |
|---|---|---|---|---|
| WorkoutX Camera API This | ±2.1% | None | ✓ | ✓ REST |
| DEXA Scan | Reference (gold standard) | $100–200/session | ✗ Lab required | ✗ |
| BIA Scale (consumer) | ±3–5% | $30–$300 | ✓ | ✗ Rarely |
| Skinfold Calipers | ±3–4% (trained tech) | <$20 | ✗ Technician needed | ✗ |
| Online BMI Calculator | ±5–10% | Free | ✓ | ✓ |
| Hydrostatic Weighing | ±1.5% | Lab only | ✗ | ✗ |
Accuracy is highest for subjects with BMI 18–35 in standard lighting with form-fitting clothing. Accuracy degrades at BMI extremes (<17 or >42) and in poor photo conditions (dark lighting, loose clothing, extreme angles).
API Response Deep Dive
The full JSON response from POST /v1/scan contains six sections:
{
// ── Identity ──────────────────────────────────
"scan_id": "bscan_7xK9mP",
"timestamp": "2026-06-06T10:22:14Z",
// ── Body Composition ──────────────────────────
"body_composition": {
"body_fat_percentage": 14.6, // Primary metric
"body_fat_category": "Athletic", // Essential|Athletic|Fitness|Average|Obese
"lean_mass_kg": 58.1,
"fat_mass_kg": 9.9,
"bmi": 21.0,
"body_type": "Ecto-Mesomorph" // Ecto|Meso|Endo|Ecto-Meso|Meso-Endo
},
// ── Scores (0–100) ────────────────────────────
"scores": {
"muscle_score": 53, // Visible muscle development
"symmetry_score": 99, // Left/right balance
"fitness_score": 80, // Composite health indicator
"muscle_definition_score": 7 // Visible definition (1–10)
},
// ── Circumference Measurements (cm) ───────────
"measurements": {
"waist_cm": 76.2,
"chest_cm": 96.5,
"hips_cm": 90.1,
"thigh_left_cm": 52.8,
"thigh_right_cm": 53.1,
"calf_left_cm": 35.4,
"calf_right_cm": 35.6,
"bicep_left_cm": 30.2,
"bicep_right_cm": 30.8,
"forearm_left_cm": 25.1,
"forearm_right_cm": 25.3,
"neck_cm": 37.0,
"shoulder_width_cm": 44.2,
"wrist_cm": 16.5
},
// ── Posture Analysis ──────────────────────────
"posture": {
"posture_score": 85,
"shoulder_tilt_deg": 1.2,
"hip_tilt_deg": 0.8,
"anterior_pelvic_tilt": "none", // none|mild|moderate|significant
"head_forward_posture": false,
"posture_notes": "Neutral posture, shoulders level."
},
// ── AI Insights ───────────────────────────────
"ai_insights": {
"body_type_detail": "Athletic frame with good upper body development.",
"fat_distribution": "balanced", // balanced|android|gynoid|visceral
"posture_flags": [],
"improvement_areas": ["core stability", "posterior chain"]
},
// ── Usage ─────────────────────────────────────
"credits": {
"used": 1,
"remaining": 499,
"pack": "growth"
}
}
Comparison: WorkoutX vs DEXA vs Calipers vs BIA
When evaluating which body fat measurement method to recommend to your users — or to integrate into your app — here is the complete trade-off picture:
| Factor | Camera API | DEXA | Calipers | BIA Scale |
|---|---|---|---|---|
| Fat % accuracy | ±2.1% | ±1% (gold std.) | ±3–4% | ±3–5% |
| Circumference data | 14 sites | Body regions only | Site-specific | None |
| Posture analysis | Yes | No | No | No |
| No hardware needed | Yes | No | Cheap device | Scale required |
| App integrable via API | Yes — REST | No | No | Rarely |
| Cost per measurement | $0.06–0.19 | $100–200 | ~$0 | ~$0 (scale amortised) |
| Photo retention | None (HIPAA-ready) | Yes — medical record | N/A | N/A |
Integration Example — Full Code
A complete body fat scanning flow in Python, from photo to displaying the result:
import requests
import json
SCAN_API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.workoutxapp.com/v1"
def get_body_fat(photo_path, height_cm, weight_kg, age, gender):
"""Submit a scan and return the body fat percentage and key metrics."""
with open(photo_path, "rb") as photo:
response = requests.post(
f"{BASE_URL}/scan",
headers={"X-WorkoutX-Key": SCAN_API_KEY},
files={"photo": photo},
data={
"height_cm": height_cm,
"weight_kg": weight_kg,
"age": age,
"gender": gender,
},
timeout=15,
)
response.raise_for_status()
scan = response.json()
return {
"body_fat_pct": scan["body_composition"]["body_fat_percentage"],
"category": scan["body_composition"]["body_fat_category"],
"muscle_score": scan["scores"]["muscle_score"],
"waist_cm": scan["measurements"]["waist_cm"],
"posture": scan["posture"]["posture_notes"],
"credits_left": scan["credits"]["remaining"],
}
# Usage
result = get_body_fat(
photo_path="user_scan.jpg",
height_cm=178,
weight_kg=75,
age=28,
gender="male"
)
print(f"Body fat: {result['body_fat_pct']}% ({result['category']})")
print(f"Muscle score: {result['muscle_score']}/100")
print(f"Waist: {result['waist_cm']} cm")
print(f"Posture: {result['posture']}")
print(f"Credits remaining: {result['credits_left']}")
Start with a Trial pack — 10 scans for $29, no subscription. Enough to build and test a full integration end-to-end before committing to a larger credit pack. View pricing →