Skip to content

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)

FieldMeaning
totals.caloriesWhole recipe
totals.protein_gSum 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

ManualRecipe calc API
N detail fetches1 POST
Client bug riskServer validated
Slow on 15 ingredientsSingle round trip

Use Cases

App typePattern
Meal prep5 containers from one POST
Recipe blogPer-serving label widget
Coaching SaaSCoach builds meal templates
Restaurant menuBatch analyze dishes

Try recipe calc | Register free

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.

← Back to all articles

Start building with the Calorie API

Get a free API key and access 4M+ foods with search, barcode lookup, and full macro data.