Skip to content

Adjust a product's stock level by a relative quantity, with a reason

POST
/inventory/adjustments
curl --request POST \
--url https://api.oletapp.com/your-store/v1/inventory/adjustments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "note": "example", "occurred_on": "example", "outlet_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "product_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "quantity": 1, "reason_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "sku": "example", "unit_cost": 1 }'

The same rule logic as the admin stock adjustment: direction comes from the reason, and the write is floored at zero.

  • Exactly one of product_id or sku is required. sku matches product.sku case-insensitively among live products only, and never a barcode (product_code).

  • Idempotency-Key is REQUIRED: a relative delta replayed without one would double-count.

  • 400 VALIDATION_FAILED: neither or both of product_id/sku were given.

  • 404 NOT_FOUND: the sku does not match a live product.

  • 422 INSUFFICIENT_STOCK: the adjustment would take stock below zero.

  • 422 REASON_NOT_ALLOWED: the reason is a system reason or is turned off. A reason must be enabled and must not be a system reason.

  • 422 OUTLET_DELETED: the outlet has been deleted.

unit_cost (integer cents, optional) is the cost of the units added; it is blended into the outlet’s average cost. Leave it out to keep the current average. It is ignored when stock does not go up.

Requires scope: inventory:write

Media typeapplication/json
object
note
Any of:
string
<= 2000 characters
occurred_on
Any of:
string
/^\d{4}-\d{2}-\d{2}$/
outlet_id
required
string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/
product_id
string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/
quantity
required
number
reason_id
required
string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/
sku
string
>= 1 characters <= 100 characters
unit_cost
Any of:
integer
<= 900719925474
Examplegenerated
{
"note": "example",
"occurred_on": "example",
"outlet_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"product_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"quantity": 1,
"reason_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"sku": "example",
"unit_cost": 1
}

Adjust a product’s stock level by a relative quantity, with a reason

Media typeapplication/json
object
data
required
object
adjustment_id
required
string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/
movement_id
required
string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/
on_hand
required
number
Examplegenerated
{
"data": {
"adjustment_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"movement_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"on_hand": 1
}
}

An error response.

Media typeapplication/json
object
error
required
object
code
required

A machine-readable error code, e.g. VALIDATION_FAILED.

string
Allowed values: UNAUTHORIZED PLAN_REQUIRED INSUFFICIENT_SCOPE NOT_FOUND VALIDATION_FAILED CONFLICT STALE_VERSION RATE_LIMITED IDEMPOTENCY_KEY_REUSED IDEMPOTENCY_IN_PROGRESS IMAGE_FETCH_FAILED UNPROCESSABLE INTERNAL RETAILER_CANCELLED RETAILER_SUSPENDED RETAILER_NOT_FOUND TRIAL_DECISION_REQUIRED PLAN_USERS_EXCEEDED RETAILER_PAUSED PRODUCT_LIMIT_REACHED NOT_STOCK_TRACKED REASON_DIRECTION_MISMATCH REASON_NOT_ALLOWED INSUFFICIENT_STOCK OUTLET_DELETED
fields
Array<object>
object
field
required
string
message
required
string
message
required

A plain-English sentence describing what went wrong.

string
Example
{
"error": {
"code": "UNAUTHORIZED"
}
}