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.

Note: Every product and product variant must have a unique UUID.

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 both start tracking and update the stock levels one or more products within a single request. For information about updating the stock levels using the bulk endpoint, see Update balances using the bulk endpoint.

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

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.

Depending on the request body, the response returns one of the following:

  • If the request only contained tracking status changes and no stock level updates, no stock levels will be returned.
  • If the request only modifies stock level of a variant, the new stock level for the specified variant will be returned.
  • If the request modifies stock level of a variant and changes the tracking status, the new tracking status and stock level for the specified variant will be returned.