A nutrition API and food database with 5.2 million foods
kcal returns the calories, macros and other nutritional values of packaged products and generic foods. Search by name, barcode, meal description or photo.
Use it as the food data for a calorie counter, a macro tracker, a meal planner or a fitness app. One API key, JSON responses, and you pay per query.
$ curl 'https://kcal.elbantli.com/v1/barcode?barcode=3017620422003' \ -H "Authorization: Bearer $KCAL_API_KEY" { "food": { "name": "Nutella", "brand": "Nutella, Ferrero", "nutrition": [{ "preparation": "as_sold", "basis": { "quantity": 100, "unit": "g" }, "nutrients": { "kcal": 539, "proteinG": 6.3, "carbsG": 57.5, "fatG": 30.9, "saturatedFatG": 10.6, "sugarsG": 56.3, "saltG": 0.107 } }, …], "portions": [ … ] } }
API
Search by name, barcode, meal or photo
Basic search and barcode lookup read the catalog directly. Smart search and image search split a meal into up to 12 foods and match each one with its amount.
When a food has no confident match, the API marks it no_match or ambiguous instead of picking the nearest result. The API reference lists every parameter, response field and error code.
Basic search
Find foods by name, brand, or ingredients.
GET /v1/basic-searchSmart search
Turn a meal description into foods and portions.
POST /v1/smart-searchImage search
Identify foods and portions from a photo.
POST /v1/image-transcribeBarcode lookup
Look up a packaged food by its barcode.
GET /v1/barcodeFood submission
Add a packaged food the catalog is missing, or correct one.
POST /v1/submit-food
Data
Nutrition facts for packaged and generic foods
The food database holds 5.2 million foods. Most are packaged products, each with its barcode. The rest are generic foods such as fruit, vegetables, meat and cooked dishes.
Each food lists its energy in kcal and its protein, carbohydrates, fat, sugars, fiber and salt in grams, with vitamins and minerals where the record has them. A nutrient with no recorded value comes back as null, not zero.
Values are stated for an amount, such as 100 g or one serving, and every result says which. Serving sizes come with their weight or volume when the record has it, so you can turn a cup or a slice into grams.
Pricing
Pay per successful query
Your first 500 successful queries are free, with no card. After that, add credit from $5. Failed requests are refunded.
| Endpoint | Per query | Per 1,000 |
|---|---|---|
| Basic search | $0.003 | $3.00 |
| Smart search | $0.040 | $40.00 |
| Image search | $0.055 | $55.00 |
| Barcode lookup | $0.002 | $2.00 |
| Food submission | $0.002 | $2.00 |
Smart and image search are priced per request, for up to 12 foods. Credits expire 12 months after your last top-up.
Quickstart
Try it with curl
Create an API key in the console, then run any of these.
export KCAL=https://kcal.elbantli.com/v1 export AUTH="Authorization: Bearer $KCAL_API_KEY" # Search by name, brand, or ingredients curl "$KCAL/basic-search?q=greek+yogurt&nb_results=3" -H "$AUTH" # Split a meal description into foods and amounts curl "$KCAL/smart-search" -H "$AUTH" -H "Content-Type: application/json" \ -d '{"q": "2 eggs and a slice of sourdough"}' # Identify the foods in a photo curl "$KCAL/image-transcribe" -H "$AUTH" -F image=@lunch.jpg # Look up a packaged food by barcode curl "$KCAL/barcode?barcode=3017620422003" -H "$AUTH"
FAQ
Common questions
Is the kcal nutrition API free?
Your first 500 successful queries are free, with no card. After that you pay per query from prepaid credit, starting at $5. There is no subscription, and failed requests are not charged.
Which barcodes can I look up?
The EAN and UPC barcodes printed on packaged food. Send the digits as printed, including leading zeros. A barcode the catalog does not have returns a 404 and is not charged, and you can submit that food so the next lookup finds it.
Does it do food recognition from a photo?
Yes. Image search identifies up to 12 foods in a photo, estimates each visible portion and matches each food to the catalog. A portion judged from a photo is marked as an estimate, so show it to your user for review.
Can I log a meal written in plain language?
Yes. Smart search splits a sentence such as “2 eggs and a slice of sourdough” into foods and amounts, and matches each one to the catalog. It corrects spelling and understands other languages.
Does the API add up the calories of a meal?
No. Smart search and image search return each food with its nutritional values and the amount that was eaten. You convert the amount to grams with one of the food's portions and scale the values yourself.
Can I use kcal in a commercial app?
Yes. kcal is made for apps and businesses. You may not resell raw API access or republish the catalog as a dataset, and some data must be credited when you show it to your users. The terms have the details.
Can an AI assistant query kcal?
Yes. kcal has an MCP server, so assistants such as Claude and Cursor can search foods and look up barcodes themselves. The API reference shows how to connect one.
How many requests can I send?
60 queries per minute for each account, across all its keys. Past that, requests return a 429 until the minute is over.
Changelog
What changed
- Assistants such as Claude and Cursor can query kcal through an MCP server, at the same prices. Connect by signing in from the app, or with an API key. The API reference shows how.
- New accounts start with 500 free queries instead of 10.
- Basic search answers faster and works as you type: a word you have not finished matches the start of longer words.
- Basic search matches the query as written. It no longer translates other languages or corrects spelling; smart search still does.
- Every error now has the same body: an error object with a code and a message. Authentication, credit and rate limit errors used to return a plain string.
- The API reference documents each endpoint's parameters, response fields and error codes.
- Credits expire 12 months after your last top-up. Each new top-up resets the date, and the billing page shows it.
- Search ranks generic reference foods above unbranded duplicates.
- Misspelled, French and British food names find their English match: bananna, pomme and crisps return banana, apple and potato chips.
- Smart and image search results include the reference names used to match each food, in a new references field.
- Shortened brand names such as coke zero and kitkat rank the branded product first.
- First release: basic search, smart search, image search and barcode lookup.
- The first 10 successful queries are free. After that, prepaid credits from $5, and failed requests are refunded.