On this page
adjustStock
mutation · in the family Inventory adjustments
What it does
Write stock on or off outside of buying and selling — corrections, damage, shrink — with a reason code.
ADJUST stock (± write-on/write-off, reason-coded) in ONE atomic transaction. Same gates as receiveStock (ACTIVE + STOCKED); the bucket must be -movable (on_hand | damaged | held, named refusal); going negative is ALLOWED + stamps overcommitted on the entry; value moves at the CURRENT WMA. Requires the unrestricted capability.
What happens
Posts a signed stock movement; your inventory truth changes immediately and the movement is recorded forever.
Careful
This changes what your books say you own. It is always evented and auditable — never a way to hide a discrepancy, only to record one honestly.
Who may call it
Capability area: Inventory adjustments — Correcting stock with a reason and posting counts.
- Owner
- Manager
- Associate Manager
- An API key whose scope allows
api:adjustStock
Arguments
| Name | Type | Required | Notes |
|---|---|---|---|
input | AdjustStockInput AdjustStockInput! | yes | No further notes. |
Returns
StockMovement StockMovement! — A movement outcome: the POSTED entry + the post-movement InventoryItem — written in ONE transaction, so they can never disagree.
Example request
mutation ExampleAdjustStock($input: AdjustStockInput!) {
adjustStock(input: $input) {
inventoryItem {
id
sysId
type
caption
status
parentId
rootId
createdAt
updatedAt
revisionNum
revision
logicalFacilityId
styleType
controlClass
onHandQty
reservedQty
inTransitQty
damagedQty
heldQty
onOrderQty
availableQty
}
}
}
Variables:
{
"input": {
"inventoryItemId": "01900000-0000-7000-8000-9307d9650000",
"quantity": "2",
"bucket": "on_hand",
"reason": "Correcting a miscount."
}
}
Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.
Example response
{
"data": {
"adjustStock": {
"inventoryItem": {
"id": "01900000-0000-7000-8000-37386ae00000",
"sysId": "IV-EXMP-0000-000F",
"type": "InventoryItem",
"caption": "Blue jeans",
"status": "active",
"parentId": "01900000-0000-7000-8000-065235280000",
"rootId": "01900000-0000-7000-8000-a093dd800000",
"createdAt": "2027-01-31T00:00:00.000Z",
"updatedAt": "2027-01-31T00:00:00.000Z",
"revisionNum": 1,
"revision": "01900000-0000-7000-8000-b7960e180000",
"logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000",
"styleType": "<style type>",
"controlClass": "<control class>",
"onHandQty": "<on hand qty>",
"reservedQty": "<reserved qty>",
"inTransitQty": "<in transit qty>",
"damagedQty": "<damaged qty>",
"heldQty": "<held qty>",
"onOrderQty": "<on order qty>",
"availableQty": "<available qty>"
}
}
},
"extensions": {
"at": {
"callId": "01EXAMPLE-CALL-ID",
"version": {
"requested": {
"name": "genesis",
"number": 0
},
"serviced": {
"name": "genesis",
"number": 0
}
}
}
}
}
Errors this call can answer
VALIDATION/INVALID— Something in the request is not valid. (VALIDATION)AUTHN/REQUIRED— Sign in to do this. (AUTHN)AUTHZ/FORBIDDEN— Your role does not allow this action. (AUTHZ)RATE_LIMIT/THROTTLED— Too many requests in a short time. (RATE_LIMIT)NOT_FOUND/*— That record could not be found. (NOT_FOUND)CONFLICT/*— The record’s state, or a change made in the meantime, does not allow this; the codes are on the CONFLICT page. (CONFLICT)VALIDATION/VERSION_REQUIRED— The request did not say which app version it came from. (VALIDATION)