Overview / Catalog / Create a recipe

Create a recipe

post https://api.flactrum.com/v1/recipes
Required scope recipes.write
Success status201
Returns One Recipe object

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 POST 'https://api.flactrum.com/v1/recipes' \
  -H 'Authorization: Bearer flk_your_key:your_secret' \
  -H 'Content-Type: application/json' \
  -d '{
    "product_id": "01m43sk6par5vdcphgsast86pc",
    "name": "Latte reçetesi",
    "items": [
        {
            "stock_item_id": "01m43sk6pe9ew96ehyzqywt9ag",
            "quantity": 18,
            "unit": "gram"
        }
    ]
}'

HTTP 201 · application/json

{
    "data": {
        "id": "01m43sk6q26cc51hc0n8gb09bs",
        "product_id": "01m43sk6par5vdcphgsast86pc",
        "name": "Latte reçetesi",
        "waste_percent": 0,
        "cost": 21.6,
        "cost_calculated_at": "2026-10-04T15:47:49+00:00",
        "items": [
            {
                "id": "01m43sk6q446wptqhgr07grfve",
                "stock_item_id": "01m43sk6pe9ew96ehyzqywt9ag",
                "quantity": 18,
                "entry_unit": "gram",
                "entry_custom_unit_id": null,
                "entry_quantity": 18,
                "waste_percent": null,
                "gross_quantity": 18
            }
        ],
        "created_at": "2026-10-04T15:47:49+00:00",
        "updated_at": "2026-10-04T15:47:49+00:00"
    }
}