applyStockCount
Requires permission inventory:stock_adjustment:create.
Applies a stock count for one warehouse, all or nothing. Every line whose counted quantity differs from expectedOnHand becomes one ADJUSTMENT movement. If any line's on-hand changed since it was counted, nothing is written and the count is refused. At most 500 lines; batch- or serial-tracked stock is counted in the console. 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 ApplyStockCount($input: ApplyStockCountInput!) {
applyStockCount(input: $input) {
id
warehouseId
movements {
id
movementNumber
status
quantity
variantId
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation ApplyStockCount($input: ApplyStockCountInput!) {\n applyStockCount(input: $input) {\n id\n warehouseId\n movements {\n id\n movementNumber\n status\n quantity\n variantId\n }\n }\n}",
"variables": {
"input": {
"lines": [
{
"countedQuantity": 0,
"expectedOnHand": 0,
"variantId": "id"
}
],
"reason": "string",
"warehouseId": "id"
}
}
}
EOF
Variables:
{
"input": {
"lines": [
{
"countedQuantity": 0,
"expectedOnHand": 0,
"variantId": "id"
}
],
"reason": "string",
"warehouseId": "id"
}
}
Response:
{
"data": {
"applyStockCount": {
"id": "id",
"warehouseId": "id",
"movements": [
{
"id": "id",
"movementNumber": "string",
"status": "string",
"quantity": "string",
"variantId": "id"
}
]
}
}
}
applyStockCount(
input: ApplyStockCountInput!
): StockCount!
Arguments
applyStockCount.input ● ApplyStockCountInput! non-null input
The warehouse, the reason and the counted lines.
Type
StockCount object
An applied stock count. Lines that matched on-hand wrote nothing, so they have no movement.