Add Recipe Serving
Add a serving to a recipe — set serving size.
Creates a new serving entry. Does not replace existing servings — use updateRecipeServing to modify an existing serving by ID.
Accepts serving size input (user_provided or racc_guided), stores the raw input, and resolves the serving_size when recipe nutrition is already present.
For racc_guided mode, use searchUsRaccCategories to find the right RACC food category first.
Path Parameters
Query Parameters
Auto-compute per-serving nutrition facts after adding the serving and fold the result into the same Version. Default true. Set false only when the caller wants to commit the serving WITHOUT triggering NF recomputation (rare; expects a follow-up explicit POST .../nutrition-facts/compute).
trueHeader Parameters
Optimistic-concurrency token. Pass the version_id returned by the previous mutation (or by GET /recipes/{id}/versions) so the server can reject the request when another writer has advanced the recipe in the meantime. A mismatch surfaces HTTP 412 with the current version_id in the response body so the client can decide whether to retry, merge, or surface the conflict to the user. Only consumed on API versions that declare the recipe_versioning capability — older versions ignore the header.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "https://loading/studio/recipes/string/servings" \ -H "Content-Type: application/json" \ -d '{ "serving_size": { "household_amount": "2", "household_unit": "cookies", "metric_amount": "28", "metric_unit": "g", "serving_size_type": "user_provided" } }'{
"data": {
"recipe_id": "string",
"serving": {
"id": "string",
"serving_size_type": "string",
"serving_size": {
"household_measure": "string",
"metric_amount": 0,
"metric_unit": "string",
"servings_per_container": 0
},
"racc_inputs": {
"category_id": "string",
"target_audience": "string",
"unit_type": "string",
"unit_weight_g": "string",
"declared_serving_units": 0
},
"dual_column_status": "string",
"has_per_serving_nutrition_facts": true,
"has_per_container_nutrition_facts": true
}
},
"meta": {
"version": "string",
"request_id": "string",
"timestamp": "string"
},
"version_id": "string"
}{
"type": "about:blank",
"title": "Missing Dependency",
"status": 409,
"detail": "Recipe rcpe_abc123 has no computed nutrition. Nutrition must be computed before serving size can be resolved.",
"steps_required": [
{
"operation": "computeRecipeNutrition",
"reason": "Nutrition must be computed before serving size can be resolved."
}
]
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string",
"input": null,
"ctx": {}
}
]
}