Skip to Content
Bhakti BaazarDevelopers

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:

EndpointReturns
GET /reference/categoriesEvery category and subcategory you can list products in. A product needs a subcategoryId.
GET /reference/subcategories/{subcategoryId}/attributesThe attributes a product in this subcategory can have, which are required, and their allowed values.
GET /brandsYour 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: sellerSku and sellerProductCode must 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, one details entry 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

statusMeaning
pending_reviewNot 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.
liveApproved and published.
unpublishedApproved, but you have hidden it.
deletedOnly returned with include_deleted=true or status=deleted.

Editing products and variants

  • PATCH /products/{productId} changes only the fields you send. Sending attributes replaces all of the product's attributes, so send the full list.
  • POST /products/{productId}/variants adds a variant (needs an Idempotency-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 isPublished is 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". stock is the new total.
  • Each line succeeds or fails on its own. The response is 200 even when some lines fail, so check status on every line: updated, unchanged or failed, with an error.code when it failed.
  • PATCH /variants does not take stock. PUT /inventory is the only way to set it.
Line error.codeMeaning
NOT_FOUNDNo live variant of yours matches.
AMBIGUOUS_SELLER_SKUMore than one of your variants has this SKU. Use variantId.
DUPLICATE_LINEAn earlier line in this request already changes this variant.
STALE_STOCKexpectedStock did not match. currentStock says what we have.
STOCK_MANAGED_EXTERNALLYYour stock is managed by a connected channel (Unicommerce), so only that connection can change it. Prices can still be changed.
VALIDATION_FAILEDThe value breaks a rule.
INTERNAL_ERRORThis 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:

  1. Send expectedStock: the stock you last read from us. If ours has changed since (because an order came in), the line fails with STALE_STOCK, nothing changes, and currentStock tells you our number. Re-read, adjust, and send again.
  2. Subscribe to order.created and 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_review or deleted. live is 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.

On this page