Overview / Stock & supply / Create a purchase unit

Create a purchase unit

post https://api.flactrum.com/v1/purchase-units
Required scope stock_items.write
Success status201
Returns One PurchaseUnit object

Request body

FieldTypeDescription
stock_item_id * string —
name * string —
factor_to_base * number —
is_purchase_default boolean Only one default per stock item; setting a new one clears the old.
is_active boolean —

Response fields

FieldTypeDescription
id string —
stock_item_id string —
name string —
factor_to_base number How many base units one purchase unit is worth. A 12-litre case of milk on a millilitre item is 12000.
is_purchase_default boolean —
is_active boolean —

Examples

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

curl -X POST 'https://api.flactrum.com/v1/purchase-units' \
  -H 'Authorization: Bearer flk_your_key:your_secret' \
  -H 'Content-Type: application/json' \
  -d '{
    "stock_item_id": "01m43mzj9rnhq60k73sy2hgph9",
    "name": "Çuval (25 kg)",
    "factor_to_base": 25000,
    "is_purchase_default": true
}'

HTTP 201 · application/json

{
    "data": {
        "id": "01m43mzja1k4w55y65vv27ns9v",
        "stock_item_id": "01m43mzj9rnhq60k73sy2hgph9",
        "name": "Çuval (25 kg)",
        "factor_to_base": 25000,
        "is_purchase_default": true,
        "is_active": true
    }
}