Movements and counts: the ledger.
POST /api/v1/items/{id}/movements
Record a movement Receive, issue, sell or adjust. A receive with comp: true is free units (samples, promos, donations): unit cost 0, comp_value_cents per unit (default the item's unit cost), item cost unchanged. Refusals are 422 with a code: insufficient_stock (below zero without allow_negative), invalid_movement (a sale on an item not for resale, a zero adjust...), item_archived.
Parameters
| Name | In | Type | Notes |
id required | path | integer | |
Request body application/json
MovementWrite
Responses
201 Recorded.
| Field | Type | Notes |
data |
Movement |
|
quantity_on_hand |
integer |
|
404 No such record in this company. → Problem
422 Invalid fields; errors maps field to message, code says why. → Problem
401 Missing, expired or revoked bearer token (WWW-Authenticate: Bearer). → Problem
403 The token lacks the scope, or writes need an active subscription. → Problem
429 Over the service account's or the company's hourly budget. Retry after Retry-After seconds. → Problem
POST /api/v1/items/{id}/count
Set a counted quantity A physical count: the ledger gets one adjust for the difference (201), or nothing when the count already matches (200, changed=false).
Parameters
| Name | In | Type | Notes |
id required | path | integer | |
Request body application/json
| Field | Type | Notes |
count required |
integer |
|
note |
string |
|
Responses
201 Adjusted.
| Field | Type | Notes |
data |
Movement |
|
quantity_on_hand |
integer |
|
changed |
boolean |
|
200 Already at that count.
| Field | Type | Notes |
data |
null |
|
quantity_on_hand |
integer |
|
changed |
boolean |
|
404 No such record in this company. → Problem
422 Invalid fields; errors maps field to message, code says why. → Problem
401 Missing, expired or revoked bearer token (WWW-Authenticate: Bearer). → Problem
403 The token lacks the scope, or writes need an active subscription. → Problem
429 Over the service account's or the company's hourly budget. Retry after Retry-After seconds. → Problem