Open Food Facts API

⭐ Beginner's Pick Food & Drink / No Auth Required Beginner HTTPS
Free to Use Varies (check documentation)

Overview

Open Food Facts is a free, community-driven database of food products from around the world, containing nutritional facts, ingredients, allergens, and Eco-scores. No API key is required — you can look up any product by its barcode or search by name or nutrient. It is an excellent API for building nutrition trackers, diet apps, or sustainability dashboards.

💡

Beginner Tip

Look up a product using its barcode number (the digits under the barcode on the package) via GET /api/v2/product/{barcode}.json — this is the most reliable way to get accurate data for a specific item.

Available Data

recipe name and ingredients
nutritional values
calorie count
serving size
preparation time
Use case: Integrate food products database data into web and mobile applications

Example Response

JSON Response
{
  "recipe": "Chicken Stir Fry",
  "calories": 380,
  "protein_g": 32,
  "carbs_g": 28,
  "fat_g": 14,
  "ingredients": [
    "chicken breast",
    "bell pepper",
    "soy sauce",
    "garlic"
  ],
  "prep_time_minutes": 20
}

Field Reference

status 1 if the product was found, 0 if not found in the database.
product.product_name Consumer-facing product name as labeled on the packaging.
product.brands Comma-separated brand names associated with the product.
product.nutriments Nutritional values per 100 g (e.g., energy-kcal_100g, fat_100g, sugars_100g, proteins_100g).
product.ingredients_text Full ingredient list as printed on the packaging.
product.nutriscore_grade Nutri-Score letter grade (a through e) indicating overall nutritional quality.

Implementation Example

const url = "https://world.openfoodfacts.org/data";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

status 0 in response (product not found) The barcode does not exist in the Open Food Facts database yet.
Check the status field before accessing product data: if data.status === 0, show a "not found" message. You can also contribute the product at world.openfoodfacts.org.
Missing or empty nutriments fields Open Food Facts is community-sourced so data completeness varies widely by product.
Always treat nutritional fields as optional and display "N/A" when they are absent.
429 Too Many Requests Making rapid repeated requests triggers rate limiting.
Add a short delay between requests (e.g., 1 second) and cache product data locally by barcode to avoid redundant lookups.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 15/20
🔒 Security 15/15
🛠 Developer XP 15/20
✓ Reliability 7/15
Response Time 273ms

Fully tested on Apr 5, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Food & Drink
Difficulty Beginner
Verified: 2026-04-04

Similar APIs

View All →