Create a recipe
post
https://api.flactrum.com/v1/recipes
| Required scope | recipes.write |
| Success status | 201 |
| Returns | One Recipe object |
Request body
| Field | Type | Description |
|---|---|---|
| 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
| Field | Type | Description |
|---|---|---|
| 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
No recorded example yet.