Skip to content

Turn Any Recipe Into a Nutrition Facts Label in Seconds

Published July 17, 2026

A food label API returns the structured nutrition facts you need to render a Nutrition Facts panel: calories, macros, and key micronutrients per serving and per 100g. Whether you are labeling a packaged product or a recipe, the API supplies the data and your front end draws the label. This guide covers both cases.

What a Label Needs

A Nutrition Facts panel is built from a fixed set of fields. A good nutrition API returns them in a predictable shape:

FieldPanel line
caloriesCalories
fat_g, saturated_fat_gTotal / Saturated Fat
sodium_mgSodium
carbohydrates_g, fiber_g, sugar_gTotal Carbohydrate
protein_gProtein
serving_sizeServing size

Label a Single Food

curl "https://api.calorieapi.com/api/v1/search/foods?q=cheddar+cheese" \
  -H "X-API-Key: YOUR_API_KEY"

Take the returned per-serving and per-100g values and map them onto your label template.

Generate a Label for a Recipe

For a made dish, resolve each ingredient to a food_id via search, then post the IDs with servings — the endpoint totals the recipe and divides by servings for you:

curl -X POST "https://api.calorieapi.com/api/v1/public/calc/recipe" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "servings": 12,
    "ingredients": [
      {"food_id": 20081, "grams": 240},
      {"food_id": 19335, "grams": 200},
      {"food_id": 1145, "grams": 113}
    ]
  }'

The response gives total and per_serving macros — the per_serving values are exactly the numbers a Nutrition Facts label displays.

Data Accuracy for Labels

Labels should use consistent, source-cited data. Prefer verified/generic foods over self-reported branded entries where accuracy matters — see verified foods filter.

Start Building

Frequently Asked Questions

What is a food label API?

It is an API that returns structured nutrition facts — calories, macros, and key micronutrients per serving and per 100g — so your app can render a Nutrition Facts panel for a food or recipe.

Can I generate a nutrition label from a recipe?

Yes. Resolve each ingredient to a food ID via search, then send those IDs and the serving count to a recipe endpoint. It returns total and per-serving macros, and the per-serving values are exactly what a Nutrition Facts panel displays.

What fields do I need for a Nutrition Facts panel?

Calories, total and saturated fat, sodium, total carbohydrate with fiber and sugar, protein, and the serving size. A nutrition API returns these in a predictable shape to map onto a label template.

Is there a free food label API?

Yes. The Calorie API returns structured nutrition facts and recipe totals on a free tier of 1,000 requests per month with no credit card, suitable for generating labels.

← 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.