Enable tracking

Tracking of products must be enabled in order to manage inventory balances. You can start tracking for a single product. You can also start tracking and set the initial inventory balance in one call as described in the following.

Prerequisites

  • Authorization setup with the correct scope, and a valid authorization token. See How inventories work.
  • Required access right: WRITE:PRODUCT
  • The product UUID for the product that should be tracked. See Fetch products.

Enable tracking of products

Starts the tracking of products in an inventory. Lists existing inventory balances for a product, for example if it has been tracked in the past.

The request always returns balances for the location type STORE. The response will contain product variants with non-zero inventory balances, and the UUID of the location where the product is tracked.

Use this request to start product tracking for a given product UUID. The UUID of the product is passed in the request body.

1
POST /organizations/self/inventory

Example: Enabling of tracking and retrieval of balance for variants of the product with UUID d42260ae-423d-11ec-95a4-10307542d8a2.

Request body

1
POST /organizations/self/inventory
2
Authorization: Bearer eyJraWQiOiIxNjM3MTg1Mjg0Nz...
3
Content-Type: application/json
4
5
{
6
"productUuid": "d42260ae-423d-11ec-95a4-10307542d8a2"
7
}

Response

1
{
2
"locationUuid": "fd4a39a0-e2ef-11e6-ba64-85247ae2a737",
3
"variants": []
4
}

If the response has a 2XX status code indicating success, then tracking has been enabled for the product.

The response body will contain an overview of the current inventory stock levels for the product in the STORE location. For a new product, this overview is usually empty.

Enable tracking using the bulk endpoint

An alternative way to enable tracking for products is through the bulk API endpoint. Using this endpoint you can also include balance updates. This allows you to start the tracking and update the stock levels within a single request.

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

You can also update multiple products in a single request through the bulk endpoint. In the request body, list the product UUIDs that you want to modify, and set the trackingStatusChange to "START_TRACKING".

Example: This example enables inventory tracking for a single product. This example request does not contain simultaneous stock level updates.

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

Request

1
POST /organizations/self/v2/inventory/bulk
2
Authorization: Bearer eyJraWQiOiIxNjM3MTg1Mjg0Nz...
3
Content-Type: application/json
4
5
{
6
"returnBalanceForLocationUuid": "61f6bfae-092f-11eb-8018-0bf432cc48c7",
7
"productChanges": [
8
{
9
"productUuid": "8d772d4a-111d-11ea-9ee7-141cd50f3f99",
10
"trackingStatusChange": "START_TRACKING"
11
}
12
]
13
}

Response

1
{
2
"locationUuid": "61f6bfae-092f-11eb-8018-0bf432cc48c7",
3
"variants": []
4
}

If the response has a 2XX status code indicating success, then tracking has been enabled for the product.

The response body will contain the modified inventory stock levels for the location given in the request body. This response will only contain the products and variants for which stock levels were affected by the request. If the request only contained tracking status changes, and no stock level updates, no stock levels will be reported back.