Developer API

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.

Overzicht

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.

Basis-URL
https://api.food-info.org/api/v1
Formaat
JSON
Authenticatie
X-Api-Keyheader
Plan
Free tier, or Practitioner for higher limits

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.

Authenticatie

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"

Limieten

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.

PlanPer minutePer dayRecipe endpoints
Free10100No (403)
Practitioner6010,000Yes

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.

Endpoints

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.

GET/nutrients

De voedingsstoffencatalogus — id, name, unit, categorie — zodat u de nutrientId-waarden kunt ontdekken die de omgekeerde zoekendpoints verwachten.

GET/foods/search

Zoek 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"

GET/foods/:id

Eén voedingsmiddel op FoodData Central-id: id, description, ndbNumber, dataType, publicationDate. 404 als onbekend.

GET/foods/:id/panel

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

GET/nutrients/:nutrientId/top-foods

Omgekeerd 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 }
  ]
}

GET/nutrients/:nutrientId/bottom-foods

Tegenhanger van top-voedingsmiddelen: referentievoedingsmiddelen met de minste hoeveelheid van een voedingsstof per 100 g. Zelfde parameters en antwoordstructuur.

Recipe endpoints (Practitioner)

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.

POST/recipes/parse

Parses 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"

POST/recipes/analyze

Full 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"

Fouten

StatusBetekenis
400Ongeldige invoer — bijv. leeg q of een niet-positieve nutrientId. De body is een JSON-object met een error-bericht.
401 / 403Missing, 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.
404Geen voedingsmiddel of voedingsstof met dat id.
429Limiet overschreden — zie Retry-After.

Uw API-sleutels

Sign in to generate an API key. A free account is enough to start: 100 requests a day.

Create a free account