Catalogue and stock
Create products, keep stock and prices in sync, and avoid overwriting stock after an order.
Scopes: catalog:read to read, catalog:write to create and edit products and variants,
inventory:write for stock and prices.
Reference data
A product needs a subcategory and a brand, and its attributes must match the subcategory:
| Endpoint | Returns |
|---|---|
GET /reference/categories | Every category and subcategory you can list products in. A product needs a subcategoryId. |
GET /reference/subcategories/{subcategoryId}/attributes | The attributes a product in this subcategory can have, which are required, and their allowed values. |
GET /brands | Your brands. Brands are added and verified in the seller portal. A product needs a brandId. |
Creating products
POST /products creates a product with its variants (up to 50). It needs an
Idempotency-Key.
Every new product waits for review. It is created with status: "pending_review" and goes on
sale only after Bhakti Baazar approves it and it is published. Admins review API products in the same
way as products made in the portal. Subscribe to the
product.review_status.changed event to hear when that happens.
Before anything is saved, the API checks:
- Attributes, against the subcategory's list: each name must exist at the right level (product or variant), values must fit their type and options, and required attributes must be present. A conditional attribute is required only when its condition holds.
- Price against MRP: the price may not be above the MRP.
- Order quantity limits, one default variant, and no SKU repeated in the request.
- Your SKUs and product codes:
sellerSkuandsellerProductCodemust be unique in your account, ignoring letter case and surrounding spaces.
All the problems found are listed in one 400 VALIDATION_FAILED response, in details.
Images
Send images as public https:// URLs (JPEG, PNG or WebP, up to 10 MB each). We download each one
and copy it to our CDN during the request:
- If any URL cannot be used, the whole request fails with
422 IMAGE_FETCH_FAILED, onedetailsentry per URL, and nothing is saved. - A product with many images takes longer to create. Each download can take up to 15 seconds, four at a time. Allow for this in your client's timeout.
- Up to 10 images per product (a thumbnail and up to 9 gallery images) and 6 per variant.
Product status
status | Meaning |
|---|---|
pending_review | Not approved by Bhakti Baazar, so not on sale. New products start here. An admin can also switch an approved product off, which shows the same status. |
live | Approved and published. |
unpublished | Approved, but you have hidden it. |
deleted | Only returned with include_deleted=true or status=deleted. |
Editing products and variants
PATCH /products/{productId}changes only the fields you send. Sendingattributesreplaces all of the product's attributes, so send the full list.POST /products/{productId}/variantsadds a variant (needs anIdempotency-Key).PATCH /variants/{variantId}changes a variant's price, MRP, attributes, images and other fields.- Category and brand cannot be changed through the API. Change them in the seller portal.
- As in the portal, editing an approved product does not send it back for review. The change goes live at once.
- A product's
isPublishedis applied through its default variant, as the portal's switch does. Publishing the default variant publishes the whole product. - If publishing is refused (for example, the subcategory needs a size chart that is missing), the request fails, but content changes in the same request may already be saved. Sending the same request again is safe.
Stock
PUT /inventory sets the stock of up to 100 variants. Name each variant by variantId or by your
sellerSku.
{
"items": [
{ "sellerSku": "RUD-5-6MM", "stock": 25, "expectedStock": 27 },
{ "variantId": "0b6f…", "stock": 0 }
]
}- Stock is an absolute number. There is no "add" or "subtract".
stockis the new total. - Each line succeeds or fails on its own. The response is
200even when some lines fail, so checkstatuson every line:updated,unchangedorfailed, with anerror.codewhen it failed. PATCH /variantsdoes not takestock.PUT /inventoryis the only way to set it.
Line error.code | Meaning |
|---|---|
NOT_FOUND | No live variant of yours matches. |
AMBIGUOUS_SELLER_SKU | More than one of your variants has this SKU. Use variantId. |
DUPLICATE_LINE | An earlier line in this request already changes this variant. |
STALE_STOCK | expectedStock did not match. currentStock says what we have. |
STOCK_MANAGED_EXTERNALLY | Your stock is managed by a connected channel (Unicommerce), so only that connection can change it. Prices can still be changed. |
VALIDATION_FAILED | The value breaks a rule. |
INTERNAL_ERROR | This line could not be saved. Retry it. |
A request with a malformed line, or more than 100 lines, is refused whole before any line runs.
The oversell window
Stock is reduced the moment an order is confirmed. If your system counts its stock, then sends that number after an order came in, it overwrites our reduced number and the item can be sold twice.
Two things close that gap:
- Send
expectedStock: the stock you last read from us. If ours has changed since (because an order came in), the line fails withSTALE_STOCK, nothing changes, andcurrentStocktells you our number. Re-read, adjust, and send again. - Subscribe to
order.createdand subtract each order from your own stock as it arrives, so your count already includes our orders.
Prices
PUT /prices sets the selling price (GST included) and MRP of up to 100 variants, in rupees. The MRP must be at least the price.
The discount shoppers see is worked out from them. Lines succeed or fail on their own, as with stock.
Sync
To keep your copy of the catalogue up to date, page through GET /products with updated_since.
See Idempotency and paging.
GET /products also filters by:
status:live,unpublished,pending_reviewordeleted.liveis what shoppers can buy.sku: one SKU, or up to 50 separated by commas. Each matches our SKU, or your SKU ignoring letter case and surrounding spaces. A product comes back if any of its variants matches.
GET /products/count counts the products a status filter would list, with their variants and
publishedVariants (the variants you have published). Deleted products are never counted, so
status=deleted counts nothing.
GET /products/by-code/{sellerProductCode} finds one product by your own product code, ignoring
letter case and surrounding spaces.