# Body Fat API
> Body-fat-percentage and body-composition maths as an API, computed locally and deterministically. The navy endpoint applies the US Navy circumference method — for men %BF = 495/(1.0324 − 0.19077·log10(waist − neck) + 0.15456·log10(height)) − 450, and for women a formula that adds the hip measurement — to estimate body fat from a tape measure alone, returning the percentage and the fitness category (essential, athletes, fitness, acceptable or obese); a man of 178 cm with a 40 cm neck and 90 cm waist reads about 18.7 %. The deurenberg endpoint gives the BMI-based estimate %BF = 1.20·BMI + 0.23·age − 10.8·(1 if male) − 5.4 from BMI or weight and height plus age. The composition endpoint splits a total weight into fat mass and lean (fat-free) mass from a body-fat percentage. Circumferences and height are in centimetres and weight in kilograms. Everything is computed locally and deterministically, so it is instant and private. Ideal for fitness, wellness, gym, nutrition, body-tracking and health-education app developers, body-composition and progress-tracking tools, and coaching software. These are estimation formulas, not a substitute for DEXA or professional assessment. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is body-fat percentage; for body-mass index use a BMI API and for basal metabolic rate a BMR API.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/bodyfat-api/..."
```

## Pricing
- **Free** (Free) — 6,500 calls/Mo, 2 req/s
- **Starter** ($5/Mo) — 65,000 calls/Mo, 6 req/s
- **Pro** ($13/Mo) — 290,000 calls/Mo, 15 req/s
- **Mega** ($39/Mo) — 1,600,000 calls/Mo, 40 req/s

## Endpoints

### BodyFat

#### `GET /v1/composition` — Fat & lean mass

**Parameters:**
- `weight_kg` (query, required, string) — Total weight (kg) Example: `80`
- `body_fat_percent` (query, required, string) — Body fat percentage Example: `18.7`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bodyfat-api/v1/composition?weight_kg=80&body_fat_percent=18.7"
```

**Response:**
```json
{
    "data": {
        "note": "Fat mass = weight·%BF/100; lean (fat-free) mass = weight − fat mass.",
        "inputs": {
            "weight_kg": 80,
            "body_fat_percent": 18.7
        },
        "fat_mass_kg": 14.96,
        "lean_mass_kg": 65.04
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:24.540Z",
        "request_id": "844243f0-ef85-4ec3-a6b5-ccddd6e0ba16"
    },
    "status": "ok",
    "message": "Fat/lean mass",
    "success": true
}
```

#### `GET /v1/deurenberg` — BMI-based body fat

**Parameters:**
- `sex` (query, required, string) — male or female Example: `male`
- `age` (query, required, string) — Age (years) Example: `30`
- `bmi` (query, optional, string) — BMI (or give weight+height)
- `weight_kg` (query, optional, string) — Weight (kg) Example: `80`
- `height_cm` (query, optional, string) — Height (cm) Example: `180`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bodyfat-api/v1/deurenberg?sex=male&age=30&weight_kg=80&height_cm=180"
```

**Response:**
```json
{
    "data": {
        "note": "Deurenberg estimate %BF = 1.20·BMI + 0.23·age − 10.8·(1 if male else 0) − 5.4. A population estimate; the Navy circumference method is usually more individual-specific.",
        "inputs": {
            "age": 30,
            "bmi": 24.691,
            "sex": "male"
        },
        "method": "Deurenberg (BMI-based)",
        "category": "acceptable",
        "body_fat_percent": 20.33
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:24.648Z",
        "request_id": "b85db56b-f0e4-4a6c-9fcc-41096adbdf84"
    },
    "status": "ok",
    "message": "BMI-based body fat",
    "success": true
}
```

#### `GET /v1/navy` — US Navy body fat

**Parameters:**
- `sex` (query, required, string) — male or female Example: `male`
- `height_cm` (query, required, string) — Height (cm) Example: `178`
- `neck_cm` (query, required, string) — Neck circumference (cm) Example: `40`
- `waist_cm` (query, required, string) — Waist circumference (cm) Example: `90`
- `hip_cm` (query, optional, string) — Hip circumference (cm, women)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bodyfat-api/v1/navy?sex=male&height_cm=178&neck_cm=40&waist_cm=90"
```

**Response:**
```json
{
    "data": {
        "note": "US Navy circumference method. Measure neck below the larynx, waist at the navel (men) / narrowest point (women), and hips at the widest point (women). A man at height 178, neck 40, waist 90 cm reads ≈18.7 %.",
        "inputs": {
            "sex": "male",
            "neck_cm": 40,
            "waist_cm": 90,
            "height_cm": 178
        },
        "method": "US Navy circumference",
        "category": "acceptable",
        "body_fat_percent": 18.7
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:24.775Z",
        "request_id": "c66147c3-38bb-4c82-9d1c-5971b3b725cb"
    },
    "status": "ok",
    "message": "Navy body fat",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bodyfat-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "notes": "Circumferences and height in cm, weight in kg. Estimation formulas, not a substitute for DEXA or professional assessment. For body-mass index use a BMI API.",
        "service": "bodyfat-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/navy": "Body fat % from neck, waist (and hip for women) circumferences.",
            "GET /v1/deurenberg": "BMI-based body-fat estimate from BMI/age/sex.",
            "GET /v1/composition": "Fat mass and lean mass from body-fat % and weight."
        },
        "description": "Body-fat percentage by the US Navy circumference method and the Deurenberg BMI estimate, plus fat/lean mass composition."
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:24.868Z",
        "request_id": "d9a7ec46-8af0-4d72-a605-4d9d9d770895"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/bodyfat-api
OpenAPI spec: https://www.oanor.com/api/bodyfat-api/openapi.json
