GET/nutrients
El catálogo de nutrientes — id, name, unit, categoría — para que puedas descubrir los valores de nutrientId que aceptan los endpoints de búsqueda inversa.
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.
Los dos puntos al inicio indican un parámetro de ruta (p. ej., :id). Donde se muestre: limit va de 1 a 100 (por defecto 25); home_nation es un código de país ISO (p. ej., GB) que prioriza los alimentos de referencia de ese país.
/nutrientsEl catálogo de nutrientes — id, name, unit, categoría — para que puedas descubrir los valores de nutrientId que aceptan los endpoints de búsqueda inversa.
/foods/searchBusca alimentos por nombre (subcadena sin distinción entre mayúsculas y minúsculas). Parámetros: q (obligatorio, ≤200 caracteres), home_nation, limit. Devuelve id, description, ndbNumber.
curl -H "X-Api-Key: YOUR_KEY" \
"https://api.food-info.org/api/v1/foods/search?q=oats&limit=5"/foods/:idUn único alimento por id de FoodData Central: id, description, ndbNumber, dataType, publicationDate. 404 si no se encuentra.
/foods/:id/panelPanel nutricional completo: cantidades agrupadas por 100 g + por ración y % de ingesta de referencia. Parámetros: portionId (opcional), source ("UK RI" / "FDA 2016"; por defecto UK RI). 404 si no se encuentra.
/nutrients/:nutrientId/top-foodsBúsqueda inversa: alimentos de referencia más ricos en un nutriente por 100 g, de mayor a menor. Parámetros: home_nation, limit.
curl -H "X-Api-Key: YOUR_KEY" \
"https://api.food-info.org/api/v1/nutrients/1089/top-foods?limit=3"Respuesta (ids y cantidades de alimentos son ilustrativos):
{
"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-foodsInverso de los alimentos más ricos: alimentos de referencia con menos cantidad de un nutriente por 100 g. Mismos parámetros y estructura de respuesta.
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"| Estado | Significado |
|---|---|
400 | Entrada inválida — p. ej., q en blanco o un nutrientId no positivo. El cuerpo es un objeto JSON con un mensaje de error. |
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 | No existe ningún alimento o nutriente con ese id. |
429 | Límite de uso superado — consulta Retry-After. |
Sign in to generate an API key. A free account is enough to start: 100 requests a day.
Create a free account