Recipe Nutrition Calculator API for Multiple Ingredients
Published June 18, 2026
A recipe nutrition calculator API multiple ingredients sums calories and macros across every item in a dish without N+1 API calls. Pass food IDs and gram weights. Get total and per-serving nutrition JSON. Calorie API POST /calc/recipe handles aggregation server-side.
Deep dive also in recipe nutrition analyzer API and recipe blog labels.
Endpoint
POST /api/v1/public/calc/recipe
Content-Type: application/json
Request Body
{
"servings": 4,
"ingredients": [
{ "food_id": 11420, "grams": 300 },
{ "food_id": 9200, "grams": 150 },
{ "food_id": 5501, "grams": 50 }
]
}
Resolve food_id values via search first:
curl "https://api.calorieapi.com/api/v1/search/foods?q=chicken+breast&limit=1" \
-H "X-API-Key: YOUR_KEY"
Response (Conceptual)
| Field | Meaning |
|---|---|
totals.calories | Whole recipe |
totals.protein_g | Sum protein |
per_serving.* | Divided by servings |
ingredients[] | Per-ingredient breakdown |
Use totals for meal prep batches. Use per_serving for recipe cards.
JavaScript Example
async function calcRecipe(ingredients, servings) {
const res = await fetch('https://api.calorieapi.com/api/v1/public/calc/recipe', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-API-Key': KEY },
body: JSON.stringify({ servings, ingredients }),
});
return res.json();
}
Proxy from CMS or app backend in production.
vs Manual Summing
| Manual | Recipe calc API |
|---|---|
| N detail fetches | 1 POST |
| Client bug risk | Server validated |
| Slow on 15 ingredients | Single round trip |
Use Cases
| App type | Pattern |
|---|---|
| Meal prep | 5 containers from one POST |
| Recipe blog | Per-serving label widget |
| Coaching SaaS | Coach builds meal templates |
| Restaurant menu | Batch analyze dishes |
Related
Frequently Asked Questions
How do I calculate nutrition for a recipe with multiple ingredients?
POST food IDs and gram amounts to Calorie API /public/calc/recipe with a servings count. The API returns total and per-serving macros.
Do I need one API call per ingredient?
No. Recipe calc aggregates all ingredients in one request instead of fetching and summing each ingredient separately.
How do I get food IDs for recipe ingredients?
Search each ingredient name via /search/foods, store the returned food_id, then pass IDs and grams to recipe calc.
Can recipe calc power food blog nutrition labels?
Yes. Use per_serving fields from the response to render nutrition labels on recipe posts.
Is recipe calc available on the free tier?
Public calc endpoints including recipe are available for development. Monitor usage and upgrade for production traffic on commercial apps.
