Evaluating a Combination
Send the Foods in a dish with their Portions and get one Trigger Profile for the whole thing.
POST/v1/combinations/evaluate
Nothing from the request is stored. A Combination carries Foods and grams, never a person or a time.
Request
{
"items": [
{ "foodId": "food_3bab6195decc17a9", "portionGrams": 200, "preparationId": "roasted" },
{ "foodId": "food_40e5af9a5038fee4", "portionGrams": 50 }
]
}
| Field | Description |
|---|---|
items |
From 1 to 50 items. The same Food may appear more than once. |
items[].foodId |
A Food ID from the catalogue. |
items[].portionGrams |
The Portion, a positive number of grams. |
items[].preparationId |
Optional. A Preparation listed in the Food’s preparations. It’s applied by the same rules as ?preparation=. |
items[].packagedFoodId |
Instead of foodId, a Packaged Food ID. It takes no preparationId, and its values per 100 ml count as unknown, since Portions are in grams. |
A bad request gets 400 with validation_error, and field names the first bad item, such as items[1].foodId.
Response
The request above, roma tomatoes with heavy cream, gives this. Both Foods are Foundation Foods, with Acidity from the FDA pH table and Fat from USDA. Neither has a sourced Caffeine value, and no sourced effect of roasting on tomatoes is known yet.
{
"items": [
{ "foodId": "food_3bab6195decc17a9", "name": "Tomato, roma", "preparationId": "roasted", "portionGrams": 200,
"preparation": { "id": "roasted", "name": "Roasted", "applied": false, "adjustedFactors": [],
"note": "No sourced effect of Roasted on this Food is known, so this is the Food's unchanged Trigger Profile." } },
{ "foodId": "food_40e5af9a5038fee4", "name": "Cream, heavy", "portionGrams": 50 }
],
"triggerProfile": [
{
"factor": "acidity", "kind": "pH", "status": "known", "value": 4.7, "knownPortionGrams": 250,
"estimate": true, "confidence": "low",
"contributors": [
{ "foodId": "food_3bab6195decc17a9", "name": "Tomato, roma", "preparationId": "roasted", "portionGrams": 200,
"value": 4.6, "source": { "dataset": "fda-ph", "version": "2007-04", … }, "confidence": "medium", "preparationApplied": false },
{ "foodId": "food_40e5af9a5038fee4", "name": "Cream, heavy", "portionGrams": 50,
"value": 6.62, "source": { "dataset": "fda-ph", "version": "2007-04", … }, "confidence": "medium" }
],
"unknownFor": []
},
{
"factor": "fat", "kind": "amount_per_100g", "unit": "g",
"status": "known", "value": 7.46, "knownPortionGrams": 250, "confidence": "high",
"contributors": [
{ "foodId": "food_3bab6195decc17a9", "name": "Tomato, roma", "preparationId": "roasted", "portionGrams": 200,
"value": 0.425, "source": { "dataset": "usda-fdc-foundation", "version": "2026-10-29", … }, "confidence": "high", "preparationApplied": false },
{ "foodId": "food_40e5af9a5038fee4", "name": "Cream, heavy", "portionGrams": 50,
"value": 35.6, "source": { "dataset": "usda-fdc-foundation", "version": "2026-10-29", … }, "confidence": "high" }
],
"unknownFor": []
},
{
"factor": "caffeine", "kind": "amount_per_100g", "unit": "mg", "status": "unknown",
"contributors": [],
"unknownFor": [
{ "foodId": "food_3bab6195decc17a9", "name": "Tomato, roma", "preparationId": "roasted", "portionGrams": 200 },
{ "foodId": "food_40e5af9a5038fee4", "name": "Cream, heavy", "portionGrams": 50 }
]
},
…
],
"interactions": []
}
Fat is (200 × 0.425 + 50 × 35.6) ÷ 250 = 7.46 g per 100 g. Pair the cream with “Coffee, brewed” from FNDDS instead, and Caffeine becomes partial: known for the coffee and listed in unknownFor for the cream.
There is one entry for every Trigger Factor, and never a blended score.
status
known: every Food in the Combination has a sourced value.partial: some Foods do, and the ones that don’t are listed inunknownFor.unknown: none do, and there is novalue.unknownForlists every item.
An unknown value is never counted as zero. When a result is partial, say so in your app.
How values combine
- Amounts (
amount_per_100g) are weighted by Portion. The result is per 100 g of the items with a known value, which together weighknownPortionGrams. A spoonful of cream doesn’t count like a cup. - Presence is
truewhen any Food has the factor, whatever its Portion: mint in a garnish is still flagged.falsewithpartialmeans only that none of the known Foods has it. - Acidity (
pH) for more than one item is an estimate. It hasestimate: trueandlowconfidence, because it averages hydrogen-ion concentration by Portion weight and ignores buffering. For a single item, it’s the Food’s own pH, withestimate: false.
contributors and confidence
contributors lists each item whose Food has a sourced value, with that value, its source and confidence. This lets you explain where a result came from.
confidence is the lowest confidence among the contributors, except for a presence factor that is true. There it’s the highest confidence among the Foods that have it.
Preparations
An item with a preparationId has an items[].preparation of { id, name, applied, adjustedFactors, note? }. applied: false means no sourced effect exists, so the Food’s own values were used. Its contributors carry preparationId, and preparationApplied says whether each value came from a sourced Preparation effect.
Interactions
interactions lists every Interaction whose Foods are all in the Combination. Interactions sit beside the Trigger Profile and never change its values.