NutrientGraph Beta

Nutrition Analysis API Live

Turn a recipe or an ingredient list into nutrition per serving and per 100 g.

Send ingredient lines as people write them ("2 cups chopped onion") and get each line matched to a food, weighed from a source portion and totalled; or send food ids and grams to the recipe engine for cooked values with cited cooking yields.

Try it

Choose an endpoint and a sample, change the parameters, and send. Without a key the public demo answers the sample requests (marked demo, not counted against any quota, limited per IP address). With your key any values work and the call counts against your plan. The key stays in this page's memory: it is never stored. Get a free key.

1 unit per 5 lines (minimum 1) per call. Endpoint docs

Leave empty for the demo. With a key the playground calls the real endpoint from your browser; the key is kept in memory only.

Request

curl -s -X POST "https://api.nutrientgraph.com/demo/v1/food/analyze" \
  -H "Content-Type: application/json" \
  -d '{"title":"Chickpea and onion stew","servings":4,"lines":["2 cups chopped onion","1 tbsp olive oil","3 cloves garlic, minced","1 can (400 g) chickpeas, drained","1 tsp ground cumin","salt to taste"]}'

Response

Recorded answer of the real API on the current data for this sample (long arrays trimmed).

{
  "data": {
    "title": "Chickpea and onion stew",
    "lang": "en",
    "complete": false,
    "excluded_lines": [
      5
    ],
    "excluded_note": "Lines that are unparsed, unmatched or without a sourced weight are left out of the totals (listed here); nothing is guessed for them.",
    "totals": {
      "grams": 598.1,
      "nutrients": {
        "energy_kcal": {
          "value": 626.415,
          "unit": "kcal"
        },
        "protein_g": {
          "value": 22.3263,
          "unit": "g"
        },
        "fat_g": {
          "value": 21.83,
          "unit": "g"
        },
        "carbohydrate_g": {
          "value": 90.3559,
          "unit": "g"
        },
        "fiber_g": {
          "value": 22.0955,
          "unit": "g"
        },
        "sugars_g": {
          "value": 23.8506,
          "unit": "g"
        },
        "saturated_fat_g": {
          "value": 2.8888,
          "unit": "g"
        },
        "sodium_mg": {
          "value": 640.518,
          "unit": "mg"
        },
        "energy_kj": {
          "value": null,
          "unit": "kJ",
          "lower_bound": 2092.827,
          "missing_from": [
            1
          ]
        },
        "water_g": {
          "value": 459.8019,
          "unit": "g"
        },
        "alcohol_g": {
          "value": 0,
          "unit": "g"
        },
        "added_sugars_g": {
          "value": null,
          "unit": "g",
          "lower_bound": 0,
          "missing_from": [
            0,
            1,
            "… 3 more"
          ]
        },
        "trans_fat_g": {
          "value": null,
          "unit": "g",
          "lower_bound": 0,
          "missing_from": [
            1,
            4
          ]
        },
        "mufa_g": {
          "value": 11.1508,
          "unit": "g"
        },
        "pufa_g": {
          "value": 3.9179,
          "unit": "g"
        },
        "cholesterol_mg": {
          "value": 0,
          "unit": "mg"
        },
        "potassium_mg": {
          "value": 859.758,
          "unit": "mg"
        },
        "calcium_mg": {
          "value": 223.431,
          "unit": "mg"
        },
        "iron_mg": {
          "value": 5.0041,
          "unit": "mg"
        }
      }
    },
    "per_100g": {
      "energy_kcal": 104.7342,
      "protein_g": 3.7329,
      "fat_g": 3.6499,
      "carbohydrate_g": 15.1072,
      "fiber_g": 3.6943,
      "sugars_g": 3.9877,
      "saturated_fat_g": 0.483,
      "sodium_mg": 107.0921,
      "energy_kj": null,
      "water_g": 76.8771,
      "alcohol_g": 0,
      "added_sugars_g": null,
      "trans_fat_g": null,
      "mufa_g": 1.8644,
      "pufa_g": 0.6551,
      "cholesterol_mg": 0,
      "potassium_mg": 143.7482,
      "calcium_mg": 37.3568,
      "iron_mg": 0.8367
    },
    "per_serving": {
      "servings": 4,
      "grams": 149.525,
      "nutrients": {
        "energy_kcal": 156.6038,
        "protein_g": 5.5816,
        "fat_g": 5.4575,
        "carbohydrate_g": 22.589,
        "fiber_g": 5.5239,
        "sugars_g": 5.9627,
        "saturated_fat_g": 0.7222,
        "sodium_mg": 160.1295,
        "energy_kj": null,
        "water_g": 114.9505,
        "alcohol_g": 0,
        "added_sugars_g": null,
        "trans_fat_g": null,
        "mufa_g": 2.7877,
        "pufa_g": 0.9795,
        "cholesterol_mg": 0,
        "potassium_mg": 214.9395,
        "calcium_mg": 55.8578,
        "iron_mg": 1.251
      }
    },
    "basis": "ingredients as written (raw or as sold): no cooking yield applied. For cooked values, send the matched ids and grams to POST /v1/food/recipe with a cited yield (recipe_request below).",
    "lines": [
      {
        "index": 0,
        "line": "2 cups chopped onion",
        "parsed": {
          "quantity": 2,
          "quantity_text": "2",
          "unit": "cup",
          "size": null,
          "food_text": "onion",
          "preparation": [
            "chopped"
          ],
          "notes": [],
          "parsed_by": "rules"
        },
        "status": "ok",
        "food": {
          "id": "fdc:170000",
          "type": "generic",
          "name": "Onions, raw",
          "source": "fdc_sr_legacy",
          "state": "raw",
          "score": 9,
          "why": [
            "main word leads the name",
            "state raw",
            "… 2 more"
          ]
        },
        "confidence": "medium",
        "grams": 320,
        "weight": {
          "method": "portion",
          "detail": "2 cup x 160 g per '1 cup, chopped' (source portion)",
          "portion": {
            "description": "1 cup, chopped",
            "grams": 160,
            "source": "fdc_sr_legacy food_portion id=85855"
          }
        },
        "alternatives": [
          {
            "id": "fdc:170005",
            "name": "Onions, spring or scallions (includes tops and bulb), raw",
            "source": "fdc_sr_legacy",
            "state": "raw",
            "score": 8.086
          },
          {
            "id": "fdc:2709795",
            "name": "Onions, raw",
            "source": "fdc_survey",
            "state": "raw",
            "score": 6.153
          },
          "… 1 more"
        ],
        "nutrients": {
          "energy_kcal": 128,
          "protein_g": 3.52,
          "fat_g": 0.32,
          "carbohydrate_g": 29.888,
          "fiber_g": 5.44,
          "sugars_g": 13.568,
          "saturated_fat_g": 0.1344,
          "sodium_mg": 12.8,
          "…": "11 more fields"
        },
        "provenance": {
          "source": {
            "dataset": "fdc_sr_legacy",
            "record_id": "170000",
            "url": "https://fdc.nal.usda.gov/food-details/170000/nutrients",
            "retrieved": "2026-10-10"
          },
          "nutrients": {
            "alcohol_g": {
              "source_nutrient_id": "1018"
            },
            "calcium_mg": {
              "source_nutrient_id": "1087"
            },
            "carbohydrate_g": {
              "source_nutrient_id": "1005"
            },
            "cholesterol_mg": {
              "source_nutrient_id": "1253"
            },
            "energy_kcal": {
              "source_nutrient_id": "1008"
            },
            "energy_kj": {
              "source_nutrient_id": "1062"
            },
            "fat_g": {
              "source_nutrient_id": "1004"
            },
            "fiber_g": {
              "source_nutrient_id": "1079"
            },
            "…": "10 more fields"
          },
          "method": "value = per-100 g source value x grams / 100 (code)"
        }
      },
      {
        "index": 1,
        "line": "1 tbsp olive oil",
        "parsed": {
          "quantity": 1,
          "quantity_text": "1",
          "unit": "tbsp",
          "size": null,
          "food_text": "olive oil",
          "preparation": [],
          "notes": [],
          "parsed_by": "rules"
        },
        "status": "ok",
        "food": {
          "id": "fdc:2710186",
          "type": "generic",
          "name": "Olive oil",
          "source": "fdc_survey",
          "state": "as_sold",
          "score": 7.999,
          "why": [
            "main word leads the name",
            "state as_sold",
            "… 2 more"
          ]
        },
        "confidence": "high",
        "grams": 14,
        "weight": {
          "method": "portion",
          "detail": "1 tbsp x 14 g per '1 tablespoon' (source portion)",
          "portion": {
            "description": "1 tablespoon",
            "grams": 14,
            "source": "fdc_survey food_portion id=309586"
          }
        },
        "alternatives": [
          {
            "id": "fdc:748608",
            "name": "Oil, olive, extra virgin",
            "source": "fdc_foundation",
            "state": "as_sold",
            "score": 5.752
          },
          {
            "id": "fdc:171413",
            "name": "Oil, olive, salad or cooking",
            "source": "fdc_sr_legacy",
            "state": "as_sold",
            "score": 5.3
          },
          "… 1 more"
        ],
        "nutrients": {
          "energy_kcal": 126,
          "protein_g": 0,
          "fat_g": 14,
          "carbohydrate_g": 0,
          "fiber_g": 0,
          "sugars_g": 0,
          "saturated_fat_g": 2.1728,
          "sodium_mg": 0.28,
          "…": "11 more fields"
        },
        "provenance": {
          "source": {
            "dataset": "fdc_survey",
            "record_id": "2710186",
            "url": "https://fdc.nal.usda.gov/food-details/2710186/nutrients",
            "retrieved": "2026-10-10"
          },
          "nutrients": {
            "alcohol_g": {
              "source_nutrient_id": "1018"
            },
            "calcium_mg": {
              "source_nutrient_id": "1087"
            },
            "carbohydrate_g": {
              "source_nutrient_id": "1005"
            },
            "cholesterol_mg": {
              "source_nutrient_id": "1253"
            },
            "energy_kcal": {
              "source_nutrient_id": "1008"
            },
            "fat_g": {
              "source_nutrient_id": "1004"
            },
            "fiber_g": {
              "source_nutrient_id": "1079"
            },
            "iron_mg": {
              "source_nutrient_id": "1089"
            },
            "…": "8 more fields"
          },
          "method": "value = per-100 g source value x grams / 100 (code)"
        }
      },
      "… 4 more"
    ],
    "recipe_request": {
      "name": "Chickpea and onion stew",
      "cooked": false,
      "servings": 4,
      "ingredients": [
        {
          "food": "fdc:170000",
          "grams": 320,
          "label": "2 cups chopped onion"
        },
        {
          "food": "fdc:2710186",
          "grams": 14,
          "label": "1 tbsp olive oil"
        },
        "… 3 more"
      ]
    },
    "method": "Each line: quantity, unit, size and food words split by rules (parsed_by: rules); food found by full-text search over names and ranked by code (main word, extra words, preparation state, source, porti…",
    "policy": {
      "missing_values": "a nutrient a food's source record does not report is taken from a USDA crosswalk-linked record of the same food (marked filled_from), as POST /v1/food/recipe does; if none has it, or the source value …",
      "unparsed": "a line the rules cannot read, or whose weight has no source, is returned as such and left out of the totals"
    },
    "note": "Matches are ranked suggestions: check confidence and alternatives, and correct a food with its id (GET /v1/food/search) when needed. Not dietary advice."
  },
  "meta": {
    "request_id": "req_…",
    "api_version": "1",
    "dataset": "food",
    "dataset_version": "1.0.0",
    "dataset_built_at": "2026-10-10T17:56:11Z",
    "data_status": "released",
    "sources": [
      {
        "id": "ah102",
        "name": "USDA Agriculture Handbook No. 102, Food Yields Summarized by Different Stages of Preparation (1975)",
        "url": "https://www.ars.usda.gov/ARSUserFiles/80400525/Data/Classics/ah102.pdf",
        "licence": "U.S. Government work (USDA), public domain in the United States",
        "commercial_redistribution_ok": true,
        "retrieved": "2026-10-10",
        "version": "1975 (scanned PDF, ARS Classics)",
        "attribution": "Matthews RH, Garrison YJ. Food Yields Summarized by Different Stages of Preparation. Agriculture Handbook No. 102, USDA, 1975."
      },
      {
        "id": "ciqual",
        "name": "ANSES-CIQUAL French food composition table 2025 (English edition)",
        "url": "https://ciqual.anses.fr/cms/sites/default/files/inline-files/Table%20Ciqual%202025_ENG_2025_11_03.xlsx",
        "licence": "Licence Ouverte / Open Licence (Etalab). Reuse allowed, including commercial, on condition that the data are not altered, their meaning is not distorted, the source and version date are cited, and no …",
        "commercial_redistribution_ok": true,
        "retrieved": "2026-10-10",
        "version": "2025 (file dated 2025-11-03)",
        "attribution": "Anses. 2025. Ciqual French food composition table."
      },
      "… 8 more"
    ],
    "provenance_note": "Every value carries provenance (source, id or URL, retrieval date; method and confidence where an AI judged). Calculations list their inputs and method.",
    "disclaimer": "Nutrition reference data. Not medical or dietary advice.",
    "usage": "…"
  }
}

Endpoints

Endpoints
EndpointWhat it doesCostMCP toolDocumentation
POST/v1/food/analyzeAnalyse ingredient lines1 unit per 5 lines (minimum 1)food_analyze_ingredientsDocs
POST/v1/food/recipeCalculate a recipe1 unit per 5 ingredients (minimum 1)food_recipe_calculateDocs
GET/v1/food/cooking-yieldsFind cooking-yield references1 unitfood_cooking_yieldsDocs

What is included

Plans

One key and one plan cover every NutrientGraph product, this one included. Free: 2,500 units a month (2,500 calls of /v1/food/cooking-yields). Coming soon: Developer $19 and Pro $99 a month. Caching inside your product is allowed, and so is use by AI agents. Plans and units.

How it differs

Status: Live. All products.