Inventory
Get stock levels
Section titled “Get stock levels”GET/inventory
How much of each product, and of each of its variants, the store your website sells from holds:
your first open store, named in store. That’s where a website order takes its stock, so these are
the quantities an order can have. Exact counts are competitive information, so only a secret key
reads them, from your server. The catalogue shows browsers inStock and stockLevel instead.
| Query | Meaning |
|---|---|
productIds |
Required. Up to 50 product ids, separated by commas. |
Unlike the catalogue, this covers every active product, shown on your website or not. An id that isn’t one of your active products is left out of the answer.
curl "https://api.sabiwave.com/api/v1/public/inventory?productIds=01a2160c-6b00-7627-af42-d534badeaea4" \ -H "Authorization: Bearer $SABIWAVE_SECRET_KEY"const res = await fetch('https://api.sabiwave.com/api/v1/public/inventory?productIds=01a2160c-6b00-7627-af42-d534badeaea4', { headers: { Authorization: `Bearer ${process.env.SABIWAVE_SECRET_KEY}`, },});const result = await res.json();{ "success": true, "data": { "store": { "id": "01a21564-0fa5-73bd-b689-d7a0a4173117", "name": "Main store" }, "levels": [ { "productId": "01a2160c-6b00-7627-af42-d534badeaea4", "quantity": 4, "variants": [] } ] }}| Field | Meaning |
|---|---|
store |
{ id, name }: the store counted. null when no store is open, and then every quantity is 0. |
levels |
One for each product found: |
levels[].productId |
The product. |
levels[].quantity |
How many that store holds, never below zero. A combo holds the whole sets its contents make there; a service, never counted, is null. |
levels[].variants |
Each { variantId, quantity }, the same for each variant. |
A publishable key is refused with 403 SCOPE_MISSING.