Skip to main content

Update Stock Take

PUT 

/api/stock-takes/:stock_take

Update a stock take and its line items. Handles adding, updating, and removing items.

Required scope: inventory:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Authentication: Requires Bearer token.

items: each item accepts product_id (required, must exist), qty_counted (numeric, min 0), unit_cost (optional numeric, min 0 — an explicit 0 is valid and preserved), to_delete (boolean, removes the line).

items[].lots (array, optional): lot/batch rows for newly found (POSITIVE variance) stock on a lot-tracked product — each row becomes its own FIFO layer. For lot-tracked products every supplied lot must carry batch_number and expiry_date. Fields: batch_number, expiry_date, manufacture_date, quantity, lot_notes.

items[].lot_allocation (array, optional): per-item FEFO override for a NEGATIVE variance (a consume — counted qty lower than the system snapshot) on a lot-tracked product. When supplied, the named FIFO layers are drawn down at finalize instead of automatic FEFO/FIFO; when omitted the consume falls back to automatic FEFO exactly as before. Each row is { fifo_layer_id (integer, must exist in fifo_layers), quantity (numeric, > 0) }, and the allocation quantities must sum to abs(variance) (the snapshot − counted shortfall). The tenant setting inventory.lot_override_policy (off | warn | enforce) governs the override — under enforce an allocation selecting expired or non-FEFO (out-of-order) layers is rejected.

date_count (date, optional): re-dating a finalized (closed) stock take moves its initial positive inventory movement and FIFO cost-layer date; on the next accounting sync this also re-dates the journal entry (TxnDate). Initial counts cannot be re-dated.

reallocate_usages (boolean, optional): when true AND the date changed, dispatches a tracked FIFO reallocation that replays historical consumption against the re-ordered layers so each past usage consumes the correct layers in FIFO order, recomputes COGS, and propagates it to documents and accounting. When dispatched, the response includes reallocation_tracked_job_id to follow via the tracked job log endpoints. Preview the impact first via the reallocation-preview endpoint.

Returns 400 if: the stock take is closed and the request attempts to change quantities; an adjustment-mode item cannot be modified; the new (or current) date_count falls on or before the accounting lock date; or the reallocation would change COGS on a consumption dated inside a locked accounting period.

Response includes deletable (boolean) and delete_blocked_reasons (string[]).

Requires permission: inventory.count

Each item may carry variance_reason — a root-cause code for the count variance. One of: receiving_error, picking_error, damage, mislabel, shrinkage, unknown.

Request

Responses

OK

Response Headers
    Content-Type