List allocation inventories
Get the stock allocated to each sales channel in a warehouse.
/ bigblue.storeapi.v1.PublicAPI/ ListAllocationInventoriesWith 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^[A-Za-z]{2}-[A-Za-z]{3}-[0-9]{3}$page_sizeintegerdefault 1000page_tokenstringnext_page_token from the previous response.Responses
allocation_inventoriesAllocationInventory[]next_page_tokenstringAllocationInventory
warehousestring^[A-Za-z]{2}-[A-Za-z]{3}-[0-9]{3}$productstring^[A-Za-z0-9]{4}(BU)?-[A-Za-z0-9]{6}-[A-Za-z0-9]{4}$product_skustringshop_inventory_location_quantitiesAllocationInventory.ShopInventoryLocationQuantity[]One entry per sales channel.
remaining_available_quantityintegerAvailable units not allocated to any channel. Can be negative.
ShopInventoryLocationQuantity
inventory_locationAllocationInventory.ShopInventoryLocationavailable_quantityintegerShopInventoryLocation
shopstringsh_1a2b3c4d.^[a-z0-9]{1,2}_[A-Za-z0-9]{8}$inventory_locationstringThe 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.
{
"code": "invalid_argument",
"msg": "warehouse value does not match regex pattern `^[[:alpha:]]{2}-[[:alpha:]]{3}-[[:digit:]]{3}$`",
"meta": { "argument": "warehouse" }
}/ bigblue.storeapi.v1.PublicAPI/ ListAllocationInventories{ "warehouse": "FR-CDG-001", "page_size": 1000 }{
"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.
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);