Setup
Put them in your environment or
.env; Data APIs covers the other ways.
Notes
- Reads need no key, only a custom User-Agent (set OPENFOODFACTS_USER_AGENT).
- Rate limits per IP: 15 product reads and 10 searches per minute; going over can get the IP banned. For bulk work use the CSV/JSONL data exports instead.
- Search v2 has no full-text query: it filters by tags and nutrient values only.
- Data is crowd-sourced; fields can be missing or wrong. Writes (adding or editing products) need an account and are not in this entry.
Endpoints
Get a product by barcode
- The answer carries status 1 when the product was found.
Search products by filters
- Nutrient filters put the condition in the parameter name, e.g. sugars_100g<10 or salt_serving>1; this entry cannot take them, so send them as a raw call to /api/v2/search.
- page_count in the answer is the number of products on this page, not the number of pages; total pages = floor((count - 1) / page_size) + 1.
- Language-specific tag filters put the language in the name, e.g. categories_tags_en=orange-juices; send them as a raw call to the same path.