← All tool references

Health · execute

Macro Calculator

Estimate adult daily calories and a 30/40/30 protein, carbohydrate, and fat split from body and activity inputs.

Open public tool

Overview

Category
Health
API mode
execute
Processing
client-side
Privacy
no-data-stored

Public descriptor

The descriptor is available without an API key and supplies this tool’s metadata, schemas, modes, and examples.

GET /api/v1/tools/macro-calculator

View this descriptor as JSON

Execute availability

This tool has an execute route defined by its descriptor. Server-side execution is currently unavailable, so requests return api_not_launched.

POST /api/v1/tools/macro-calculator/execute

Authentication is not issued during the preview. A bearer API key is planned for execution after launch.

Input schema

object object; additional properties are not accepted.

sex · string · required
Choose the sex category required by the selected estimation formula. Accepted values: male, female.
age · number · required
Enter age in completed years for the metabolic-rate estimate.
weight_kg · number · required
Enter body weight in kilograms for the metabolic-rate estimate.
height_cm · number · required
Enter height in centimeters for the formula.
activity · string · required
Choose the activity level that best reflects your usual week, not one unusually active day. Accepted values: sedentary, light, moderate, active, very_active.
goal · string · required
Choose whether the calorie and macro target should support loss, maintenance, or gain. Accepted values: lose, maintain, gain.
{
    "type": "object",
    "properties": {
        "sex": {
            "type": "string",
            "enum": [
                "male",
                "female"
            ],
            "description": "Choose the sex category required by the selected estimation formula."
        },
        "age": {
            "type": "number",
            "description": "Enter age in completed years for the metabolic-rate estimate."
        },
        "weight_kg": {
            "type": "number",
            "description": "Enter body weight in kilograms for the metabolic-rate estimate."
        },
        "height_cm": {
            "type": "number",
            "description": "Enter height in centimeters for the formula."
        },
        "activity": {
            "type": "string",
            "enum": [
                "sedentary",
                "light",
                "moderate",
                "active",
                "very_active"
            ],
            "description": "Choose the activity level that best reflects your usual week, not one unusually active day."
        },
        "goal": {
            "type": "string",
            "enum": [
                "lose",
                "maintain",
                "gain"
            ],
            "description": "Choose whether the calorie and macro target should support loss, maintenance, or gain."
        }
    },
    "required": [
        "sex",
        "age",
        "weight_kg",
        "height_cm",
        "activity",
        "goal"
    ],
    "additionalProperties": false
}

Output schema

On a successful execution, schema values appear in data.result.values.

calories · number
Daily calorie target.
protein_g · number
Protein grams.
carbs_g · number
Carbohydrate grams.
fat_g · number
Fat grams.
{
    "type": "object",
    "properties": {
        "calories": {
            "type": "number",
            "description": "Daily calorie target."
        },
        "protein_g": {
            "type": "number",
            "description": "Protein grams."
        },
        "carbs_g": {
            "type": "number",
            "description": "Carbohydrate grams."
        },
        "fat_g": {
            "type": "number",
            "description": "Fat grams."
        }
    },
    "additionalProperties": false
}

Macro Calculator: Adult estimate

The request body follows the published input schema. The response below shows the success-envelope shape returned after execution is available.

curl -X POST "https://utilitypages.org/api/v1/tools/macro-calculator/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "sex": "male",
    "age": 30,
    "weight_kg": 70,
    "height_cm": 175,
    "activity": "moderate",
    "goal": "maintain"
}'
{
    "ok": true,
    "data": {
        "slug": "macro-calculator",
        "result": {
            "values": {
                "calories": 2556,
                "protein_g": 191.69999999999998863131622783839702606201171875,
                "carbs_g": 255.599999999999994315658113919198513031005859375,
                "fat_g": 85.2000000000000028421709430404007434844970703125
            },
            "display": {
                "display": "2556"
            },
            "warnings": [],
            "assumptions": [],
            "steps": []
        }
    },
    "meta": [],
    "request_id": "req_example_123"
}

Errors

api_not_launched · 503
Returned by the current launch gate for every execute request.
invalid_json · 400
Returned when an enabled execute request does not contain valid JSON.
validation_failed · 422
Returned when a request does not satisfy the input schema.
browser_interaction_required · 422
Returned for browser capability tools instead of inventing a server-side result.
tool_not_found · 404
Returned when a requested descriptor slug does not exist.
execution_failed · 503
Returned when an enabled server-side execution cannot complete.