Nutrition analysis API for text, recipes and menu items
Nutrition analysis API for plain text and recipes
Send a line of text with amounts, such as "2 eggs and a slice of toast" or a recipe's ingredient list. You get back each item with its portion in grams, calories, macros, 13 micronutrients and a NutriScore grade from A to E.
The test key costs nothing. Credit packs start at $49, with no subscription.

Sample result
Grilled chicken with rice and salad
515kcal
Protein51.9 g
Carbs47.7 g
What can you send to a nutrition analysis API?
A line of plain text with amounts, up to 2,000 characters, sent with type set to text. It can be one food, a whole recipe or a dish name from a menu.
The same endpoint also takes a meal photo or a photo of a nutrition label. Text is the easiest input to start with because you need no image.
"150 g grilled chicken breast"
One food with an amount. The result has one item with its grams, calories, macros and micronutrients. There is no separate food search, so this line is how you look up a single food.
"200 g salmon, 150 g rice, 1 tbsp olive oil"
A recipe's ingredients. Each ingredient comes back as its own item, and meal.totals adds them up, so you can show the whole dish and each part.
"Quiche Lorraine, 1 slice"
A menu dish with a portion. The scan splits it into the items it estimates for that dish. Each item says in source whether its numbers came from food data, a web lookup or an estimate.
How do you analyze nutrition from text with an API?
You make one POST request with your key and the text, and read the JSON that comes back in the same response. There is nothing to index or set up first.
Get a test key
Sign in at the console with your email. A new account gets a test key that returns a fixed sample in the real result shape and uses no credits.
Write the line with amounts
Put the weight or count next to each food: "2 eggs", "150 g bratwurst", "1 slice of toast". Amounts are what make the portion and the totals come out right.
Send it to POST /v1/scans
Set
typetotext, put the line intextand passlanguageif you want the names in another language.Read the items and totals
Use
itemsfor each food andmeal.totalsfor the whole line. Store the result with your recipe or log entry, because showing it again costs nothing.
A real request in curl and Python
Both calls send the same POST /v1/scans body shape and return the same JSON.
The curl call looks up a German lunch in English. The Python call sends a US breakfast and asks for French names with language set to fr. Set the timeout to at least 100 seconds, because a scan can take up to 95.
curl
curl https://platform-api.nutriscan.app/v1/scans \
-H "Authorization: Bearer $NUTRISCAN_KEY" \
-H "Content-Type: application/json" \
-d '{ "type": "text", "language": "en",
"text": "150 g bratwurst with 200 g potato salad" }'Python
import os, requests
resp = requests.post(
"https://platform-api.nutriscan.app/v1/scans",
headers={"Authorization": f"Bearer {os.environ['NUTRISCAN_KEY']}"},
json={"type": "text", "language": "fr",
"text": "2 eggs and a slice of toast"},
timeout=100,
)
result = resp.json()
print(result["meal"]["nutri_score"], result["meal"]["totals"]["calories"])
for item in result["items"]:
print(item["name"], item["grams"], item["calories"], item["source"])What does a nutrition analysis response look like?
It is one JSON object with a meal block for the whole line and an items array with one entry per food. This is the sample a test key returns, trimmed to the main fields.
A live scan returns the same shape with your numbers, plus usage.credits_left. The credits_used field shows what that scan cost. Every field is on the result page.
{
"id": "scn_Q2mX8rT4vK1pLw9eZb3nYh6A",
"status": "succeeded",
"language": "en",
"meal": {
"name": "Grilled chicken with rice and salad",
"nutri_score": "B",
"nutri_score_reason": "Lean protein and vegetables balance the rice; moderate sodium from the marinade.",
"totals": {
"calories": 515, "protein_g": 51.9, "carbs_g": 47.7, "fat_g": 11.1,
"fiber_g": 2.2, "sugar_g": 1.6, "saturated_fat_g": 2.3, "trans_fat_g": 0,
"micros": { "sodium_mg": 457, "potassium_mg": 645, "…": "13 in all" }
}
},
"items": [
{
"name": "Grilled chicken breast",
"portion": { "value": 150, "unit": "g", "display": "150 g" },
"grams": 150,
"calories": 248, "protein_g": 46.5, "carbs_g": 0, "fat_g": 5.4,
"micros": { "sodium_mg": 410, "…": "…" },
"source": "food_db"
}
],
"credits_used": 0,
"test_mode": true
}Which nutrients does the analysis include?
21 nutrients, for the meal total and for every item: calories, 7 macro fields and 13 micronutrients. Units are part of the field names.
calorieskcalprotein_g, carbs_g, fat_g, fiber_g, sugar_g, saturated_fat_g, trans_fat_ggramsmicros object, including sodium_mg, potassium_mg, calcium_mg, iron_mg, vitamin_c_mg, vitamin_a_mcg and omega_3_mgmilligrams or micrograms, as the key saysmeal.nutri_score from A to E, with a one-sentence meal.nutri_score_reasonA is most favorableRead micros by key and treat a key you do not know as a new nutrient, so your code keeps working if the list grows.
Example, worked from our public pricing
What does a nutrition analysis cost?
A short text log uses about 60 credits, which is about $0.06. Analyzing 1,000 recipe lines a month comes to about $60.
1,000recipe lines a month
60credits a line, about
$0.001a credit
$60a month
A scan is priced from the work it took, so a long ingredient list can use more than 60 credits and a single food can use fewer. Every scan uses at least 20, and the exact figure is in credits_used on each result. Test scans and scans that fail on our side cost nothing.
One Growth pack ($199, 199,000 credits) covers about three months of that volume. Credits never expire and there is no subscription.
Pack pricesWhat are the limits and errors for text analysis?
The limits to design around are 2,000 characters of text, 60 scans a minute and up to 95 seconds a scan. Errors use one JSON body, and you branch on its code.
text, only with type: "text".Split a longer list across requests and add the totals yourself.language takes en, de, fr, es, it, pt, nl, pl, ru, tr, hi or ar. Default en.An unsupported value falls back to en. It sets the language of food names and the NutriScore reason.429 rate_limited, wait for Retry-After (60 seconds). Queue bulk jobs and send them at a steady pace.402 insufficient_credits, buy a pack in the console.400 invalid_request for a malformed body. Unknown top-level keys are rejected.Fix the request. The message names the field.422 no_food_detected, charged for the work it used, at least 20 credits.Check the input before you retry.500 scan_failed costs 0 credits.Retry. Send an Idempotency-Key header so a retry after a dropped connection is charged once.Every status and code is on the errors page, and the rest of the limits are on the limits page.
When is a nutrition analysis API not the right fit?
It does not fit if you need to search a food database, scan barcodes or get an answer in under a second. It returns an estimate for what you send.
What it does
Reads a line of text with amounts and returns each item with 21 nutrients and a NutriScore grade.
Handles a single food, a recipe's ingredients or a menu dish in the same request.
Takes a meal photo or a nutrition label photo through the same endpoint, by upload or a public https URL.
Returns names and the grade reason in 12 languages.
What it does not do
No food search endpoint and no searchable food database. You cannot list foods or browse them.
No barcode lookup. For packaged food, photograph the nutrition table and send it as a label scan.
Not built for search-as-you-type. A scan can take up to 95 seconds, so use streaming or a queue where a person is waiting.
No allergen field. Results are estimates, not medical advice or legal label values.
Questions about nutrition analysis by text
Anything else, the API docs cover every field and error.
How do I get nutrition data for one food?
Send it as text with an amount, such as 150 g grilled chicken breast, with type text. There is no separate food search or barcode endpoint, so the text line is the way to look up one food. The result lists the food with its grams, calories, macros and micronutrients.
How long can the text be?
Up to 2,000 characters in the text field. A recipe with its ingredient amounts fits in one request. Split a longer list across requests and add the totals yourself.
Can it analyze a recipe with many ingredients?
Yes. Put the ingredients with their amounts in one line of text. You get each item with its grams and nutrients, and meal.totals adds them up. The totals cover what you sent, so divide by your serving count yourself.
What does one text analysis cost?
A short text log uses about 60 credits, which is about $0.06, and every scan uses at least 20. The exact amount is in credits_used on each result. Packs start at $49 for 49,000 credits, and credits never expire.
Which languages does it support?
12 languages: English, German, French, Spanish, Italian, Portuguese, Dutch, Polish, Russian, Turkish, Hindi and Arabic. Set language on the request and the food names and the NutriScore reason come back in it.
Is this a food database I can search?
No. There is no food search endpoint, no barcode lookup and no searchable food database. You send text, a meal photo or a label photo, and the scan returns a result. Each item has a source field that says whether its numbers came from NutriScan's food data, a web lookup or an estimate.
Are the numbers exact?
No. They are estimates for food logging, not medical advice. Check the source field on each item, and ask users to confirm the portion on items marked estimate. Where the law requires a nutrition label, use values from your own lab tests or recipe calculation.
Send your first line of text
Sign in with your email, try a recipe against the test key, and buy credits when you are ready to go live.
- Test key at sign-up
- Packs from $49
- No subscription
- Credits never expire

