adjustInventory
Requires permission inventory:stock_adjustment:create.
Corrects the stock quantity, the cost, or both, of one product variant in a warehouse by recording an ADJUSTMENT movement. It must change quantity or cost, the warehouse, variant and unit of measure must exist in your organization, and an adjustment cannot take stock below zero unless your inventory settings allow negative stock. An idempotency key makes a retry return the original movement. Needs the stock adjustment create permission.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation AdjustInventory($input: AdjustInventoryInput!) {
adjustInventory(input: $input) {
id
batchNumber
movementNumber
serialNumber
status
type
fromWarehouse {
id
code
taxRegistrationNumber
name
status
type
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation AdjustInventory($input: AdjustInventoryInput!) {\n adjustInventory(input: $input) {\n id\n batchNumber\n movementNumber\n serialNumber\n status\n type\n fromWarehouse {\n id\n code\n taxRegistrationNumber\n name\n status\n type\n }\n }\n}",
"variables": {
"input": {
"adjustmentQuantity": 0,
"productId": "id",
"reason": "string",
"variantId": "id",
"warehouseId": "id"
}
}
}
EOF
Variables:
{
"input": {
"adjustmentQuantity": 0,
"productId": "id",
"reason": "string",
"variantId": "id",
"warehouseId": "id"
}
}
Response:
{
"data": {
"adjustInventory": {
"id": "id",
"batchNumber": "string",
"movementNumber": "string",
"serialNumber": "string",
"status": "CANCELLED",
"type": "ADJUSTMENT",
"fromWarehouse": {
"id": "id",
"code": "string",
"taxRegistrationNumber": "string",
"name": "string",
"status": "ACTIVE",
"type": "string"
}
}
}
}
adjustInventory(
input: AdjustInventoryInput!
): StockMovement!
Arguments
adjustInventory.input ● AdjustInventoryInput! non-null input
The details of the adjust inventory request.
Type
StockMovement object
A movement of stock: a receipt, issue, transfer or adjustment.