mutation inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) {
inventoryMoveQuantities(input: $input) {
userErrors {
field
message
code
}
inventoryAdjustmentGroup {
createdAt
reason
referenceDocumentUri
changes(quantityNames: $quantityNames) {
name
delta
}
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-04/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) { inventoryMoveQuantities(input: $input) { userErrors { field message code } inventoryAdjustmentGroup { createdAt reason referenceDocumentUri changes(quantityNames: $quantityNames) { name delta } } } }",
"variables": {
"input": {
"reason": "damaged",
"referenceDocumentUri": "logistics://some.warehouse/take/2023-01-23T13:14:15Z",
"changes": [
{
"quantity": 10,
"inventoryItemId": "gid://shopify/InventoryItem/30322695",
"from": {
"locationId": "gid://shopify/Location/124656943",
"name": "available",
"ledgerDocumentUri": null
},
"to": {
"locationId": "gid://shopify/Location/124656943",
"name": "reserved",
"ledgerDocumentUri": "logistics://toronto.warehouse/work-orders/2023-01-04/2"
}
}
]
},
"quantityNames": [
"committed",
"reserved",
"safety_stock",
"quality_control",
"damaged",
"available",
"on_hand",
"incoming"
]
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) {
inventoryMoveQuantities(input: $input) {
userErrors {
field
message
code
}
inventoryAdjustmentGroup {
createdAt
reason
referenceDocumentUri
changes(quantityNames: $quantityNames) {
name
delta
}
}
}
}`,
{
variables: {
"input": {
"reason": "damaged",
"referenceDocumentUri": "logistics://some.warehouse/take/2023-01-23T13:14:15Z",
"changes": [
{
"quantity": 10,
"inventoryItemId": "gid://shopify/InventoryItem/30322695",
"from": {
"locationId": "gid://shopify/Location/124656943",
"name": "available",
"ledgerDocumentUri": null
},
"to": {
"locationId": "gid://shopify/Location/124656943",
"name": "reserved",
"ledgerDocumentUri": "logistics://toronto.warehouse/work-orders/2023-01-04/2"
}
}
]
},
"quantityNames": [
"committed",
"reserved",
"safety_stock",
"quality_control",
"damaged",
"available",
"on_hand",
"incoming"
]
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) {
inventoryMoveQuantities(input: $input) {
userErrors {
field
message
code
}
inventoryAdjustmentGroup {
createdAt
reason
referenceDocumentUri
changes(quantityNames: $quantityNames) {
name
delta
}
}
}
}`,
"variables": {
"input": {
"reason": "damaged",
"referenceDocumentUri": "logistics://some.warehouse/take/2023-01-23T13:14:15Z",
"changes": [
{
"quantity": 10,
"inventoryItemId": "gid://shopify/InventoryItem/30322695",
"from": {
"locationId": "gid://shopify/Location/124656943",
"name": "available",
"ledgerDocumentUri": null
},
"to": {
"locationId": "gid://shopify/Location/124656943",
"name": "reserved",
"ledgerDocumentUri": "logistics://toronto.warehouse/work-orders/2023-01-04/2"
}
}
]
},
"quantityNames": [
"committed",
"reserved",
"safety_stock",
"quality_control",
"damaged",
"available",
"on_hand",
"incoming"
]
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) {
inventoryMoveQuantities(input: $input) {
userErrors {
field
message
code
}
inventoryAdjustmentGroup {
createdAt
reason
referenceDocumentUri
changes(quantityNames: $quantityNames) {
name
delta
}
}
}
}
QUERY
variables = {
"input": {
"reason": "damaged",
"referenceDocumentUri": "logistics://some.warehouse/take/2023-01-23T13:14:15Z",
"changes": [{"quantity"=>10, "inventoryItemId"=>"gid://shopify/InventoryItem/30322695", "from"=>{"locationId"=>"gid://shopify/Location/124656943", "name"=>"available", "ledgerDocumentUri"=>nil}, "to"=>{"locationId"=>"gid://shopify/Location/124656943", "name"=>"reserved", "ledgerDocumentUri"=>"logistics://toronto.warehouse/work-orders/2023-01-04/2"}}]
},
"quantityNames": ["committed", "reserved", "safety_stock", "quality_control", "damaged", "available", "on_hand", "incoming"]
}
response = client.query(query: query, variables: variables)