Compute gram weights for ingredients
Compute gram weights for ingredient items — convert quantities to grams using portion data and standard measurement tables.
③ of 8 | Next: ⑤ updateRecipeIngredients Stateless — no recipe needed yet.
Use this to answer: "how many grams is 2 cups of flour?", "convert 3 eggs to grams", "get gram weight for these ingredients", "what does 1 pinch of saffron weigh?"
Called when ② searchUsIngredients returns null gram_weight and resolve_options points here. Accepts a batch of (ingredient_id, quantity, unit) items and returns gram weights.
When no portion match exists, returns resolve_options guiding the caller to either re-call with allow_estimation: true (system estimate) or ask the user for quantity_grams directly.
Authorization
BearerAuth JWT Bearer token authentication
In: header
Request Body
application/json
Country code for ingredient database and conversion rules.
"US"1 <= items <= 50When true, use estimation for items without a deterministic portion match.
falseResponse Body
application/json
application/json
curl -X POST "https://loading/ingredients/us/conversions/compute" \ -H "Content-Type: application/json" \ -d '{ "items": [ { "ingredient_id": "string", "quantity": "2", "unit": "cup" } ] }'{}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string",
"input": null,
"ctx": {}
}
]
}