Skip to content

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.

QueryDescription
skusComma-separated SKUs, max 500 (e.g. skus=P1,P2). Without it: all active stock products
include_inactivetrue = also archived products and stock items that are not sold (e.g. raw materials). Partner keys never see not-sold items
page, limitPage 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 as GET /products.
  • Unknown SKUs in skus are 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.

FieldMeaning
on_handPhysical stock in the company's own warehouses
availableon_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 available is 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):

  1. 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.
  2. 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.