Body Composition API for Fitness Apps — Complete Developer Guide (2026)
Everything you need to integrate camera-based body composition analysis into your fitness app. From how the AI works to production-ready code in JavaScript, Python, and Swift.
A technical deep dive into integrating body composition telemetry into digital fitness platforms. Compare camera-based estimation APIs with commercial DEXA scans and 3D hardware scanners, and review key API request/response structures.
What Is a Body Composition API?
A body composition API is a REST service that accepts a photo alongside basic biometrics — height, weight, age, gender — and returns a structured JSON payload describing the subject's body in clinical terms: fat percentage, lean mass, muscle score, body type classification, posture flags, and circumference estimates.
Before camera-based body composition analysis existed, the only ways to measure body composition were expensive or inconvenient: DEXA scans in a radiology lab, hydrostatic weighing, bioelectrical impedance scales, or manual tape measurements by a fitness professional. A body composition API brings that analysis to any smartphone camera, making it practical at consumer scale.
Key insight: Body composition analysis is the most-requested feature addition among fitness app developers in 2026 — and it's now a single REST call away, with no ML infrastructure to manage.
How Camera-Based Body Scanning Works
Modern body composition APIs use a multi-stage computer vision and statistical pipeline:
- Pose estimation: A model (typically MediaPipe Pose or a fine-tuned equivalent) identifies 33+ skeletal landmarks — joints, limb endpoints, and torso reference points — from the 2D image.
- Anthropometric estimation: Landmark positions are combined with supplied height to calculate pixel-per-centimeter ratios, yielding circumference estimates for waist, hips, chest, thighs, arms, and more.
- Body fat formula ensemble: Multiple validated formulas (Deurenberg, Gallagher, US Navy method) are applied in parallel using the estimated measurements and supplied biometrics. Results are averaged and calibrated against a reference dataset.
- LLM vision pass: A vision model provides qualitative assessment — body type, fat distribution pattern, posture notes, and muscle definition score — adding nuance beyond pure formula outputs.
The combined pipeline achieves ±2.1% body fat percentage accuracy compared to DEXA reference measurements — comparable to commercial bioelectrical impedance scales.
Key Metrics: What You Get Back
A full /v1/scan response includes:
- Body composition:
body_fat_percentage,body_fat_category(Essential / Athletic / Fitness / Average / Obese),lean_mass_kg,bmi - Body type: Ecto / Meso / Endomorph classification plus a detailed text description
- Scores:
muscle_score(0–100),symmetry_score,fitness_score - Posture:
posture_notes,shoulder_tilt_deg,anterior_pelvic_tilt - Measurements: 14 circumference estimates — waist, chest, hips, thighs, calves, biceps, forearms, neck, shoulders, wrist, ankle (in cm or inches)
- AI insights:
fat_distributionpattern,muscle_definition_score, improvement recommendations
REST API Integration
The WorkoutX Body Scan API accepts multipart/form-data POST requests to https://api.workoutxapp.com/v1/scan. Authentication uses a single header: X-WorkoutX-Key.
cURL
curl -X POST https://api.workoutxapp.com/v1/scan \ -H "X-WorkoutX-Key: YOUR_API_KEY" \ -F "photo=@front_photo.jpg" \ -F "height_cm=178" \ -F "weight_kg=75" \ -F "age=28" \ -F "gender=male"
JavaScript (fetch)
const form = new FormData();
form.append('photo', photoFile); // File object from <input type="file"> or camera capture
form.append('height_cm', 178);
form.append('weight_kg', 75);
form.append('age', 28);
form.append('gender', 'male');
const res = await fetch('https://api.workoutxapp.com/v1/scan', {
method: 'POST',
headers: { 'X-WorkoutX-Key': 'YOUR_API_KEY' },
body: form
});
const scan = await res.json();
console.log(`Body fat: ${scan.body_fat_percentage}%`);
console.log(`Muscle score: ${scan.muscle_score}/100`);
Python
import requests
url = "https://api.workoutxapp.com/v1/scan"
headers = {"X-WorkoutX-Key": "YOUR_API_KEY"}
with open("front_photo.jpg", "rb") as f:
res = requests.post(url, headers=headers, files={
"photo": f
}, data={
"height_cm": 178,
"weight_kg": 75,
"age": 28,
"gender": "male"
})
scan = res.json()
print(f"Body fat: {scan['body_fat_percentage']}%")
print(f"Waist: {scan['measurements']['waist_cm']} cm")
The API returns HTTP 200 on success. On failure (invalid photo, missing fields, quota exceeded), it returns 400 or 429 with a JSON error body including a code and message field.
Comparison: Camera API vs DEXA vs 3D Scanner
Understanding the trade-offs between body composition measurement methods is essential for choosing the right approach for your app.
| Method | Accuracy (Fat %) | Hardware cost | User convenience | API available | Best for |
|---|---|---|---|---|---|
| Camera API This | ±2–3% | None | Any smartphone | Yes — REST | Consumer fitness apps |
| DEXA Scan | ±1–2% | $100–$200/session | Lab visit required | No | Clinical / research |
| 3D Body Scanner | ±1–2% | $10,000–$50,000 | Dedicated hardware | Proprietary only | Gyms, clinics |
| BIA Scale | ±3–5% | $30–$300 | Good (home) | Rarely | Home tracking |
| Calipers | ±3–4% | <$20 | Requires technician | No | Personal trainers |
Use Cases Across Fitness Verticals
Body composition APIs are being adopted across every fitness and health vertical:
Consumer Fitness Apps
Replace the manual "enter your body fat %" input with an AI-powered camera scan on onboarding. Show progress over time with side-by-side scan comparisons. Gamify improvement with muscle and fitness scores.
Personal Training Platforms
Enable trainers to conduct remote assessments. Automate the initial consultation body scan and generate a PDF report. Track client progress without requiring in-person measurements.
Telehealth & Digital Health
Augment weight management programs with body composition tracking. HIPAA-ready architecture (no photo retention) makes this deployable in clinical workflows. Combine with exercise API data for holistic wellness scoring.
Corporate Wellness
Run company-wide wellness challenges with body composition benchmarks. Private, no-hardware, accessible from any device — reducing the friction of traditional biometric screenings.
Getting Started with WorkoutX Body Scan API
Getting up and running takes three steps:
- Purchase a credit pack at workoutxapp.com/bodyscan.html. Trial packs start at $29 for 10 scans — no subscription required.
- Add a camera capture UI to your app. Best results come from a front-facing photo taken 2–3 metres from the camera in form-fitting clothing with even lighting.
- POST to
https://api.workoutxapp.com/v1/scanwith the photo and biometrics. Parse the JSON response and display the metrics to your users.
Most developers complete the full integration — including the UI — in under two hours. The API returns consistent JSON across all plans, so switching from Trial to Starter to Growth requires no code changes.
Ready to integrate? The Body Scan API page has full documentation, pricing, and live code examples in cURL, JavaScript, Python, and Swift.