Update inventory balance

To update inventory balance, you move stock of product variants from a type of inventory to another.
For example, when 5 small size white t-shirts are sold, you move 5 of the product from the STORE inventory to the SOLD inventory. Then the inventory balance of the small size white t-shirt is updated.

Prerequisites

  • Make sure that authorisation is set up with the following OAuth scope using OAuth API:
    • WRITE:PRODUCT
  • The "from" and "to" UUIDs for the inventories involved in the movement. See Fetch inventories.
  • The product UUID for a specific product. See Fetch products.
  • The variant UUID for which to update the balance. See Fetch products.

Update inventory balance

Use the following request to update the inventory balance for an organization. The response will only have status 204 No Content.
1
POST /movements
1
{
2
"movements": [
3
{
4
"productUuid": "{{product_uuid}}",
5
"variantUuid": "{{product_variant_uuid}}",
6
"change": {{number}},
7
"from": "{{store_inventory_uuid}}",
8
"to": "{{sold_inventory_uuid}}"
9
}
10
]
11
}
Example: The following example updates the inventory balance for product variants of the product with UUID 65314d7e-5f0f-11ec-bf63-0242ac130002. The variant UUIDs are 78194842-5f0f-11ec-bf63-0242ac130002and 7c6be742-5f0f-11ec-bf63-0242ac130002, from inventory UUID 89ac1e4a-5f0f-11ec-bf63-0242ac130002 to inventory 92646e02-5f0f-11ec-bf63-0242ac130002, with values 42and 1337.
Request
1
POST /movements
Request body
1
{
2
"movements": [
3
{
4
"productUuid": "65314d7e-5f0f-11ec-bf63-0242ac130002",
5
"variantUuid": "78194842-5f0f-11ec-bf63-0242ac130002",
6
"change": 42,
7
"from": "89ac1e4a-5f0f-11ec-bf63-0242ac130002",
8
"to": "92646e02-5f0f-11ec-bf63-0242ac130002"
9
},
10
{
11
"productUuid": "65314d7e-5f0f-11ec-bf63-0242ac130002",
12
"variantUuid": "7c6be742-5f0f-11ec-bf63-0242ac130002",
13
"change": 1337,
14
"from": "89ac1e4a-5f0f-11ec-bf63-0242ac130002",
15
"to": "92646e02-5f0f-11ec-bf63-0242ac130002"
16
}
17
]
18
}