Overview / Stock & supply / Adjust a stock balance

Adjust a stock balance

post https://api.flactrum.com/v1/stock-levels/adjust

Balances are never written directly. Every adjustment produces a stock movement carrying your reason, so "why did stock change" always has an answer. Send quantity to set an exact balance or delta to add to it.

Required scope stock.write
Success status200

Request body

FieldTypeDescription
stock_item_id * string —
branch_id string|null Either this or warehouse_id, not both.
warehouse_id string|null —
quantity number|null Set the balance to exactly this.
delta number|null Add this to the current balance; negative subtracts. Send exactly one of quantity or delta.
reason * string Required. It is written onto the movement so the change can always be explained later.
type string Movement type. Defaults to adjustment; use waste for spoilage.
unit_cost number|null —

Examples

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

curl -X POST 'https://api.flactrum.com/v1/stock-levels/adjust' \
  -H 'Authorization: Bearer flk_your_key:your_secret' \
  -H 'Content-Type: application/json' \
  -d '{
    "stock_item_id": "01m43mzjk48kbg3arnqqe1qwgg",
    "branch_id": "01m43mzjjvcqjd0grnj20jhzpv",
    "quantity": 5000,
    "reason": "Açılış stoğu"
}'

HTTP 200 · application/json

{
    "data": {
        "stock_item_id": "01m43mzjk48kbg3arnqqe1qwgg",
        "changed": true,
        "quantity_before": 0,
        "quantity_after": 5000,
        "movement_id": "01m43mzjkhna7146kh9eh338p7"
    }
}