Need to calculate total daily energy expenditure in your fitness or nutrition app? This guide covers everything you need to know about TDEE calculation via API, including activity multipliers, formulas, and implementation examples in multiple languages.
What is TDEE?
Total Daily Energy Expenditure (TDEE) is the total number of calories your body burns in a day, including all activities. It's calculated by multiplying your Basal Metabolic Rate (BMR) by an activity factor that represents your daily activity level.
TDEE is crucial for weight management: eat more than your TDEE to gain weight, eat less to lose weight, or match it to maintain your current weight.
Activity Levels Explained
Activity multipliers are applied to BMR to calculate TDEE:
Sedentary (1.2)
Little or no exercise, desk job. Minimal physical activity throughout the day.
Lightly Active (1.375)
Light exercise 1-3 days per week. Includes walking or light housework.
Moderately Active (1.55)
Moderate exercise 3-5 days per week. Regular gym sessions or sports.
Very Active (1.725)
Hard exercise 6-7 days per week. Intense training or physical labor.
Extremely Active (1.9)
Very hard exercise, physical job, or training twice daily. Athletes and heavy laborers.
Using the TDEE Calculator API
TinyFn provides a simple endpoint to calculate TDEE:
GET https://api.tinyfn.io/v1/health/tdee?weight=70&height=175&age=30&gender=male&activity=moderate
Headers: X-API-Key: your-api-key
{
"tdee": 2604,
"bmr": 1680,
"activity_multiplier": 1.55,
"activity_level": "moderate",
"unit": "kcal/day",
"macros_suggestion": {
"protein_g": 140,
"carbs_g": 293,
"fat_g": 87
}
}
Parameters
| Parameter | Type | Description |
|---|---|---|
weight |
number | Weight in kilograms |
height |
number | Height in centimeters |
age |
integer | Age in years |
gender |
string | Gender: male or female |
activity |
string | Activity level: sedentary, light, moderate, very_active, or extreme |
Code Examples
JavaScript / Node.js
const response = await fetch(
'https://api.tinyfn.io/v1/health/tdee?weight=70&height=175&age=30&gender=male&activity=moderate',
{ headers: { 'X-API-Key': 'your-api-key' } }
);
const { tdee, bmr } = await response.json();
console.log(`TDEE: ${tdee}, BMR: ${bmr}`); // TDEE: 2604, BMR: 1680
Python
import requests
response = requests.get(
'https://api.tinyfn.io/v1/health/tdee',
params={
'weight': 70, 'height': 175, 'age': 30,
'gender': 'male', 'activity': 'moderate'
},
headers={'X-API-Key': 'your-api-key'}
)
data = response.json()
print(f"TDEE: {data['tdee']}, BMR: {data['bmr']}")
cURL
curl "https://api.tinyfn.io/v1/health/tdee?weight=70&height=175&age=30&gender=male&activity=moderate" \
-H "X-API-Key: your-api-key"
Common Use Cases
- Calorie Tracking Apps: Set daily calorie goals based on TDEE
- Meal Planning Services: Generate meal plans that match energy needs
- Fitness Coaching Platforms: Create personalized nutrition programs
- Weight Loss Programs: Calculate calorie deficits for safe weight loss
- Sports Nutrition: Optimize fuel intake for athletic performance
Best Practices
- Be conservative with activity: Most users overestimate their activity level
- Recalculate regularly: TDEE changes with weight, age, and activity changes
- Use for guidance: TDEE is an estimate; adjust based on real-world results
- Combine with tracking: Compare predicted vs actual results over time
Use via MCP
Your AI agent can call this tool directly via Model Context Protocol — no HTTP code needed. Add TinyFn to Claude Desktop, Cursor, or any MCP client:
{
"mcpServers": {
"tinyfn-health": {
"url": "https://api.tinyfn.io/mcp/health/",
"headers": {
"X-API-Key": "your-api-key"
}
}
}
}
See all health tools available via MCP in our Health MCP Tools for AI Agents guide.
Try the TDEE Calculator API
Get your free API key and start calculating TDEE in seconds.
Get Free API Key