Food product search
Searches Open Food Facts products by text, brand, category and country, with Nutri-Score filter and sort (relevance, popularity, Nutri-Score, newest): barcode, name, brands, quantity, categories, countries, Nutri-Score, NOVA, Eco-Score, allergens, labels, nutrition per 100 g, image. Pass next_page back as page; null on the last page. Further filters: NOVA group, Eco-Score, allergens to exclude, labels, ingredients to include or exclude and diet (vegan, vegetarian, palm oil free); all filters combine. Items also carry ingredients_analysis (vegan, vegetarian, palm oil free).
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
q | string | Search text. Example: chocolate spread |
brand | string | Brand, e.g. ferrero. |
category | string | Category, e.g. breakfast-cereals. |
country | string | Country sold in, e.g. france, united-states. |
nutri_score | string | Grades, comma-separated, e.g. a,b. |
sort | popularity | nutriscore | newest | popularity, nutriscore or newest (default relevance). |
limit | integer | Per page (default 20, max 100). |
page | integer | Page (default 1). |
nova_group | string | Comma-separated NOVA processing groups to include, 1-4 (1 = unprocessed, 4 = ultra-processed). |
eco_score | string | Comma-separated Eco-Score grades to include, a-e. |
allergens_exclude | string | Comma-separated allergens the product must not contain, e.g. milk,gluten,nuts,soybeans,eggs. |
labels | string | Comma-separated labels the product must all carry, e.g. organic,fair-trade,no-gluten,vegan. |
ingredients | string | Comma-separated ingredients the product must contain, e.g. hazelnut. |
ingredients_exclude | string | Comma-separated ingredients the product must not contain, e.g. palm-oil. |
diet | string | Comma-separated diet requirements: vegan, vegetarian, palm_oil_free. |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/food/v1/search?q=chocolate+spread" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/food/v1/search",
params={"q": "chocolate spread"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/food/v1/search");
url.searchParams.set("q", "chocolate spread");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).