BigblueDevelopers

List allocation inventories

Get the stock allocated to each sales channel in a warehouse.

POST/bigblue.storeapi.v1.PublicAPI/ListAllocationInventories

With inventory allocation, you reserve part of a warehouse's stock for each sales channel, such as your website or a marketplace. This endpoint returns how much each channel can sell and how much stock isn't allocated.

warehouse is required.

Request body

warehousestringrequired
The warehouse to report on.
Pattern^[A-Za-z]{2}-[A-Za-z]{3}-[0-9]{3}$
page_sizeintegerdefault 1000
Rows per page.
Maximum 5,000
page_tokenstring
The next_page_token from the previous response.

Responses

200A page of allocation rows.
allocation_inventoriesAllocationInventory[]
One row per product or bundle in the warehouse.
next_page_tokenstring
Token for the next page. Missing on the last page.

AllocationInventory

warehousestring
Warehouse ID.
Pattern^[A-Za-z]{2}-[A-Za-z]{3}-[0-9]{3}$
productstring
Product or bundle ID.
Pattern^[A-Za-z0-9]{4}(BU)?-[A-Za-z0-9]{6}-[A-Za-z0-9]{4}$
product_skustring
Your SKU for the product. Empty for bundles.
Up to 40 characters
shop_inventory_location_quantitiesAllocationInventory.ShopInventoryLocationQuantity[]

One entry per sales channel.

remaining_available_quantityinteger

Available units not allocated to any channel. Can be negative.

ShopInventoryLocationQuantity

The sales channel.
available_quantityinteger
Units the channel can sell. Can be negative.

ShopInventoryLocation

shopstring
Bigblue shop ID, for example sh_1a2b3c4d.
Pattern^[a-z0-9]{1,2}_[A-Za-z0-9]{8}$
inventory_locationstring

The shop's own location ID, if the platform has one, such as a Shopify location.

Quantities can be negative

When an allocation group uses MIN mode and backorders exceed stock, available_quantity can be negative. Use Math.max(0, quantity) before sending it to a storefront.

400The warehouse is missing or invalid, or page_size is above 5000.
{
  "code": "invalid_argument",
  "msg": "warehouse value does not match regex pattern `^[[:alpha:]]{2}-[[:alpha:]]{3}-[[:digit:]]{3}$`",
  "meta": { "argument": "warehouse" }
}
POST/bigblue.storeapi.v1.PublicAPI/ListAllocationInventories
Request
{ "warehouse": "FR-CDG-001", "page_size": 1000 }
200
{
  "allocation_inventories": [
    {
      "warehouse": "FR-CDG-001",
      "product": "BGBL-ESPSRT-SMAL",
      "product_sku": "ESP-SHIRT-S",
      "shop_inventory_location_quantities": [
        {
          "inventory_location": { "shop": "sh_1a2b3c4d" },
          "available_quantity": 250
        },
        {
          "inventory_location": { "shop": "am_9f8e7d6c" },
          "available_quantity": 100
        }
      ],
      "remaining_available_quantity": 62
    }
  ]
}

Of 412 available units, 250 are allocated to the website, 100 to the marketplace, and 62 aren't allocated.

Get one channel's stock
const SHOP = 'sh_1a2b3c4d';
const levels = new Map<string, number>();

let pageToken = '';
do {
  const page = await call('ListAllocationInventories', {
    warehouse: 'FR-CDG-001',
    page_size: 5000,
    page_token: pageToken,
  });
  for (const row of page.allocation_inventories ?? []) {
    const mine = row.shop_inventory_location_quantities?.find(
      (q) => q.inventory_location?.shop === SHOP,
    );
    levels.set(row.product, Math.max(0, mine?.available_quantity ?? 0));
  }
  pageToken = page.next_page_token ?? '';
} while (pageToken);