Adjust a product's stock level by a relative quantity, with a reason
const url = 'https://api.oletapp.com/your-store/v1/inventory/adjustments';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"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}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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_idorskuis required.skumatchesproduct.skucase-insensitively among live products only, and never a barcode (product_code). -
Idempotency-Keyis REQUIRED: a relative delta replayed without one would double-count. -
400 VALIDATION_FAILED: neither or both ofproduct_id/skuwere given. -
404 NOT_FOUND: theskudoes 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
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
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}Responses
Section titled “Responses”Adjust a product’s stock level by a relative quantity, with a reason
object
object
Examplegenerated
{ "data": { "adjustment_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "movement_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "on_hand": 1 }}default
Section titled “default”An error response.
object
object
A machine-readable error code, e.g. VALIDATION_FAILED.
object
A plain-English sentence describing what went wrong.
Example
{ "error": { "code": "UNAUTHORIZED" }}