TastyAPI is a nutrition API that turns any food into a structured nutrition breakdown — calories, macronutrients, vitamins, minerals, allergens, and dietary flags. Send a plain-text description or a photo; get clean JSON back in about a second.
Use POST /analyze-food when you already know the food — a logged meal, a menu item, a recipe line. Use POST /analyze-image when you only have a photo and need the dish identified first. Both return the same nutrition schema, so you can mix them in one product without branching your parsing code.
Authenticate with a bearer token and post a food description. Every plan starts with a 7-day free trial.
cURLcurl -X POST https://tastyapi.com/analyze-food \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: text/plain" \
--data "grilled chicken salad, 2 cups"
Python
import requests
r = requests.post(
"https://tastyapi.com/analyze-food",
headers={"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "text/plain"},
data="grilled chicken salad, 2 cups",
)
food = r.json()["analysis"]
print(food["nutrients"]["calories"]["amount"],
food["nutrients"]["protein"]["amount"])
200 OK
{
"analysis": {
"foodName": "Grilled Chicken Salad",
"servingSize": { "amount": 250, "unit": "g" },
"nutrients": {
"calories": { "amount": 320, "unit": "kcal" },
"protein": { "amount": 34, "unit": "g" },
"carbohydrates": { "amount": 12, "unit": "g" },
"fat": { "amount": 14, "unit": "g" }
},
"allergens": { "contains": [], "mayContain": [] },
"dietaryInfo": { "isVegetarian": false, "isVegan": false, "isGlutenFree": true }
},
"language": "en"
}
| Field | Type | Description |
|---|---|---|
analysis.foodName | string | Normalized name of the identified food or dish. |
analysis.servingSize | object | amount and unit (g, ml, oz, cup) for the detected portion. |
analysis.nutrients | object | Each of calories, protein, carbohydrates, fat as an { amount, unit } pair, plus nested vitamins and minerals. |
analysis.allergens | object | contains and mayContain string arrays. |
analysis.dietaryInfo | object | Booleans: isVegetarian, isVegan, isGlutenFree, isKosher, isHalal. |
analysis.confidence | number | Model confidence, from 0 to 1. |
language | string | Language of the response (set via the lang query parameter). |
Image analysis adds an imageAnalysis object (quality and ambiguity signals). See the full schema in the API reference or the machine-readable OpenAPI spec.
The model is specialized for food — trained on tens of millions of food images and reference nutrition data rather than adapted from a general-purpose model. It handles prepared meals, packaged products, and raw ingredients, estimates portion size from context, and responds in 8 languages.
Values are calibrated estimates, typically within 10–15% of laboratory analysis, and are meant for tracking and informational use — not clinical diagnosis. When a portion is ambiguous, include a quantity in the request (for example, "2 cups") to tighten the estimate.
Pass your key as a bearer token on every request. Usage counts against your plan's monthly quota; on an auth or quota problem the API returns a 4xx with a JSON error body so you can surface it cleanly.
{ "error": "Invalid or expired token" }
Quotas by plan are listed on the pricing page; the full request and response reference lives in the API docs.
No. /analyze-food works from a text description alone. Use image recognition only when you start from a photo.
JSON over HTTPS, with a stable schema across both endpoints. Browse the nutrition database for live examples of the output.
Yes — describe the item or photograph the plate. For exact label values on a specific SKU, treat the response as a close estimate.
Get a key and make your first call in minutes. 7-day free trial on every plan.
Get an API key