GET/nutrients
De voedingsstoffencatalogus — id, name, unit, categorie — zodat u de nutrientId-waarden kunt ontdekken die de omgekeerde zoekendpoints verwachten.
Query Food Info's reference nutrition data programmatically. A small, versioned, read-only REST API. Free to start: create an account, generate a key and you get 100 requests a day. Requests authenticate with an API key in the X-Api-Key header.
Versioned under /api/v1, JSON only, server-to-server (no browser CORS). Reuses the same reference data the site runs on. Create a key in "Your API keys" below; a free account is enough to get one.
https://api.food-info.org/api/v1X-Api-Keyheader The full OpenAPI 3 description is published at https://api.food-info.org/api/v1/openapi.json, so you can import it into Postman or Insomnia, or generate a typed client, rather than writing one by hand.
Send your secret key in the X-Api-Key header on every request. Keys are tied to your account; keep them server-side and never expose them in a browser or mobile app. A missing, invalid or revoked key returns 401.
curl -H "X-Api-Key: YOUR_KEY" \
"https://api.food-info.org/api/v1/nutrients"Two tiers. Every read endpoint below works on both; the paid plan buys throughput rather than access. Limits are counted per account, not per key, so generating extra keys does not raise your quota.
| Plan | Per minute | Per day | Recipe endpoints |
|---|---|---|---|
| Free | 10 | 100 | No (403) |
| Practitioner | 60 | 10,000 | Yes |
Every response carries X-RateLimit-Limit-Minute, X-RateLimit-Limit-Day and X-RateLimit-Tier, so you can read your current allowance in-band rather than discovering it on a 429. Exceeding a limit returns 429 with a Retry-After header in seconds, so you can back off precisely.
Een voorafgaande dubbele punt markeert een padparameter (bijv. :id). Waar aangegeven: limit is 1–100 (standaard 25); home_nation is een ISO-landcode (bijv. GB) die de referentievoedingsmiddelen van dat land geeft de voorkeur.
/nutrientsDe voedingsstoffencatalogus — id, name, unit, categorie — zodat u de nutrientId-waarden kunt ontdekken die de omgekeerde zoekendpoints verwachten.
/foods/searchZoek voedingsmiddelen op naam (hoofdletterongevoelige deelstring). Parameters: q (verplicht, ≤200 tekens), home_nation, limit. Geeft id, description, ndbNumber terug.
curl -H "X-Api-Key: YOUR_KEY" \
"https://api.food-info.org/api/v1/foods/search?q=oats&limit=5"/foods/:idEén voedingsmiddel op FoodData Central-id: id, description, ndbNumber, dataType, publicationDate. 404 als onbekend.
/foods/:id/panelVolledig voedingspanel: gegroepeerd per 100 g + hoeveelheden per portie en % referentie-inname. Parameters: portionId (optioneel), source ("UK RI" / "FDA 2016"; standaard UK RI). 404 als onbekend.
/nutrients/:nutrientId/top-foodsOmgekeerd zoeken: referentievoedingsmiddelen rijkst aan een voedingsstof per 100 g, hoogste eerst. Parameters: home_nation, limit.
curl -H "X-Api-Key: YOUR_KEY" \
"https://api.food-info.org/api/v1/nutrients/1089/top-foods?limit=3"Antwoord (voedingsmiddel-id's/hoeveelheden zijn illustratief):
{
"Nutrient": { "Id": 1089, "Name": "Iron, Fe", "Unit": "MG" },
"Results": [
{ "FoodId": 170554, "Description": "Spices, thyme, dried", "Amount": 123.6 },
{ "FoodId": 169966, "Description": "Seeds, sesame flour", "Amount": 14.6 }
]
}/nutrients/:nutrientId/bottom-foodsTegenhanger van top-voedingsmiddelen: referentievoedingsmiddelen met de minste hoeveelheid van een voedingsstof per 100 g. Zelfde parameters en antwoordstructuur.
The two endpoints below need a Practitioner key. A free key reaches them but receives 403 with the required and current tier named in the body. Both are POST and take JSON.
/recipes/parseParses raw ingredient lines into structured quantity, unit and food name. Deterministic text handling only, with no database lookup and no food matching, so it is the cheap call to use when you only need structure. Body: { "lines": ["2 tbsp olive oil", "200g plain flour"] }.
curl -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"lines":["2 tbsp olive oil","200g plain flour"]}' \
"https://api.food-info.org/api/v1/recipes/parse"/recipes/analyzeFull analysis: resolves each line to a food, then returns per-serving and per-100 g nutrition with source attribution and review flags for lines it was unsure about. Body takes lines (required), region (ISO country code, biases matching to that country's reference foods) and servings.
Returns ingredients, perServing, per100g, totalGrams, servings, sources, reviewFlags and nutrientGroups. Each nutrient row carries nutrientId, name, unit, perServing, per100g, percentDailyValue and referenceAmount. Check reviewFlags before displaying a result as authoritative.
curl -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"lines":["2 eggs","100ml milk"],"region":"GB","servings":2}' \
"https://api.food-info.org/api/v1/recipes/analyze"| Status | Betekenis |
|---|---|
400 | Ongeldige invoer — bijv. leeg q of een niet-positieve nutrientId. De body is een JSON-object met een error-bericht. |
401 / 403 | Missing, invalid or revoked key (401), or a Practitioner-only endpoint called with a free key (403). The 403 body names the tier required and the tier you hold. |
404 | Geen voedingsmiddel of voedingsstof met dat id. |
429 | Limiet overschreden — zie Retry-After. |
Sign in to generate an API key. A free account is enough to start: 100 requests a day.
Create a free account