Adjust the stock on hand of a variant
POST
/api/v1/workspaces/{workspaceId}/inventory-items/{inventoryItemId}/adjustments
const url = 'https://api.crossmart.io/api/v1/workspaces/example/inventory-items/example/adjustments';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"mode":"delta","quantity":1,"reason":"OPENING_BALANCE","note":"example"}'};
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.crossmart.io/api/v1/workspaces/example/inventory-items/example/adjustments \ --header 'Content-Type: application/json' \ --data '{ "mode": "delta", "quantity": 1, "reason": "OPENING_BALANCE", "note": "example" }'Adds or removes units, or sets the counted stock, and records the change in the ledger with its reason and author. Reserved units are not changed.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”workspaceId
required
string
inventoryItemId
required
string
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
mode
required
string
quantity
required
With delta, units to add (or remove, when negative). With set, the new stock on hand.
number
reason
required
One of RECEIVED, CORRECTION, RETURNED, DAMAGED, LOST, SOLD. The other reasons are recorded by Crossmart.
string
note
string
Responses
Section titled “Responses”Media typeapplication/json
object
inventoryItemId
required
string format: uuid
variantId
required
string format: uuid
productId
required
string format: uuid
productTitle
required
string
optionValues
required
One value per product option, in order
Array<string>
sku
required
string
imageUrl
required
The product’s first image
string
tracked
required
Whether Crossmart tracks stock for this variant
boolean
onHand
required
Units in stock: available plus reserved
number
reserved
required
Units held for open orders
number
available
required
Units that can still be sold, and what channels receive
number
stockLevel
required
string
updatedAt
required
string format: date-time
Example
{ "stockLevel": "in_stock"}