PATCH /v1/items/{id}/stock
Scope
write_items
Request parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | required | item_id |
Idempotency-Key | header | string | required | Idempotency key (required). A UUID v4 is recommended. Resending the same key replays the original result, and the response carries Idempotent-Replay: true. Sending a different body with the same key returns 422, so always retry with the identical request. |
inventory | body | integer | optional | Set stock to this absolute value (0-99999). Mutually exclusive with adjustment. |
adjustment | body | integer | optional | The amount to add or subtract (negative subtracts). A result below zero or above the maximum returns 422. Mutually exclusive with inventory. |
variant_id | body | string | optional | Specify this to update stock for a single variant. An item that has variants carries null as its own stock, so variant_id is required for such items — omitting it returns 422. |
Response example
{
"item_id": "1408",
"variant_id": "1",
"inventory": 0,
"previous_inventory": 0
}
Description
Update item stock, either by setting an absolute value or by applying a delta. The write is applied synchronously under a row lock. (write_items)
Error response example
{
"error": {
"code": "insufficient_scope",
"message": "requires scope 'write_items'",
"request_id": "req_01H..."
}
}
Possible errors: 401 / 403 / 404 / 409 / 422 / 503