Recipe API

Tutorial

Recipe Nutrition Data via API: A Developer's Guide

Nutrition is where most recipe data falls apart — fields are missing, units are inconsistent, and there's no way to tell where a number came from. Recipe API treats nutrition as a first-class, traceable part of the schema. This guide explains the 32 per-serving nutrients, how they trace back to USDA FoodData Central, how ingredient-level linkage works, the difference between per-serving and per-recipe values, and how dietary flags and allergens fit in.

The 32 per-serving nutrients

Every recipe returns the same 32 USDA-tracked nutrients per serving — macronutrients like calories, protein, carbohydrates, and fat, plus micronutrients such as fiber, sugars, sodium, and a range of vitamins and minerals. The key word is same: the nutrient set is identical on every recipe in the catalog of 25,000+, so you never write conditional code to handle a recipe that happens to be missing a field. Map the block once and it works everywhere.

Fetch a single recipe by its slug to see the full nutrition block alongside grouped ingredients and machine-readable instructions:

GET /api/v1/recipes/{slug}
curl "https://recipe-api.com/api/v1/recipes/classic-margherita-pizza" \
  -H "X-API-Key: rapi_your_key"

USDA FoodData Central traceability

The nutrient values aren't estimated black-box numbers — they're derived from USDA FoodData Central, the United States Department of Agriculture's reference database for food composition. That matters when you need to defend the numbers your app displays: every nutrient is grounded in a recognized public source rather than a proprietary guess. For regulated contexts, health-adjacent products, or anyone who needs an audit trail, source traceability is the difference between “trust us” and “here's where it came from.”

Ingredient-level linkage via IDs

Recipes ship with grouped ingredients, and each ingredient is linked by a stable ID with source traceability back to its FoodData Central entry. That linkage is what makes the per-serving nutrition explainable: a recipe's totals are the sum of its linked ingredients, so you can drill from a recipe down to the specific foods driving its protein or sodium. You can also work with the ingredient catalog directly to power autocomplete, substitutions, or pantry matching.

GET /api/v1/ingredients
curl "https://recipe-api.com/api/v1/ingredients" \
  -H "X-API-Key: rapi_your_key"

Because ingredient IDs are stable, the same identifier you see inside a recipe's ingredient group is the one you use to filter recipe search (GET /api/v1/recipes?ingredients=id1,id2) and to build consolidated shopping lists across many recipes. One ID, used consistently everywhere.

Per-serving vs per-recipe

The nutrition block is expressed per serving, which is almost always what you want to show a user: a plate of food, not a whole pot. When you need per-recipe totals — for batch cooking, a full grocery roll-up, or summing a household's daily intake — multiply each per-serving nutrient by the recipe's serving count. Keeping the canonical values per serving avoids ambiguity: you always know what a number refers to, and you scale up deliberately rather than guessing whether a value was already totaled.

This consistency pays off when planning. Summing a day's intake is just adding per-serving values across the recipes a user chose — no unit conversion, no reconciling different nutrient sets between recipes.

Dietary flags and allergen warnings

Beyond raw numbers, each recipe carries dietary flags (such as Vegetarian, Vegan, or Gluten-Free) and allergen warnings. Treat these as a safety and filtering layer that sits on top of the nutrient data. Dietary flags let you honor a user's stated preferences at query time — filter the catalog with dietary= so non-matching recipes never reach the UI. Allergen warnings let you surface clear, prominent notices on recipe detail views, which is essential for any product where a user might have a real allergy.

Together, the 32-nutrient block, ingredient-level traceability, per-serving consistency, and the dietary/allergen layer give you everything needed to display trustworthy nutrition: numbers you can source, ingredients you can drill into, and warnings you can act on — all in one schema across the entire catalog.

Work with the data yourself

Get a free key and inspect the full nutrition block on any recipe.