Skip to content
View as Markdown

Recipe: stock and prices ​

Moving the product cards is the catalog sync recipe. This page is the next step: reading stock and prices correctly and not letting them go stale in your catalog.

Permissions needed: price, product_stock, warehouse.

1. Pick the warehouses and price list ​

http
GET /organization/get-all
json
POST /warehouse/get-all

{ "organization_id": "6712f0a9c4d1e87b3a0f9911", "status": "active" }
http
GET /price/get-all?type=sale

Keep in your settings which warehouses the storefront sells from and which price list it shows. A price list's currency is its currency_id.

2. Read stock ​

json
POST /product-warehouse/get-paging

{ "page": 1, "limit": 200, "organization_id": "6712f0a9c4d1e87b3a0f9911" }

page and limit are required, limit up to 200. Page until page * limit >= data.total. Each row is a product × warehouse:

json
{
    "_id": "6712f0a9c4d1e87b3a0f9944",
    "product_id": "6712f0a9c4d1e87b3a0f9933",
    "warehouse_id": "6712f0a9c4d1e87b3a0f9955",
    "organization_id": "6712f0a9c4d1e87b3a0f9911",
    "amount": 12,
    "booked": 2,
    "in_transit": 0,
    "on_the_way": 50,
    "in_trash": 1,
    "updated_at": "2026-11-05T09:12:00.000Z"
}
FieldMeaning
amountAvailable to sell. This is what your storefront shows
bookedReserved
in_transitIn a transfer: left the sending warehouse, not yet received
on_the_wayPurchased, not yet received into stock
in_trashWritten off as defective

amount includes none of the other four — neither add nor subtract them. Filters: organization_id, product_ids (up to 500), updated_at. There is no warehouse filter — pick your warehouse_ids on your side. When there is no row for a product × warehouse, treat its stock as 0.

Two other sources are not for this job: organizations[].amount in product/get-paging is a summary refreshed in the background, and product-stock holds batch-level rows.

3. Read prices ​

json
POST /price/items/get-paging

{ "page": 1, "limit": 200, "organization_id": "6712f0a9c4d1e87b3a0f9911", "price_id": "6712f0a9c4d1e87b3a0f9966" }

Send both organization_id and price_id — otherwise rows of other organizations or price lists are mixed into the response. Extra filters: product_id, search (name, SKU, barcode).

json
{
    "_id": "6712f0a9c4d1e87b3a0f9977",
    "price_id": "6712f0a9c4d1e87b3a0f9966",
    "product": { "_id": "6712f0a9c4d1e87b3a0f9933", "name": "Espresso" },
    "amount": 45000,
    "min_price": 40000,
    "max_price": 50000
}

Here amount is the price, not stock. A product missing from the list has no price set in that price list.

4. Keep the external catalog in step ​

WhatHowHow often
Stock, incrementalproduct-warehouse/get-paging + updated_atEvery 5–15 minutes
Stock, fullThe same method unfiltered, replace your valuesOnce a day
PricesAll of price/items/get-paging: there is no updated_at filterOn a schedule
  • For updated_at, store the time you started paging, not the time you finished: rows that changed while you were reading then come again next time.
  • Upsert rows by product_id + warehouse_id: receiving a row twice changes nothing.
  • Do not track price changes with the updated_at filter of product/get-paging: it filters the product record, and prices live in separate records.

5. Webhooks ​

  • There is no event for stock (product-warehouse) — poll it.
  • productPrices.create, productPrices.update and productPrices.delete say a price row changed. The id in the message is the _id of a price/items/get-paging row, not a product id. So keep an _id → product._id map; when an unknown id arrives, re-read the list.

Webhook delivery is not guaranteed and bulk operations send none (webhooks) — you still need a scheduled full reconcile. An app that declares required_permissions cannot call the webhook/* methods — it can only poll.

Errors ​

ResponseCause
400 validationpage or limit is missing, an id is wrong, or limit is above 200 on product-warehouse
403, code: 10003One of the permissions was not approved; data names it

Methods ​

StepMethod
OrganizationGET /organization/get-all
WarehousesPOST /warehouse/get-all
Price listsGET /price/get-all
StockPOST /product-warehouse/get-paging
PricesPOST /price/items/get-paging

Bito 2.0 Integration API