Stock
A lightweight stock feed for keeping the shop's stock levels current. Needs the stock:read scope.
GET /stock
Returns the sellable stock of the same stock products as GET /products (sold and not archived), or of the SKUs you list.
| Query | Description |
|---|---|
skus | Comma-separated SKUs, max 500 (e.g. skus=P1,P2). Without it: all active stock products |
include_inactive | true = also archived products and stock items that are not sold (e.g. raw materials). Partner keys never see not-sold items |
page, limit | Page from 1; limit default 500, max 500 |
bash
curl "https://zerpy.app/api/v1/stock?skus=P1,P2" \
-H "Authorization: Bearer $ZERPY_API_KEY"json
{
"data": [
{ "sku": "P1", "available": "6", "on_hand": "10" },
{ "sku": "P2", "available": "0", "on_hand": "1" }
],
"page": 1, "limit": 500, "total": 2, "has_more": false
}- Only products of type
stock; services never appear. By default only sold, not archived products — the same set asGET /products. - Unknown SKUs in
skusare simply missing from the result. - Results are sorted by SKU.
With a partner feed key the shape is { "sku", "available", "on_hand": null, "consignment" } and only products that are sold are listed.
How sellable stock is calculated
ZERPY keeps stock as a ledger of movements; the numbers below are calculated at the moment you ask.
| Field | Meaning |
|---|---|
on_hand | Physical stock in the company's own warehouses |
available | on_hand − reserved, never below 0 |
- Own warehouses only. Stock that the company holds at a partner (consignment warehouses) is not sellable online and is not counted.
- Reserved = the open quantity of confirmed and partially shipped sales orders (including other webshop orders), plus components needed by planned and in-progress production orders that have not been issued yet.
- If more is reserved than on hand, the real balance is negative (a backorder) but
availableis shown as"0". - Draft orders do not reserve anything.
The same numbers appear in stock on the product object and in the stock.changed webhook.
Keeping the shop in sync
Two ways — use one, or both (webhooks for speed, a periodic poll as a safety net):
- Webhook
stock.changed— sent a few seconds after stock moves or reservations change (order confirmed or cancelled, production planned, …). It carries{ "items": [{ "sku", "available", "on_hand" }] }for the affected products. See Webhooks. - Polling
GET /stock— one call returns up to 500 products, light enough to run every few minutes.
TIP
GET /products?updated_since=… does not report stock changes — stock does not change a product's updated_at.