Open Food Facts API
Open database of food products worldwide — ingredients, nutrition, labels.
What it does
Open Food Facts is a collaborative, open database of food products from around the world — over 3 million items keyed by barcode — with ingredients, allergens, nutrition facts, Nutri-Score, NOVA processing group, labels, packaging and photos. The data is open (ODbL).
Base URL
Authentication
None for reads. A descriptive User-Agent (app name + version + contact) is required. Product lookup: /api/v2/product/{barcode}.json. Search: /api/v2/search or the older /cgi/search.pl.
Code examples
curl -s "https://world.openfoodfacts.org/api/v2/product/737628064502.json" \ -H "User-Agent: larzos-demo/1.0 (contact@example.com)"
import requests
H = {"User-Agent": "larzos-demo/1.0 (contact@example.com)"}
r = requests.get("https://world.openfoodfacts.org/api/v2/search", params={
"categories_tags_en": "breakfast-cereals", "nutrition_grades_tags": "a",
"fields": "product_name,brands,nutriscore_grade", "page_size": 5},
headers=H, timeout=15)
for p in r.json()["products"]:
print(p.get("product_name"), "-", p.get("brands"))Rate limits & quotas
Recently added rate limits on the shared server: roughly 100 req/min for product reads, 10 req/min for search, and 2 req/min for facet queries. Over that: HTTP 429. Bulk users should download the data exports (MongoDB dump, CSV, Parquet) instead of crawling.
Key response fields
| status / status_verbose | 1 = product found, 0 = not found |
| product.product_name / brands / quantity | Basic identity |
| product.ingredients_text / allergens_tags | Ingredients and allergens |
| product.nutriments | Per-100g and per-serving nutrient values |
| product.nutriscore_grade / nova_group / ecoscore_grade | Computed scores |
Common errors
| status: 0 | Barcode not in the database — you can contribute it via the write API or the app. |
| 429 | Rate limit exceeded — slow down or use the data dumps. |
| (missing fields) | Crowd-sourced data is uneven — many products lack full nutrition or photos; code defensively. |
When to use it (and alternatives)
The best free source for barcode → product lookups, allergen checks and Nutri-Score, especially for a scanning app. Coverage is strongest in Europe. For US-centric authoritative nutrient data use USDA FoodData Central; there are sibling projects for beauty, pet food and general products.
FAQ
Why is the User-Agent mandatory?
Open Food Facts runs on donated infrastructure and needs to identify and, if necessary, contact heavy users. Requests with a generic or missing User-Agent may be blocked.
The data for a product is incomplete — why?
It is entirely crowd-sourced. Popular products are well filled in; obscure ones may have just a name and a photo. Always null-check nutriments and score fields.
How do I do large-scale analysis?
Don’t crawl the API — download the full database export (available as MongoDB, CSV, JSONL and Parquet) and query it locally.
New to APIs?
Short guides for working with this API — and any other.