# Compute Nutrition Facts



{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}

Compute compliant-rounded nutrition facts for a serving.

Applies compliant rounding rules to produce per-serving and optionally
per-container nutrition facts.

The top-level `version_id` identifies the new version created by
this operation. Pass it back as `If-Match` on the next mutation.

409 scenarios and recovery:

* MISSING\_DEPENDENCY: no nutrition -> call computeRecipeNutrition
* STALE\_DEPENDENCY: ingredients changed since nutrition was computed -> recompute nutrition
* MISSING\_DEPENDENCY: no serving -> call addRecipeServing
  After fixing, retry this call.

Available only on API versions declaring the `recipe_versioning`
capability. Older versions fall through to the legacy endpoint at
`POST /nutrition-facts` (no `version_id` stamping).

Related endpoints:

* computeRecipeNutrition — compute batch nutrition (prerequisite)
* getRecipePerServingNutritionFacts — retrieve the stored result

<APIPage document="&#x22;bettermenu&#x22;" operations="[{&#x22;path&#x22;:&#x22;/studio/recipes/{recipe_id}/servings/{serving_id}/nutrition-facts/compute&#x22;,&#x22;method&#x22;:&#x22;post&#x22;}]" />
