Skip to content

Nutrition Intake Estimation API

Estimate Intake (from two body scans)

Computes daily energy intake and macro guidance from two body scans using BMR and tissue-energy change.

Endpoint

URLs:

  • Development: https://api.rex.fit/[org-id]/dev/v1/estimate-intake
  • Production: https://api.rex.fit/[org-id]/prod/v1/estimate-intake

Method: POST
Content-Type: application/json
Authorization: Bearer <GENERIC_WEBHOOK_API_KEY>

Request Fields

Both scan1 and scan2 are required objects with the following fields:

Field Type Required Description Example
testing_time string Yes Timestamp of the scan. Default parse format %b %d, %Y %H:%M:%S "Sep 20, 2024 12:00:37"
weight_kg number Yes Weight in kilograms 78.4
height_cm number Yes Height in centimeters 175
age_years integer Yes Age in years 32
sex string Yes Biological sex "male" or "female"
fat_mass_kg number Yes Fat mass in kilograms 18.2
fat_free_body_weight_kg number Yes Fat-free mass (FFM) in kilograms 60.2

Optional fields (per scan or globally):

Field Type Default Description
activity_level string "moderate" "sedentary", "light", "moderate", "active", "athlete"
time_format string %b %d, %Y %H:%M:%S Format string used to parse testing_time
bmr_method string "katch" Basal Metabolic Rate method: "katch" or "mifflin"
language string "en" Language code for personalized message: "en", "es", "fr", etc.

The following may be provided but are fixed internally by the service today:

  • protein_g_per_kg_ffm
  • fat_fraction_of_kcal

Example Request

{
  "scan1": {
    "testing_time": "Sep 20, 2024 12:00:37",
    "weight_kg": 78.4,
    "height_cm": 175,
    "age_years": 32,
    "sex": "male",
    "fat_mass_kg": 18.2,
    "fat_free_body_weight_kg": 60.2
  },
  "scan2": {
    "testing_time": "Oct 20, 2024 11:31:02",
    "weight_kg": 77.1,
    "height_cm": 175,
    "age_years": 32,
    "sex": "male",
    "fat_mass_kg": 17.1,
    "fat_free_body_weight_kg": 60.0
  },
  "activity_level": "moderate",
  "bmr_method": "katch",
  "language": "en"
}

Response

Field Type Description
days_between_scans number Number of days elapsed between scans
TEE_kcal_per_day number Total Energy Expenditure (per day)
energy_change_from_tissue_kcal_total number Energy change implied by tissue changes
daily_energy_balance_kcal number Daily energy balance
intake_kcal_per_day number Estimated average daily energy intake
message string Personalized analysis message in requested language
protein_min_g_per_day number Minimum protein grams per day to support lean mass
protein_max_g_per_day_energy_cap number Max protein grams if all intake were protein
fat_g_per_day_range_at_Pmin [min, max] Fat grams/day range at protein minimum
carbs_g_per_day_range_at_Pmin [min, max] Carbs grams/day range at protein minimum
extremes_at_Pmin object Macro extremes holding protein at minimum
assumptions object Calculation assumptions and constants

extremes_at_Pmin contains:

{
  "carb_heavy": { "protein_g_per_day": 130, "fat_g_per_day": 40, "carbs_g_per_day": 350 },
  "fat_heavy": { "protein_g_per_day": 130, "fat_g_per_day": 110, "carbs_g_per_day": 120 }
}

assumptions includes:

{
  "activity_level": "moderate",
  "activity_factor": 1.55,
  "bmr_method": "katch",
  "protein_content_of_ffm": 0.22,
  "protein_deposition_efficiency": 0.70,
  "lean_energy_density_kcal_per_kg": 1100,
  "fat_energy_density_kcal_per_kg": 7700
}

Error Responses

Code Description
400 Missing required scan fields or invalid timestamps (scans must be hours/days apart)
401 Missing/invalid bearer token
500 Internal error