How to Use This API
1. Look Up a Product by Barcode
Use the product barcode (EAN/UPC) to get full details:
https://world.openfoodfacts.org/api/v0/product/737628064502.json
Returns product name, brands, ingredients (with origins), nutrition facts per 100g, allergens, additives, eco-score, and more.
2. Search Products by Name
https://world.openfoodfacts.org/cgi/search.pl?search_terms=chocolate&json=1&page_size=5
3. JavaScript — Scan a Barcode
async function lookupProduct(barcode) {
const resp = await fetch(
`https://world.openfoodfacts.org/api/v0/product/${barcode}.json`
);
const data = await resp.json();
if (data.status === 1) {
const p = data.product;
console.log(`Product: ${p.product_name}`);
console.log(`Brand: ${p.brands}`);
console.log(`Nutri-Score: ${p.nutriscore_grade}`);
console.log(`Ingredients: ${p.ingredients_text}`);
console.log(`Eco-Score: ${p.ecoscore_grade}`);
} else {
console.log('Product not found');
}
}
lookupProduct('737628064502');
4. Python — Compare Nutrition
import requests
barcodes = ['737628064502', '3017620422003']
for bc in barcodes:
resp = requests.get(f'https://world.openfoodfacts.org/api/v0/product/{bc}.json')
product = resp.json().get('product', {})
name = product.get('product_name', 'Unknown')
nutriments = product.get('nutriments', {})
sugar = nutriments.get('sugars_100g', 'N/A')
fiber = nutriments.get('fiber_100g', 'N/A')
print(f"{name}: {sugar}g sugar, {fiber}g fiber per 100g")
TL;DR
Open Food Facts is a collaborative, open-source database of food products from around the world — think Wikipedia for groceries. Look up any product by its barcode (EAN/UPC) and get detailed ingredient lists, nutrition facts, allergens, additives, packaging info, and sustainability data like eco-score and Nutri-Score. The dataset covers millions of products across 180+ countries. No API key, no rate limits, entirely open data.
Quick start: https://world.openfoodfacts.org/api/v0/product/737628064502.json
No API key needed — just make a request!
https://world.openfoodfacts.org/api/v0/product/737628064502.json
Frequently Asked Questions
- How do I find a product's barcode?
- Scan the product's physical barcode with any barcode scanner app. The barcode is the 13-digit EAN number (or 12-digit UPC for US/Canada).
- What data does the API return?
- Product name, brands, quantity, ingredients (with percent and origin), nutrition facts per 100g, allergens, additives, packaging, labels, certifications, Nutri-Score, Eco-Score, product images, and contributor information.
- Do I need an API key?
- No. Open Food Facts is completely open data. All endpoints are freely accessible without authentication.
- How can I contribute data?
- You can add or edit products via the website or mobile apps. The API also supports authenticated writes for contributors who want to submit data programmatically.
- What languages are supported?
- Data is available in 50+ languages. The API supports the
langparameter andlc(locale) for localized product names and ingredient translations. - Are there rate limits?
- No strict rate limits are published, but please be respectful — the service is run on donations and volunteer infrastructure. Cache responses when possible.
API Details
- API URL
https://world.openfoodfacts.org/api/v0/product/{barcode}.json- Documentation
- world.openfoodfacts.org/data
- Category
- Food
- Authentication
- Not Required
- Geographic Coverage
- Global — 180+ countries
What You Can Build
- Dietary restriction checker — flag products containing specific allergens or animal-based additives
- Shopping companion app that compares Nutri-Scores across similar products
- Barcode scanner for meal logging that auto-calculates daily nutrition
- Eco-Score dashboard showing the environmental impact of your grocery purchases
- Additive alert system that warns about controversial food additives in scanned products