Need to calculate basal metabolic rate in your health or fitness application? This guide covers everything you need to know about BMR calculation via API, including different formulas, parameters, and implementation examples in multiple languages.
What is BMR?
Basal Metabolic Rate (BMR) is the number of calories your body needs to perform basic life-sustaining functions while at complete rest. These functions include breathing, circulation, cell production, nutrient processing, and protein synthesis.
BMR typically accounts for 60-75% of daily calorie expenditure and is influenced by factors like age, gender, weight, and height.
BMR Formulas Explained
There are several scientifically validated formulas for calculating BMR:
Harris-Benedict Equation (Revised)
The most widely used formula, revised in 1984 for improved accuracy. Calculates BMR based on weight, height, age, and gender.
Mifflin-St Jeor Equation
Developed in 1990, considered the most accurate for modern populations. Recommended by the American Dietetic Association.
Using the BMR Calculator API
TinyFn provides a simple endpoint to calculate BMR:
GET https://api.tinyfn.io/v1/health/bmr?weight=70&height=175&age=30&gender=male
Headers: X-API-Key: your-api-key
{
"bmr": 1680,
"formula": "mifflin_st_jeor",
"unit": "kcal/day",
"inputs": {
"weight_kg": 70,
"height_cm": 175,
"age": 30,
"gender": "male"
}
}
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 |
formula |
string | Formula: harris_benedict or mifflin_st_jeor (default) |
Code Examples
JavaScript / Node.js
const response = await fetch(
'https://api.tinyfn.io/v1/health/bmr?weight=70&height=175&age=30&gender=male',
{ headers: { 'X-API-Key': 'your-api-key' } }
);
const { bmr } = await response.json();
console.log(bmr); // 1680
Python
import requests
response = requests.get(
'https://api.tinyfn.io/v1/health/bmr',
params={'weight': 70, 'height': 175, 'age': 30, 'gender': 'male'},
headers={'X-API-Key': 'your-api-key'}
)
bmr = response.json()['bmr']
print(bmr) # 1680
cURL
curl "https://api.tinyfn.io/v1/health/bmr?weight=70&height=175&age=30&gender=male" \
-H "X-API-Key: your-api-key"
Common Use Cases
- Fitness Apps: Calculate daily calorie needs for weight management
- Diet Planners: Create personalized nutrition plans based on metabolism
- Health Dashboards: Display metabolic health metrics
- Wearable Integrations: Combine with activity data for total energy expenditure
- Clinical Tools: Support healthcare professionals in patient assessments
Best Practices
- Use metric units: API expects weight in kg and height in cm
- Validate inputs: Ensure reasonable ranges for age, weight, and height
- Consider activity level: BMR is just the baseline; multiply by activity factor for TDEE
- Update regularly: Recalculate as user's weight and age change
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 BMR Calculator API
Get your free API key and start calculating BMR in seconds.
Get Free API Key