UPC EAN Barcode Nutrition Lookup JSON API
Published June 16, 2026
A UPC EAN barcode nutrition lookup JSON API resolves packaged food barcodes to calories, protein, carbs, and fat in one HTTP GET. Mobile calorie apps, grocery tools, and kiosk scanners depend on this flow. Calorie API returns consistent JSON for North American UPC and international EAN codes.
Endpoint
curl "https://api.calorieapi.com/api/v1/search/barcode/012345678905" \
-H "X-API-Key: YOUR_KEY"
Validate format before calling:
/^\d{8,14}$/.test(upc)
JSON Response Shape
Typical fields for app models:
| Field | Type | Use |
|---|---|---|
id | integer | Detail / portion calls |
name | string | Display name |
brand | string | Optional subtitle |
calories | number | Per 100g |
protein_g | number | Macro tracking |
carbohydrates_g | number | Carb apps |
fat_g | number | Macro tracking |
barcode | string | Echo UPC |
allergens | array | Filter UX |
Exact schema in API docs.
Mobile Integration
| Platform | Guide |
|---|---|
| Android Kotlin | Barcode example |
| iOS SwiftUI | Food logging REST |
| Ionic | Capacitor scanner |
| Grocery lists | Grocery barcode lookup |
Security
Never call with client-side key. Use Firebase or Next.js proxy.
Not Found Handling
Return friendly UX:
- Offer manual search
- Let user create custom food
- Log UPC for catalog gap analytics
Compare vendors: Chomp alternative | Food barcode lookup API.
Frequently Asked Questions
Does Calorie API support UPC and EAN barcodes?
Yes. GET /search/barcode/{upc} accepts standard 8 to 14 digit UPC and EAN barcodes and returns nutrition JSON.
What JSON fields does barcode lookup return?
Responses include food ID, name, brand, per-100g calories, protein, carbohydrates, fat, barcode, and allergens when available.
How do mobile apps call barcode nutrition APIs securely?
Mobile apps call a backend proxy that adds the Calorie API key server-side rather than embedding secrets in the app bundle.
What if a UPC is not in the database?
Fall back to text search, allow custom foods, or prompt users to enter nutrition manually while you log missing UPCs.
UPC vs EAN: does it matter?
Calorie API accepts both formats in the same barcode path. Normalize to digits only before calling the endpoint.
