Endpoint
POST
/functions/v1/daily_energy_expenditure_calculationInputs
- gender: male or female
- height in cm, weight in kg and age in years
- activity: sedentary, office, light_sedentary, walking_standing or physically_demanding
Returns
- status ok and formula label
- Echoed normalized inputs including pal_factor
- BMR in kcal and TDEE in kcal with minus10% and plus10% range
Request details
- All numeric fields must be positive numbers.
- activity maps to a PAL factor used for total daily energy expenditure.
- Use the direct public fields gender, height, weight, age and activity.
Response details
- This is a synchronous POST endpoint.
- Calculations use the classic Harris-Benedict formula.
- Invalid input returns a 400 response with a concise error string.
Operational notes
- Requires x-api-key with the edge:daily_energy_expenditure_calculation scope.
- Usage is counted and quota headers are returned when available.
- This utility provides an energy baseline, not a medical or diagnostic recommendation.
Examples
Request JSON
{
"gender": "female",
"height": 168,
"weight": 62,
"age": 34,
"activity": "office"
}Response JSON
{
"status": "ok",
"formula": "Harris-Benedict",
"inputs": {
"gender": "female",
"height_cm": 168,
"weight_kg": 62,
"age_years": 34,
"activity": "office",
"pal_factor": 1.4
},
"results": {
"basal_metabolic_rate_kcal": 1403,
"total_daily_energy_expenditure_kcal": 1964,
"total_daily_energy_expenditure_range_kcal": {
"minus10%": 1768,
"plus10%": 2160
}
}
}Code examples
curl -X POST 'https://tirqjzahcinadeulfylj.supabase.co/functions/v1/daily_energy_expenditure_calculation' \
-H 'x-api-key: $MYMOLECULES_API_KEY' \
-H 'Content-Type: application/json' \
--data '{ "gender": "female", "height": 168, "weight": 62, "age": 34, "activity": "office"}'