📖 Overview
The Health Calculator API provides comprehensive health-related calculations including BMI (Body Mass Index), BMR (Basal Metabolic Rate), Daily Caloric Intake, and Water Intake requirements. All calculations are based on scientifically proven formulas and provide detailed recommendations.
🧮 BMI Calculator
Calculate Body Mass Index with WHO standard categories and health recommendations
🔥 BMR Calculator
Basal Metabolic Rate calculation using the accurate Mifflin-St Jeor equation
🍽️ Daily Intake Calculator
Personalized caloric needs with detailed macronutrient breakdown
💧 Water Intake Calculator
Daily water requirements based on multiple health and environmental factors
🌐 Base URL
🔐 Authentication
No authentication required. This is a public API that can be accessed without any API keys or tokens.
📡 API Endpoints
GET / POST / Unified Health Calculator
The same endpoint handles all four calculators. Pass the calculator name in calculator; the other fields depend on which calculator you choose. Parameters may be supplied via the query string (GET) or as a JSON body (POST) — POSTed keys override query-string keys.
Common Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
calculator |
string | Required | One of bmi, bmr, intake, water |
unit |
string | Optional | metric (default) or imperial. For imperial, weight is treated as pounds and height as inches (only relevant for non-water calculators). |
Calculator-Specific Parameters
| Parameter | Used by | Required | Description |
|---|---|---|---|
weight |
all | Required | Weight in kg (or lb if unit=imperial) |
height |
bmi, bmr, intake | Required* | Height in cm (or in if unit=imperial). Ignored for water. |
age |
bmr, intake, water | Required* | Age in years (1–120) |
gender |
bmr, intake, water | Required* | male or female |
activity |
bmr, intake, water | Required* | sedentary, light, moderate, active, extra |
goal |
intake | Required | maintain, lose, lose-fast, gain, gain-fast |
climate |
water | Required | cold, temperate, hot, very-hot |
healthCondition |
water | Required | normal, fever, diarrhea, kidney, heart, pregnancy, breastfeeding (note the camelCase spelling) |
Example Request — BMI
Example Request — BMR (POST JSON)
Example Request — Daily Intake
Example Request — Water Intake
📊 Response Format
Success Response — BMI
Success Response — BMR
Success Response — Daily Intake
BMR: 1649 cal • Maintenance: 2556 cal", "advice": "To maintain your current weight, aim for 2556 calories per day with balanced nutrition and regular exercise.", "macros": { "protein": 112, "carbs": 367, "fat": 71 } }, "calculator": "intake", "timestamp": "2025-09-09 12:00:00" }
Success Response — Water Intake
Approximately 12.1 glasses (250ml each)", "advice": "Aim for approximately 3773ml (12.1 glasses) of water daily. Spread intake throughout the day...", "details": { "total": 3773, "fromDrinks": 3018, "fromFood": 755, "glasses": 12.1 } }, "calculator": "water", "timestamp": "2025-09-09 12:00:00" }
Error Responses
All error responses are JSON with HTTP 400 (or 404 in rare routing edge cases). The shape varies by trigger:
Calculator type missing
Missing required field(s) — message is a comma-joined list, errors is the same list as an array
Invalid value (out of range / unrealistic)
⚠️ Error Conditions
The API does not return a numeric code field. Errors are identified by the human-readable message string.
| Trigger | HTTP | Notes |
|---|---|---|
Missing calculator |
400 | Returns availableCalculators to help clients pick |
| One or more required fields missing for the chosen calculator | 400 | Returns comma-joined message and parallel errors array |
| Age out of range (must be 1–120) | 400 | message: "Age must be between 1 and 120 years" |
| Unrealistic weight / height | 400 | message: "Please check your height and weight values - they seem unrealistic" (for water: "Please check your weight value - it seems unrealistic") |
| Negative or zero weight / height (bmi, bmr, intake) | 400 | message: "Weight and height must be positive values" |
| Negative or zero weight (water) | 400 | message: "Weight must be a positive value" |
🚦 Rate Limits
This endpoint is rate-limited per client identity (IP address, or API key when one is supplied): 60 requests per minute. When the budget is exhausted the API responds with HTTP 429 and includes X-RateLimit-* headers so clients can self-throttle. The exact policy is configured in api/includes/api_config.php.
🎯 Ready to Try?
Test the Health Calculator API with our interactive web interface or start integrating it into your application.
Try Web Interface Test API Endpoint