Skip to content

Carbs Calculator API

Calculate recommended carbohydrate intake based on sex, age, body metrics, and activity-driven TDEE.

Endpoint

  • GET /api/v1/carbs-calculator
  • POST /api/v1/carbs-calculator/post

Parameters

Name Type Required In Description
sex string (male,female) Yes Query/Body Biological sex.
age number Yes Query/Body Age in years.
height number Yes Query/Body Height (cm metric, in imperial).
weight number Yes Query/Body Weight (kg metric, lb imperial).
unit string (metric,imperial) No Query/Body Input unit mode. Default metric.
activity_level string Yes Query/Body sedentary,lightly_active,moderately_active,very_active,extra_active.
lang string No Query Response language (en,es,de,fr,pt,ja,hi,ar).

Why Use This Endpoint

  • Turn profile data into actionable carb targets.
  • Enable training-day/rest-day carb periodization.
  • Improve nutrition-plan personalization in coaching apps.

Get Started

Request Example

curl -X GET "https://api.hefitapi.com/api/v1/carbs-calculator?sex=male&age=31&height=178&weight=82&unit=metric&activity_level=moderately_active&lang=en" \
  -H "X-API-Key: YOUR_API_KEY"
curl -X POST "https://api.hefitapi.com/api/v1/carbs-calculator/post?lang=en" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{"sex":"male","age":31,"height":178,"weight":82,"unit":"metric","activity_level":"moderately_active"}'

Response Example

Info

The response example below is for demonstration purposes only. Make a live request to this endpoint to receive the full, real-time, and potentially richer JSON structure.

{
  "sex": "male",
  "age": 31.0,
  "height_cm": 178.0,
  "weight_kg": 82.0,
  "unit": "metric",
  "activity_level": "moderately_active",
  "tdee_kcal_per_day": 2870.16,
  "usda_carbs_grams_range": [322.89, 466.4],
  "recommended_carbs_g": 394.65,
  "carb_band": "high",
  "carb_band_label": "High",
  "periodization_targets_g": {
    "rest_day": 355.19,
    "training_day": 434.12
  },
  "timing_guidance": ["Place larger carb portions around training"],
  "action_plan": ["Prioritize complex carbs", "Track response weekly"],
  "adjustment_rules": ["Reduce carbs if fat gain accelerates"],
  "_enterprise": {
    "client": "Acme Health",
    "plan": "pro",
    "request_id": "2c8d9bd88b6f2f19",
    "quota": 120,
    "usage_tracking": true
  },
  "_api_metadata_": {
    "endpoint_name": "carbs_calculator",
    "response_language": "en"
  }
}

Product Value

Strong fit for macro-planning SaaS, nutrition automation tools, and performance coaching products.

Note

activity_level must match one of the supported enum values exactly.