Overview / Catalog / Update a recipe

Update a recipe

patch https://api.flactrum.com/v1/recipes/{recipe}

Sending items replaces the entire ingredient list and recalculates the cached cost.

Required scope recipes.write
Success status200
Returns One Recipe object

Parameters

NameInTypeDescription
recipe * path string ULID of the record.

Request body

FieldTypeDescription
product_id * string A product can have only one recipe.
name string|null —
waste_percent number|null Trim percentage for the whole recipe, 0-100. Defaults to 0.
items array Sending this replaces the whole recipe. Each entry is {stock_item_id, quantity, unit?}. Without unit, quantity is read as the base unit — sending 1 instead of 1000 there makes the product cost a thousand times less.

Response fields

FieldTypeDescription
id string —
product_id string —
name string|null —
waste_percent number Trim percentage applied to every line that does not set its own. Trim comes off stock AND goes into the cost: 200 ml at 5% deducts 210 ml and is costed at 210 ml.
cost number|null Cached unit cost of the product, recalculated on every write. Includes trim.
cost_calculated_at string|null —
items array quantity is always in the base unit (gram / millilitre / piece). entry_unit and entry_quantity keep whatever was typed in. gross_quantity is quantity with the trim added — what actually leaves stock. A line's waste_percent of null inherits the recipe's; zero is NOT the same as null and means "no trim on this line".

Examples

Recorded from the test suite — these are real requests and their real responses.

curl -X PATCH 'https://api.flactrum.com/v1/recipes/01m43sk6zt0ccqcg2h518ha92r' \
  -H 'Authorization: Bearer flk_your_key:your_secret' \
  -H 'Content-Type: application/json' \
  -d '{
    "items": [
        {
            "stock_item_id": "01m43sk6z81daw50c7y0c8vpcd",
            "quantity": 20,
            "unit": "gram"
        }
    ]
}'

HTTP 200 · application/json

{
    "data": {
        "id": "01m43sk6zt0ccqcg2h518ha92r",
        "product_id": "01m43sk6z5vw6y1t2p03crrgke",
        "name": null,
        "waste_percent": 0,
        "cost": 24,
        "cost_calculated_at": "2026-10-04T15:47:49+00:00",
        "items": [
            {
                "id": "01m43sk718nkgmvr4zcqjw6nsk",
                "stock_item_id": "01m43sk6z81daw50c7y0c8vpcd",
                "quantity": 20,
                "entry_unit": "gram",
                "entry_custom_unit_id": null,
                "entry_quantity": 20,
                "waste_percent": null,
                "gross_quantity": 20
            }
        ],
        "created_at": "2026-10-04T15:47:49+00:00",
        "updated_at": "2026-10-04T15:47:49+00:00"
    }
}