Overview /
Stock & supply /
Update a purchase unit
Update a purchase unit
patch
https://api.flactrum.com/v1/purchase-units/{unit}
| Required scope | stock_items.write |
| Success status | 200 |
| Returns | One PurchaseUnit object |
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| unit * | path | string | ULID of the record. |
Request body
| Field | Type | Description |
|---|---|---|
| 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
| Field | Type | Description |
|---|---|---|
| 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 PATCH 'https://api.flactrum.com/v1/purchase-units/01m43mzja1k4w55y65vv27ns9v' \
-H 'Authorization: Bearer flk_your_key:your_secret' \
-H 'Content-Type: application/json' \
-d '{
"name": "Çuval"
}'
HTTP 200 · application/json
{
"data": {
"id": "01m43mzja1k4w55y65vv27ns9v",
"stock_item_id": "01m43mzj9rnhq60k73sy2hgph9",
"name": "Çuval",
"factor_to_base": 25000,
"is_purchase_default": true,
"is_active": true
}
}