Nutrition calculation
Calculate Nutrition
Authorization
BearerAuth AuthorizationBearer <token>
JWT Bearer token authentication
In: header
Request Body
application/json
recipe_data*|
Recipe ingredients as natural language text or structured data
include_audit?boolean
Include detailed per-ingredient contribution breakdown for debugging and analysis. When true, response includes audit data with per-ingredient per-nutrient contributions suitable for CSV export.
Default
falseResponse Body
application/json
application/json
curl -X POST "https://evh09u6ys0.execute-api.us-west-2.amazonaws.com/us/nutrition/calculate" \ -H "Content-Type: application/json" \ -d '{ "recipe_data": { "ingredient_texts": [ "2 cups banana, mashed", "100g almond milk" ] } }'{
"data": {
"nutrition_profile": [
{
"id": 1003,
"bmid": "string",
"name": "Protein",
"total_amount": "string",
"unit": "g"
}
],
"total_weight_grams": "string",
"metrics": {
"total_nutrients_calculated": 0
},
"ingredient_resolutions": [
{
"converted": {
"quantity": 59,
"steps": [
{
"calculation": "0.5 cup x 236ml/cup = 118ml",
"factor": 236,
"input_quantity": 0.5,
"input_unit": "cup",
"output_quantity": 118,
"output_unit": "ml"
}
],
"unit": "g"
},
"matches": {
"candidates": [
{
"category": "Fruits and Fruit Juices",
"ingredient_id": "f_usda_ff:1105073",
"ingredient_name": "Bananas, overripe, raw",
"search_confidence": 0.95
}
],
"query_text": "flour",
"selected_match": {
"category": "Fruits and Fruit Juices",
"ingredient_id": "f_usda_ff:1105073",
"ingredient_name": "Bananas, overripe, raw",
"search_confidence": 0.95
}
},
"original_text": "1/2 cup flour",
"parsed": {
"ingredient_name": "flour",
"quantity": 0.5,
"quantity_text": "1/2",
"unit": "cup"
}
}
]
},
"audit": {
"summary": {
"total_ingredients": 5,
"total_ingredient_nutrient_pairs": 138
},
"ingredient_nutrient_pairs": [
{
"ingredient_name": "Chicken Breast",
"quantity_g": 200,
"contribution_factor": 2,
"nutrient_id": 1003,
"nutrient_bmid": "PROTEIN",
"nutrient_name": "Protein",
"reference_per_100g": 31,
"contribution_amount": 62,
"unit": "g"
}
]
},
"meta": {
"version": "string",
"request_id": "string",
"timestamp": "string"
}
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}