Barcode lookup
Barcode Nutrition API
A barcode nutrition API turns a UPC or EAN scan into a logged meal in one request. The local catalog is checked first, then Open Food Facts, and both return the same response shape.
- foods in catalog
- 6.8M+ foods
- barcode formats
- UPC + EAN
- local + Open Food Facts
- 2 sources
- scan to nutrition
- 1 request
What the Barcode Nutrition API gives you
Scanner-agnostic
Works with any scanner library that yields raw digits; dashes are stripped automatically.
Two-source coverage
Verified local catalog first, automatic Open Food Facts fallback for the long tail of products.
Logging-ready payloads
No thousand-field raw dumps: only product, serving, and nutrition fields your app logs.
Allergen data
Ingredients text and allergen lists when the source provides them, for safety-aware apps.
Per-100g normalization
Macros are normalized per 100 g (and per serving when labeled), so portion math stays simple.
Graceful misses
Unknown barcodes return a clean 404 so your app can fall back to text search.
Every response is trimmed to what logging apps actually need: product name and brand, ingredients and allergens, serving metadata, macros per 100 g and per serving when available, and micronutrients when present.
Full parameters and response shapes live in the API documentation, and you can try every endpoint in the playground without signing up.
curl "https://calorieapiadmin.com/api/v1/search/barcode/3017620422003" \ -H "X-API-Key: your_api_key_here"
How a barcode lookup is resolved
Each request runs the same steps. Non-digit characters are stripped from the code, so scanner output with dashes or spaces works as-is. The digits are matched exactly against the local catalog. On a miss, the same digits go to Open Food Facts. If neither source knows the code, the API returns HTTP 404 with "Food not found for barcode".
A local hit comes from a catalog of 6.8M+ foods. A fallback hit comes from Open Food Facts at lookup time and is not stored in that catalog. Both come back in one response shape, with product name, brand, serving metadata, macros per 100 g, and ingredients and allergens when the source has them, so your client code never branches on the source.
UPC-A, EAN-13, and the leading zero
A 12-digit UPC-A code and the 13-digit EAN-13 code with a leading zero describe the same product. Catalogs often store only one of the two forms. The lookup matches the digits you send, so if a 12-digit scan returns 404, send it again with a 0 in front before you fall back to manual entry.
Keep the digits the scanner returned in your own log as well as the food you resolved. If the user scans the same product next week, you can show the saved food at once and skip the call.
When to use food search instead
Loose produce, bakery items, butcher counters, and restaurant meals have no barcode. For those, call food search or suggest, let the user pick the match, and scale the per-100 g values by the grams they ate. A logging screen usually needs both: the scanner for packaged food and search for everything else.
The free tier gives 1,000 calls a month for development, with barcode, search, and suggest included. A commercial app needs the Plus or Enterprise plan and the X-API-Usage-Type: commercial header.
Barcode Nutrition API: frequently asked questions
Which barcode formats does the API support?
UPC and EAN barcodes. Pass the digits in the URL path; dashes are stripped automatically, so scanner output works as-is.
What happens when a product is not in the catalog?
The API automatically falls back to Open Food Facts with the same normalized response shape. If neither source knows the code, you get a 404 and can offer manual search.
Is the response shape different for fallback products?
No, local-catalog and Open Food Facts products return identical structures, so your client code never branches on data source.
Can I use barcode lookup in a commercial app?
Yes, on the Plus or Enterprise plan with the X-API-Usage-Type: commercial header. Development and personal projects can use the free tier.
What should my app do when a 12-digit UPC is not found?
Retry once with a leading zero, which is the 13-digit EAN form of the same code, before showing manual search. The lookup matches the digits you send and does not try the other form for you.
Are Open Food Facts results stored in your catalog?
No. A fallback result is fetched from Open Food Facts at lookup time and returned in the same shape, but it is not written into the Calorie API catalog.
Start building today
Create a free account, generate an API key, and make your first request in minutes.
