Retrieve inventory data for locations

To retrieve inventory at specific locations, you use the getInventory endpoint with the locationIds query parameter.

The locationIds query parameter allows you to specify one or more location IDs as a comma-separated list. For example:

GET /ccadmin/v1/inventories/xsku5014?locationIds=Warehouse13,Warehouse11 HTTP/1.1
Authorization: Bearer <access_token>

The response includes a locationInventoryInfo array in which each entry is the inventory for one of the locations specified in the URL. For example:

{
    "locationInventoryInfo": [
        {
            "preorderThreshold": 0,
            "stockThreshold": 20,
            "availabilityStatus": 1000,
            "backorderThreshold": 0,
            "availabilityStatusMsg": "inStock",
            "backorderLevel": 0,
            "locationId": "Warehouse13",
            "preorderLevel": 0,
            "skuNumber": null,
            "availableToPromise": null,
            "translations": null,
            "availabilityDate": null,
            "inventoryId": null,
            "displayName": null,
            "stockLevel": 200
        },
        {
            "preorderThreshold": 0,
            "stockThreshold": 5,
            "availabilityStatus": 1000,
            "backorderThreshold": 0,
            "availabilityStatusMsg": "inStock",
            "backorderLevel": 0,
            "locationId": "Warehouse11",
            "preorderLevel": 0,
            "skuNumber": null,
            "availableToPromise": null,
            "translations": null,
            "availabilityDate": null,
            "inventoryId": null,
            "displayName": null,
            "stockLevel": 22
        }
    ],
    "links": [
        {
       "rel": "self",
       "href": "https://myserver.example.com:7002/ccadmin/v1/inventories/xsku5014?
         locationIds=Warehouse13,Warehouse11"
        }
    ],
    "skuNumber": "xsku5014",
    "skuId": "xsku5014",
    "displayName": "Titanium Analog Watch"
}

You can include inventory for the default inventory location as well by setting the includeDefaultLocationInventory query parameter to true. For example, the following call returns inventory for the default location as well as the Warehouse13 location:

GET /ccadmin/v1/inventories/xsku5014?
  locationIds=Warehouse13&includeDefaultLocationInventory=true HTTP/1.1
Authorization: Bearer <access_token>

Note that if you do not use the locationIds parameter to specify a non-default location, inventory for the default location is returned. This is the case even if you do not set includeDefaultLocationInventory to true. If you do use locationIds, however, inventory for the default location is omitted unless you explicitly set includeDefaultLocationInventory to true.

Set an inventory record for a SKU using the location’s locationId. For example:

POST /ccadmin/v1/inventories/ HTTP/1.1
Authorization: Bearer <access_token>

// IN STOCK

{
  "id": "Sku_13D",
  "locationId": "Warehouse13",
  "type": "variant",
  "stockThreshold": 5,
  "stockLevel": 3000,
  "availabilityDate": null,
  "preorderLevel": 0,
  "preorderThreshold": 0,
  "backorderLevel": 0,
  "backorderThreshold": 0
}

// OUT OF STOCK

{
  "id": "Sku_15DE",
  "locationId": "Warehouse13",
  "type": "variant",
  "stockThreshold": 5,
  "stockLevel": 1,
  "availabilityDate": null,
  "preorderLevel": 0,
  "preorderThreshold": 0,
  "backorderLevel": 0,
  "backorderThreshold": 0
}