Update inventory balance

There are several calls available to update the inventory balance of a variant. The general term for balance updates are "movements". Each movement has product/variant UUIDs, a "from" location, a "to" location, and the number of items that should be moved.

Prerequisites

Update inventory balance

Use the following request to update the inventory balance for an organization.

1
PUT /organizations/self/inventory
1
{
2
"changes": [
3
{
4
"productUuid": <UUID>,
5
"variantUuid": <UUID>,
6
"fromLocationUuid": <UUID>,
7
"toLocationUuid": <UUID>,
8
"change": <NUMBER>
9
}
10
],
11
"returnBalanceForLocationUuid": <UUID>,
12
"externalUuid": <UUID>
13
}

Example: Updating the balance for product UUID 65314d7e-5f0f-11ec-bf63-0242ac130002, variant UUIDs 78194842-5f0f-11ec-bf63-0242ac130002and 7c6be742-5f0f-11ec-bf63-0242ac130002, from location UUID 89ac1e4a-5f0f-11ec-bf63-0242ac130002 to location 92646e02-5f0f-11ec-bf63-0242ac130002, with values 42and 1337.

The response will return the balances for the STORE location since we are not providing any value for returnBalanceForLocationUuid.

Request

1
PUT /organizations/self/inventory

Request body

1
{
2
"changes": [
3
{
4
"productUuid": "65314d7e-5f0f-11ec-bf63-0242ac130002",
5
"variantUuid": "78194842-5f0f-11ec-bf63-0242ac130002",
6
"fromLocationUuid": "89ac1e4a-5f0f-11ec-bf63-0242ac130002",
7
"toLocationUuid": "92646e02-5f0f-11ec-bf63-0242ac130002",
8
"change": 42
9
},
10
{
11
"productUuid": "65314d7e-5f0f-11ec-bf63-0242ac130002",
12
"variantUuid": "7c6be742-5f0f-11ec-bf63-0242ac130002",
13
"fromLocationUuid": "89ac1e4a-5f0f-11ec-bf63-0242ac130002",
14
"toLocationUuid": "92646e02-5f0f-11ec-bf63-0242ac130002",
15
"change": 1337
16
}
17
]
18
}

Response

1
{
2
"locationUuid": "89ac1e4a-5f0f-11ec-bf63-0242ac130002",
3
"variants": [
4
{
5
"locationUuid": "89ac1e4a-5f0f-11ec-bf63-0242ac130002",
6
"locationType": "STORE",
7
"productUuid": "65314d7e-5f0f-11ec-bf63-0242ac130002",
8
"variantUuid": "78194842-5f0f-11ec-bf63-0242ac130002",
9
"balance": 196
10
},
11
{
12
"locationUuid": "89ac1e4a-5f0f-11ec-bf63-0242ac130002",
13
"locationType": "STORE",
14
"productUuid": "65314d7e-5f0f-11ec-bf63-0242ac130002",
15
"variantUuid": "7c6be742-5f0f-11ec-bf63-0242ac130002",
16
"balance": 10696
17
}
18
]
19
}

Update balances using the bulk endpoint

An alternative way to update balances is through the bulk API endpoint. Using this endpoint you can both start tracking and update the stock levels within a single request. You can also do this for multiple products at the same time.

Example: Updating the balance for two variants.

1
POST /organizations/self/v2/inventory/bulk

Request body

1
{
2
"returnBalanceForLocationUuid": "89ac1e4a-5f0f-11ec-bf63-0242ac130002",
3
"productChanges": [
4
{
5
"productUuid": "3cc3b9f6-623b-11ec-90d6-0242ac120003",
6
"trackingStatusChange": "START_TRACKING",
7
"variantChanges": [
8
{
9
"variantUuid": "4066f6cc-623b-11ec-90d6-0242ac120003",
10
"fromLocationUuid": "89ac1e4a-5f0f-11ec-bf63-0242ac130002",
11
"toLocationUuid": "92646e02-5f0f-11ec-bf63-0242ac130002",
12
"change": 42
13
},
14
{
15
"variantUuid": "45900c4c-623b-11ec-90d6-0242ac120003",
16
"fromLocationUuid": "89ac1e4a-5f0f-11ec-bf63-0242ac130002",
17
"toLocationUuid": "92646e02-5f0f-11ec-bf63-0242ac130002",
18
"change": 1337
19
}
20
]
21
}
22
]
23
}

Response

1
{
2
"locationUuid": "89ac1e4a-5f0f-11ec-bf63-0242ac130002",
3
"variants": [
4
{
5
"productUuid": "3cc3b9f6-623b-11ec-90d6-0242ac120003",
6
"variantUuid": "89ac1e4a-5f0f-11ec-bf63-0242ac130002",
7
"balance": 196
8
},
9
{
10
"productUuid": "3cc3b9f6-623b-11ec-90d6-0242ac120003",
11
"variantUuid": "45900c4c-623b-11ec-90d6-0242ac120003",
12
"balance": 10696
13
}
14
]
15
}