B2B Second Inventory Catalog API Reference
Endpoint reference for the bb phase 2 admin catalog API — categories, brands, series, tags, products, variants, options, bulk actions and import/export jobs — with contracts and error codes.
B2B Second Inventory (bb) — Catalog API Reference
Audience: Admin engineers integrating with the bb phase 2 backend. Phase 2 has no storefront or public endpoint.
All endpoints are prefixed with /api, need a JWT, and need the listed permission. Superadmin passes every permission check.
Throttles per IP: reads ADMIN_READ (30 per 60 s), writes ADMIN_WRITE (10 per 60 s), bulk delete, restore and active ADMIN_BULK_WRITE (5 per 60 s), reorder ADMIN_REORDER (30 per 60 s).
Each POST that creates a record requires an Idempotency-Key header; without it the response is 400 IDEMPOTENCY_KEY_REQUIRED.
Every route below is mounted by BbAdminAggregateModule, and the bb_catalog worker that runs import and export jobs is registered by BbModule.
Route Surfaces
| Surface | Base Path | Auth |
|---|---|---|
| Categories | /api/admin/bb/categories | JWT + BB_Categories_* |
| Brands | /api/admin/bb/brands | JWT + BB_Brands_* |
| Brand series | /api/admin/bb/brand-series | JWT + BB_BrandSeries_* |
| Tags | /api/admin/bb/tags | JWT + BB_Tags_* |
| Products | /api/admin/bb/products | JWT + BB_Products_* |
| Variants | /api/admin/bb/products/:productPublicId/variants | JWT + BB_Products_* |
| Options | /api/admin/bb/products/:productPublicId/options | JWT + BB_Products_* |
| Jobs | /api/admin/bb/jobs/{categories,brands,brand-series,products} | JWT + BB_Catalog_* plus the entity code |
Every :publicId is a UUID. Every response uses the ResponseDto envelope.
{
"message": "Bb brand fetched successfully",
"errorCode": null,
"data": { }
}A paginated list adds count, currentPage and totalPage beside data.
Endpoint Reference
Categories
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/admin/bb/categories | BB_Categories_READ | Paginated live list. Query: page, size (max 100), sort (displayOrder, name, updatedAt), order, search (max 100), parentPublicId, rootOnly. rootOnly with parentPublicId is 400 VALIDATION_FAILED |
| GET | /api/admin/bb/categories/tree | BB_Categories_READ | Whole live tree: { roots, truncated }, at most 5,000 rows |
| GET | /api/admin/bb/categories/deleted | BB_Categories_RESTORE | Paginated soft-deleted list, newest deletion first |
| GET | /api/admin/bb/categories/:publicId | BB_Categories_READ | One live category |
| POST | /api/admin/bb/categories | BB_Categories_CREATE | Create. Needs Idempotency-Key. Returns 201 { publicId } |
| PATCH | /api/admin/bb/categories/:publicId | BB_Categories_UPDATE | Update name, description, displayOrder, imageKey |
| PATCH | /api/admin/bb/categories/:publicId/move | BB_Categories_UPDATE | Move under a new parent, or to the root with null |
| DELETE | /api/admin/bb/categories/:publicId | BB_Categories_DELETE | Soft delete. Returns 200 |
| POST | /api/admin/bb/categories/:publicId/restore | BB_Categories_RESTORE | Restore. Returns 200 |
| POST | /api/admin/bb/categories/bulk/delete | BB_Categories_DELETE | Bulk soft delete, up to 100 ids. Returns 200 |
| POST | /api/admin/bb/categories/bulk/restore | BB_Categories_RESTORE | Bulk restore, up to 100 ids. Returns 200 |
| PATCH | /api/admin/bb/categories/reorder | BB_Categories_UPDATE | Set the order of one parent's whole live child set. Returns 200 |
Brands
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/admin/bb/brands | BB_Brands_READ | Paginated live list. Query: page, size, sort (displayOrder, name, updatedAt), order, search |
| GET | /api/admin/bb/brands/deleted | BB_Brands_RESTORE | Paginated soft-deleted list |
| GET | /api/admin/bb/brands/:publicId | BB_Brands_READ | One live brand |
| POST | /api/admin/bb/brands | BB_Brands_CREATE | Create. Needs Idempotency-Key. Returns 201 |
| PATCH | /api/admin/bb/brands/:publicId | BB_Brands_UPDATE | Update name, description, displayOrder, logoKey |
| DELETE | /api/admin/bb/brands/:publicId | BB_Brands_DELETE | Soft delete. Returns 200 |
| POST | /api/admin/bb/brands/:publicId/restore | BB_Brands_RESTORE | Restore. Returns 200 |
| POST | /api/admin/bb/brands/bulk/delete | BB_Brands_DELETE | Bulk soft delete |
| POST | /api/admin/bb/brands/bulk/restore | BB_Brands_RESTORE | Bulk restore |
| PATCH | /api/admin/bb/brands/reorder | BB_Brands_UPDATE | Reorder the whole live brand list |
Brand series
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/admin/bb/brand-series | BB_BrandSeries_READ | Paginated live list. Query: page, size, brandPublicId, sort, order, search |
| GET | /api/admin/bb/brand-series/deleted | BB_BrandSeries_RESTORE | Paginated soft-deleted list |
| GET | /api/admin/bb/brand-series/:publicId | BB_BrandSeries_READ | One live series |
| POST | /api/admin/bb/brand-series | BB_BrandSeries_CREATE | Create under a brand. Needs Idempotency-Key. Returns 201 |
| PATCH | /api/admin/bb/brand-series/:publicId | BB_BrandSeries_UPDATE | Update name, description, displayOrder. The brand cannot change |
| DELETE | /api/admin/bb/brand-series/:publicId | BB_BrandSeries_DELETE | Soft delete. Returns 200 |
| POST | /api/admin/bb/brand-series/:publicId/restore | BB_BrandSeries_RESTORE | Restore. Returns 200 |
| POST | /api/admin/bb/brand-series/bulk/delete | BB_BrandSeries_DELETE | Bulk soft delete |
| POST | /api/admin/bb/brand-series/bulk/restore | BB_BrandSeries_RESTORE | Bulk restore |
| PATCH | /api/admin/bb/brand-series/reorder | BB_BrandSeries_UPDATE | Reorder one brand's whole live series set |
Tags
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/admin/bb/tags | BB_Tags_READ | Paginated live list. Query: page, size, sort (name, updatedAt; default name), order, search |
| GET | /api/admin/bb/tags/deleted | BB_Tags_RESTORE | Paginated soft-deleted list |
| GET | /api/admin/bb/tags/:publicId | BB_Tags_READ | One live tag |
| POST | /api/admin/bb/tags | BB_Tags_CREATE | Create. Needs Idempotency-Key. Returns 201 |
| PATCH | /api/admin/bb/tags/:publicId | BB_Tags_UPDATE | Rename. name is required |
| DELETE | /api/admin/bb/tags/:publicId | BB_Tags_DELETE | Soft delete. Returns 200 |
| POST | /api/admin/bb/tags/:publicId/restore | BB_Tags_RESTORE | Restore. Returns 200 |
Tags have no bulk or reorder route.
Products
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/admin/bb/products | BB_Products_READ | Paginated live list. Query: page, size, search, categoryPublicId, includeSubcategories, brandPublicId, brandSeriesPublicId, tagPublicId, isActive, sort (updatedAt, createdAt, name; default updatedAt), order (default desc). includeSubcategories without categoryPublicId is 400 VALIDATION_FAILED |
| GET | /api/admin/bb/products/deleted | BB_Products_RESTORE | Paginated soft-deleted list |
| GET | /api/admin/bb/products/:publicId | BB_Products_READ | One live product with variants, options, tags and gallery. Takes no query keys |
| POST | /api/admin/bb/products | BB_Products_CREATE | Create a product with its variants. Needs Idempotency-Key. Returns 201 { publicId } |
| PATCH | /api/admin/bb/products/:publicId | BB_Products_UPDATE | Update; null clears a nullable field |
| PUT | /api/admin/bb/products/:publicId/tags | BB_Products_UPDATE | Replace the tag set |
| DELETE | /api/admin/bb/products/:publicId | BB_Products_DELETE | Soft delete. Optional query version |
| POST | /api/admin/bb/products/:publicId/restore | BB_Products_RESTORE | Restore. Returns 200 |
| POST | /api/admin/bb/products/bulk/delete | BB_Products_DELETE | Bulk soft delete |
| POST | /api/admin/bb/products/bulk/restore | BB_Products_RESTORE | Bulk restore |
| POST | /api/admin/bb/products/bulk/active | BB_Products_UPDATE | Bulk set isActive |
Variants
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/admin/bb/products/:productPublicId/variants | BB_Products_CREATE | Add a variant. Needs Idempotency-Key. Returns 201 |
| PATCH | /api/admin/bb/products/:productPublicId/variants/:publicId | BB_Products_UPDATE | Update. isDefault accepts only true |
| DELETE | /api/admin/bb/products/:productPublicId/variants/:publicId | BB_Products_DELETE | Soft delete. Optional query version |
Options
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/admin/bb/products/:productPublicId/options | BB_Products_READ | List axes with values and the current productVersion |
| POST | /api/admin/bb/products/:productPublicId/options | BB_Products_CREATE | Add an axis with 1 to 50 values. Needs Idempotency-Key and productVersion. Returns 201 |
| PATCH | /api/admin/bb/products/:productPublicId/options/:optionPublicId | BB_Products_UPDATE | Rename or reposition. Needs productVersion |
| DELETE | /api/admin/bb/products/:productPublicId/options/:optionPublicId | BB_Products_DELETE | Delete an axis. Needs query productVersion |
| POST | /api/admin/bb/products/:productPublicId/options/:optionPublicId/values | BB_Products_CREATE | Add a value. Needs Idempotency-Key and productVersion |
| PATCH | /api/admin/bb/products/:productPublicId/options/:optionPublicId/values/:valuePublicId | BB_Products_UPDATE | Update a value. Needs productVersion |
| DELETE | /api/admin/bb/products/:productPublicId/options/:optionPublicId/values/:valuePublicId | BB_Products_DELETE | Delete a value. Needs query productVersion |
Jobs
The same seven routes exist under each of /api/admin/bb/jobs/categories, /brands, /brand-series and /products. <E> below is the entity module: Categories, Brands, BrandSeries, Products.
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/admin/bb/jobs/<entity>/import | BB_Catalog_CREATE + BB_<E>_CREATE + BB_<E>_UPDATE | Submit an import. Multipart field file (.csv or .xlsx), header Idempotency-Key (required, max 200). Returns 201 { publicId } |
| POST | /api/admin/bb/jobs/<entity>/export | BB_Catalog_READ + BB_<E>_READ | Submit an export. Body { includeDeleted?, search? }. Needs Idempotency-Key. Returns 201 { publicId } |
| POST | /api/admin/bb/jobs/<entity>/:publicId/cancel | BB_Catalog_UPDATE + BB_<E>_UPDATE | Cancel a queued or processing job. Returns 200 with the job, including errors |
| GET | /api/admin/bb/jobs/<entity> | BB_Catalog_READ + BB_<E>_READ | Paginated job list, newest first. Query: page, size (max 100) |
| GET | /api/admin/bb/jobs/<entity>/import-template | BB_Catalog_READ + BB_<E>_READ | CSV with the header row only |
| GET | /api/admin/bb/jobs/<entity>/:publicId/result | BB_Catalog_READ + BB_<E>_READ | Download a completed export CSV |
| GET | /api/admin/bb/jobs/<entity>/:publicId | BB_Catalog_READ + BB_<E>_READ | One job, with errors |
A caller needs every listed code (import needs all three). A job created with includeDeleted: true also needs BB_<E>_RESTORE to be fetched by id or downloaded. The list route does not apply that check.
Job lists and reads are scoped to the entity in the path, not to the requester.
Import and export files
The rules for each column, the all-or-nothing behavior and the carriage-return limit are in the feature page. This section is the contract an integrator needs.
Import header. Download GET .../import-template and keep its header. The set of names must match exactly. Column order is free. deletedAt is the only extra name allowed, and it is ignored.
| Entity | Header |
|---|---|
| Category | publicId,name,parentPublicId,description,displayOrder |
| Brand | publicId,name,description,displayOrder |
| Brand series | publicId,brandPublicId,name,description,displayOrder |
| Product | sku,name,categoryPublicId,brandPublicId,brandSeriesPublicId,mrpPaisa,sellingPricePaisa,description,isActive |
- Prices are whole paisa digits:
mrpPaisaandsellingPricePaisaaccept 1 to 15 digits, at most 1,000,000,000,000, with no sign, decimal point or separator. The selling price may not exceed the MRP. - A blank
publicIdcreates a taxonomy row, and apublicIdof a live row updates it. A product is matched bysku, case-insensitively. - Limits: 5,000 data rows, 50 columns, 25 MiB. An XLSX file reads its first sheet and may not expand past 100 MiB. A violation fails the job with a row-0
BB_JOB_FILE_TOO_LARGE. - The import is all or nothing. If any row has an error, nothing is written, the job is
failed, anderrors[]lists every bad cell. - The uploaded file is deleted when the job ends. Upload it again to retry under a new
Idempotency-Key.
Row errors. Each entry is { row, column, errorCode, message }. row counts data rows from 1. row: 0 is an error about the whole file and has no column. message is a fixed sentence and never repeats a cell value. At most 500 entries are kept, and failedRows holds the true count.
errorCode | column | Raised for |
|---|---|---|
BB_IMPORT_ROW_INVALID | the offending column | Missing required value, bad UUID, name or description too long, bad displayOrder, bad sku, bad paisa, selling price above MRP, isActive not true or false, series without a brand, file not UTF-8, description empty after cleaning, category parent at maximum depth, series brand change |
BB_IMPORT_ROW_DUPLICATE | name, publicId or sku | The later row of a repeated key. Names are scoped to the parent category or the brand, and SKUs compare case-insensitively |
BB_IMPORT_ROW_CONFLICT | a constraint name, or sku | A database uniqueness, reference or check rule rejected the row, or the SKU's product is deleted or changed during the run |
BB_IMPORT_ROW_REFERENT_INVALID | categoryPublicId, brandPublicId, brandSeriesPublicId, parentPublicId or publicId | The value does not refer to a live row |
BB_IMPORT_ROW_MOVE_INVALID | parentPublicId | The move would form a cycle or pass the maximum depth |
BB_IMPORT_ROW_SKU_NOT_DEFAULT | sku | The SKU belongs to a variant that is not its product's default |
A file-level failure ends the job with one row-0 entry: BB_JOB_FILE_INVALID for an empty or unreadable file, a file that is not a workbook, a wrong header (the message lists the Missing:, Unexpected: and Duplicate: names) or an unclosed quote, and BB_JOB_FILE_TOO_LARGE for the limits above. A lock timeout, deadlock or serialization failure while writing is retried and is never a row error.
Export file. text/csv. The header is the import header of the entity, plus deletedAt last when includeDeleted is true. A product row carries its default live variant's sku, mrpPaisa and sellingPricePaisa in paisa (blank when it has none) and the stored HTML description. A cell starting with =, +, -, @, TAB, CR or ' is prefixed with ', and an import removes exactly one such prefix. Re-importing an export returns every cell unchanged except that a CR inside a cell comes back as LF and unguarded edge whitespace is trimmed.
The export file is kept: it has no expiry. .../result answers 410 BB_JOB_RESULT_GONE only when the file is already missing from the API host.
Key Contracts
JSON below is illustrative. Field names come from the DTOs; values are made up.
POST /api/admin/bb/categories
Request. name is required (max 150, trimmed). description max 2,000. displayOrder 0 to 100,000. parentPublicId and imageKey are optional.
{
"name": "Laptops",
"description": "Refurbished laptops",
"parentPublicId": "0193a5c0-6d6c-7b0e-8a39-1f2f6f7a9c11",
"displayOrder": 0
}Response 201:
{
"message": "Bb category created successfully",
"errorCode": null,
"data": { "publicId": "0193a5c1-2e4b-7c10-9d21-5a3b7c8d9e01" }
}GET /api/admin/bb/categories/tree
{
"message": "Bb category tree fetched successfully",
"errorCode": null,
"data": {
"roots": [
{
"publicId": "0193a5c0-6d6c-7b0e-8a39-1f2f6f7a9c11",
"name": "Computers",
"depth": 0,
"displayOrder": 0,
"children": [
{
"publicId": "0193a5c1-2e4b-7c10-9d21-5a3b7c8d9e01",
"name": "Laptops",
"depth": 1,
"displayOrder": 0,
"children": []
}
]
}
],
"truncated": false
}
}POST /api/admin/bb/categories/bulk/delete
Request: publicIds is a non-empty array of UUIDs, at most 100.
{
"publicIds": [
"0193a5c1-2e4b-7c10-9d21-5a3b7c8d9e01",
"0193a5c0-6d6c-7b0e-8a39-1f2f6f7a9c11"
]
}Response 200. HTTP 200 does not mean every id succeeded. Read failed.
{
"message": "Bulk delete processed.",
"errorCode": null,
"data": {
"succeeded": ["0193a5c1-2e4b-7c10-9d21-5a3b7c8d9e01"],
"failed": [
{
"publicId": "0193a5c0-6d6c-7b0e-8a39-1f2f6f7a9c11",
"errorCode": "BB_CATEGORY_HAS_PRODUCTS",
"message": "<fixed sentence from the single-row path>"
}
]
}
}Ids come back lower-cased. An id that does not exist or is already deleted lands in failed with BB_CATEGORY_NOT_FOUND (the same path as a missing id).
PATCH /api/admin/bb/categories/reorder
Request: the full, ordered list of one parent's live children. At most 1,000 ids. Not de-duplicated.
{
"publicIds": [
"0193a5c1-2e4b-7c10-9d21-5a3b7c8d9e01",
"0193a5c2-0a1b-7d33-8e44-6b5c7d8e9f02"
]
}Response 200 (changedCount is how many rows moved):
{
"message": "Order saved.",
"errorCode": null,
"data": { "changedCount": 2 }
}Refusal, 400:
{
"message": "The list must contain exactly the current live siblings; refresh and try again.",
"errorCode": "BB_REORDER_INVALID_ITEM",
"details": { "reason": "incomplete_set" }
}POST /api/admin/bb/products
Header Idempotency-Key is required.
Request. name 1 to 255. categoryPublicId is required. variants has 1 to 20 items. Prices are integer paisa, 0 to 1,000,000,000,000. gallery has at most 20 items. tagPublicIds at most 30, unique. optionValuePublicIds at most 5 per variant.
{
"name": "ThinkPad T14 Gen 2",
"description": "<p>14 inch, 16 GB RAM.</p>",
"categoryPublicId": "0193a5c1-2e4b-7c10-9d21-5a3b7c8d9e01",
"brandPublicId": "0193a5c3-1b2c-7e44-9f55-7c6d8e9fa003",
"thumbnailKey": "public/thumbnail/t14.jpg",
"gallery": [
{ "kind": "image", "key": "public/thumbnail/t14-front.jpg", "alt": "Front view" },
{ "kind": "video", "key": "public/product-video/t14.mp4", "posterKey": "public/thumbnail/t14-front.jpg" }
],
"tagPublicIds": [],
"isActive": true,
"variants": [
{
"sku": "T14-G2-16-512",
"mrpPaisa": 9500000,
"sellingPricePaisa": 8900000,
"isDefault": true,
"isActive": true
}
]
}Response 201:
{
"message": "Bb product created successfully",
"errorCode": null,
"data": { "publicId": "0193a5c4-3c4d-7f55-8a66-8d7e9fa0b104" }
}PATCH /api/admin/bb/products/:publicId
version is optional. A stale value answers 409 BB_PRODUCT_VERSION_CONFLICT.
{
"version": 3,
"name": "ThinkPad T14 Gen 2 (refurbished)",
"brandSeriesPublicId": null
}Response 200 returns the full product: publicId, name, description, category, brand, brandSeries, isActive, version, thumbnailKey, thumbnailUrl, gallery, tags, options, variants, createdAt, updatedAt.
Each variant: publicId, name, displayName, sku, mrpPaisa, sellingPricePaisa, thumbnailKey, thumbnailUrl, position, isDefault, isActive, version, optionValues, createdAt, updatedAt.
POST /api/admin/bb/products/:productPublicId/options
{
"name": "RAM",
"values": ["8 GB", "16 GB"],
"productVersion": 3
}Response 201 returns the new axis and the bumped product version:
{
"message": "Bb product option created successfully",
"errorCode": null,
"data": {
"publicId": "0193a5c5-4d5e-7066-9b77-9e8fa0b1c205",
"productVersion": 4
}
}POST /api/admin/bb/jobs/products/export
Header Idempotency-Key is required. search matches the name (max 200). includeDeleted: true needs BB_Products_RESTORE.
{
"includeDeleted": false,
"search": "thinkpad"
}Response 201:
{
"message": "Bb product export job submitted",
"errorCode": null,
"data": { "publicId": "0193a5c6-5e6f-7177-8c88-af90b1c2d306" }
}A matching row count over 50,000 answers 400 BB_JOB_EXPORT_TOO_LARGE before the job is created.
GET /api/admin/bb/jobs/products/:publicId
{
"message": "Bb product job fetched successfully",
"errorCode": null,
"data": {
"publicId": "0193a5c6-5e6f-7177-8c88-af90b1c2d306",
"kind": "export",
"entity": "product",
"status": "queued",
"totalRows": null,
"processedRows": 0,
"failedRows": 0,
"attemptsMade": 0,
"lastError": null,
"requestedBy": { "id": "0193a5b0-1111-7222-8333-444455556666", "name": "Asha Rai" },
"startedAt": null,
"finishedAt": null,
"createdAt": "2026-11-02T09:00:00.000Z",
"hasResult": false,
"isStalled": false,
"filters": { "includeDeleted": false, "search": "thinkpad" },
"errors": null
}
}isStalled is true for a processing job older than 15 minutes, or a queued job older than 30 minutes.
lastError is a fixed sentence, never raw error text. A job that failed on its rows reads, for example:
{
"message": "Bb product job fetched successfully",
"errorCode": null,
"data": {
"publicId": "0193a5c7-6f70-7288-9d99-b0a1c2d3e407",
"kind": "import",
"entity": "product",
"status": "failed",
"totalRows": 3,
"processedRows": 3,
"failedRows": 2,
"attemptsMade": 1,
"lastError": "Import rejected: 2 row(s) have errors; nothing was written.",
"requestedBy": { "id": "0193a5b0-1111-7222-8333-444455556666", "name": "Asha Rai" },
"startedAt": "2026-11-02T09:01:02.000Z",
"finishedAt": "2026-11-02T09:01:03.000Z",
"createdAt": "2026-11-02T09:01:00.000Z",
"hasResult": false,
"isStalled": false,
"filters": {},
"errors": [
{ "row": 2, "column": "sellingPricePaisa", "errorCode": "BB_IMPORT_ROW_INVALID", "message": "sellingPricePaisa is above mrpPaisa." },
{ "row": 3, "column": "sku", "errorCode": "BB_IMPORT_ROW_DUPLICATE", "message": "sku appears earlier in the file." }
]
}
}A wrong header fails the job before any row is read, with a single entry whose row is 0 and which has no column:
{
"row": 0,
"errorCode": "BB_JOB_FILE_INVALID",
"message": "The header must contain exactly these columns: sku, name, categoryPublicId, brandPublicId, brandSeriesPublicId, mrpPaisa, sellingPricePaisa, description, isActive. Missing: sku."
}POST /api/admin/bb/jobs/products/import
multipart/form-data with one file field named file, and the Idempotency-Key header.
curl -X POST "$API/api/admin/bb/jobs/products/import" \
-H "Authorization: Bearer $TOKEN" \
-H "Idempotency-Key: import-2026-11-02-001" \
-F "file=@products.csv;type=text/csv"Response 201: { "publicId": "..." } under data. Replaying the same key with the same file returns the same publicId. A different file under the same key is 409 BB_JOB_IDEMPOTENCY_CONFLICT.
Accepted types: .csv or .xlsx with MIME text/csv, application/csv, application/vnd.ms-excel, application/octet-stream or the XLSX type. At most 25 MiB.
GET /api/admin/bb/jobs/products/:publicId/result
Returns text/csv; charset=utf-8 with Content-Disposition: attachment; filename="bb-product-export-<publicId>.csv". The file stays on the API host; if it is gone the response is 410 BB_JOB_RESULT_GONE.
Error body
{
"message": "A variant with this SKU already exists.",
"errorCode": "BB_VARIANT_SKU_TAKEN",
"details": { "sku": "T14-G2-16-512" }
}Error Reference
Status codes come from the comment on each constant in ErrorCodes. A comment gives the usual HTTP status; some codes have a second status noted below.
| Code | Status | Meaning |
|---|---|---|
BB_CATALOG_BUSY | 409 | Lock wait over 5 s (55P03) on any catalog write. A deadlock (40P01) or serialization failure (40001) on a catalog entity write or bulk action answers the same code. Retry |
BB_CATEGORY_NOT_FOUND | 404, 400 as a referenced parent | |
BB_CATEGORY_NAME_TAKEN | 409 | Sibling name in use |
BB_CATEGORY_PARENT_DELETED | 409 | Parent is soft-deleted |
BB_CATEGORY_DEPTH_EXCEEDED | 400 | Past depth 6 |
BB_CATEGORY_MOVE_CYCLE | 400 | Move under own descendant |
BB_CATEGORY_HAS_CHILDREN | 409 | Live children block delete |
BB_CATEGORY_HAS_PRODUCTS | 409 | Live products block delete |
BB_BRAND_NOT_FOUND | 404, 400 | |
BB_BRAND_NAME_TAKEN | 409 | |
BB_BRAND_DELETED | 409 | The brand is soft-deleted |
BB_BRAND_HAS_SERIES | 409 | |
BB_BRAND_HAS_PRODUCTS | 409 | |
BB_BRAND_SERIES_NOT_FOUND | 404, 400 | |
BB_BRAND_SERIES_NAME_TAKEN | 409 | |
BB_BRAND_SERIES_BRAND_MISMATCH | 400 | Series of another brand, or a series with no brand |
BB_BRAND_SERIES_HAS_PRODUCTS | 409 | |
BB_TAG_NOT_FOUND | 404, 400 | details.publicIds on PUT .../tags |
BB_TAG_NAME_TAKEN | 409 | |
BB_PRODUCT_NOT_FOUND | 404 | Missing or soft-deleted |
BB_PRODUCT_REFERENT_NOT_FOUND | 400 | Category, brand or series missing; details.field |
BB_PRODUCT_REFERENT_DELETED | 409 | Category, brand or series soft-deleted; details.field |
BB_PRODUCT_VERSION_CONFLICT | 409 | Stale version / productVersion |
BB_PRODUCT_GALLERY_INVALID | 400 | Gallery item kind, prefix, alt, poster or video count |
BB_PRODUCT_DESCRIPTION_TOO_LONG | 400 | Sanitized text over 20,000 code points; details.maxLength |
BB_PRODUCT_DESCRIPTION_EMPTY | 400 | Nothing allowed left after sanitizing |
BB_VARIANT_NOT_FOUND | 404 | |
BB_VARIANT_SKU_TAKEN | 409 | details.sku |
BB_VARIANT_SKU_DUPLICATE_IN_REQUEST | 400 | Same SKU twice in one request, compared case-insensitively |
BB_VARIANT_PRICE_INVALID | 400 | Selling price above MRP, or a price that is not whole paisa within 0 to 1,000,000,000,000 |
BB_VARIANT_DEFAULT_INACTIVE | 409 | Default must be active |
BB_VARIANT_LAST_LIVE | 409 | Cannot delete the last live variant |
BB_VARIANT_HAS_STOCK | 409 | Cannot delete a variant whose stock is above 0; write it off first (phase 3, see the stock API) |
BB_VARIANT_NO_ACTIVE_SUCCESSOR | 409 | No active variant can become default |
BB_VARIANT_VERSION_CONFLICT | 409 | Stale variant write |
BB_VARIANT_OPTION_VALUES_INVALID | 400 | |
BB_VARIANT_DUPLICATE_COMBINATION | 409 | Another live variant has the combination and label |
BB_VARIANT_LIMIT_EXCEEDED | 400 | More than 100 live variants |
BB_CATALOG_FIELD_INVALID | 400 | Any other chk_bb_* check violation |
BB_OPTION_NOT_FOUND | 404 | |
BB_OPTION_NAME_TAKEN | 409 | |
BB_OPTION_LIMIT_EXCEEDED | 400 | More than 5 axes or 50 values |
BB_OPTION_VALUE_NOT_FOUND | 404 | |
BB_OPTION_VALUE_TAKEN | 409 | |
BB_OPTION_VALUE_HAS_LIVE_VARIANTS | 409 | |
BB_OPTION_ADD_WOULD_DUPLICATE_VARIANTS | 409 | |
BB_OPTION_REMOVAL_WOULD_DUPLICATE_VARIANTS | 409 | |
BB_BULK_TOO_MANY_ITEMS | 400 | Over 100 ids after de-duplication. The DTO rejects a raw array over 100 first as VALIDATION_FAILED, so this is not reachable through the routes |
BB_REORDER_INVALID_ITEM | 400 | details.reason: duplicate_id, not_found, mixed_parents, incomplete_set |
BB_JOB_NOT_FOUND | 404 | Also returned for another entity's job |
BB_JOB_NOT_CANCELLABLE | 409 | Job already finished |
BB_JOB_FILE_INVALID | 400 | Extension, MIME or unreadable file; also a missing file. As a row-0 entry in errors[] of a failed import: empty or unreadable file, not a workbook, wrong header, unclosed quote |
BB_JOB_FILE_TOO_LARGE | 400 | Multer size limit at upload. As a row-0 entry in errors[]: over 5,000 data rows, 50 columns, 25 MiB, or a workbook that expands past 100 MiB |
BB_JOB_EXPORT_TOO_LARGE | 400 | Over 50,000 rows at submit; also a row-0 entry when the data grew past it before the worker finished |
BB_JOB_RESULT_NOT_AVAILABLE | 409 | No result file yet, or not a completed export |
BB_JOB_RESULT_GONE | 410 | Export file missing on disk. A finished export's file is not expired |
BB_JOB_TOO_MANY_ACTIVE | 409 | More than 2 queued or processing jobs for this admin |
BB_JOB_INCLUDE_DELETED_FORBIDDEN | 403 | includeDeleted without BB_<E>_RESTORE |
BB_JOB_IDEMPOTENCY_CONFLICT | 409 | Same key, different file |
IDEMPOTENCY_KEY_REQUIRED | 400 | Import without the header |
VALIDATION_FAILED | 400 | DTO failure; also an Idempotency-Key over 200 characters, and multer limits other than file size |
UPLOAD_FILE_ACCESS_DENIED | 403 | A shared upload route asked for a uploads/bb-* key |
Job-level codes, written to a job row and never returned as an HTTP error: BB_JOB_AUTHORIZATION_REVOKED, BB_JOB_LEASE_EXPIRED, BB_JOB_NEVER_DISPATCHED, BB_JOB_RETRY_ABANDONED. Import row codes in errors[]: BB_IMPORT_ROW_INVALID, _DUPLICATE, _CONFLICT, _REFERENT_INVALID, _MOVE_INVALID, _SKU_NOT_DEFAULT. When each row code is raised is in the Import and export files section.
Guardrail Summary
- Prices are integer paisa and never exceed 1,000,000,000,000. Do not send rupees or decimals.
- Never send a raw id as a label. Map every
errorCode,kind,statusand permission code to text in the client. - A bulk response of 200 can still hold failures. Always read
failed[]. - Reorder must send the exact live sibling set. Refetch after a 400
BB_REORDER_INVALID_ITEM. - Send
productVersionon every option write. Sendversionon product, variant and product-delete writes when you hold one, and handle 409 by reloading. - Every create needs an
Idempotency-Key. Reuse the same key only for a retry of the same request. - A job is asynchronous. Poll
GET .../:publicId; stop oncompleted,failedorcancelled. A 201 means queued, not done. - An import is all or nothing and its uploaded file is deleted when the job ends. Fix every row in
errors[], then upload again under a newIdempotency-Key. Replaying the same key with the same file returns the original job id, not a new job. - Do not link to a job file path. Download an export only through
.../:publicId/result; the shared upload routes refuseuploads/bb-*. - A UI permission check is a convenience. The backend enforces every code.
See Also
- Catalog feature overview:
catalog-feature - Catalog backend architecture:
catalog-backend - Phase 1 API:
api
B2B Second Inventory Catalog Backend Architecture
Internal architecture of the bb phase 2 catalog — composition, data model, locking and invariants, job state machine, sweeps, error contract and file map.
B2B Second Inventory Stock Feature Overview
Phase 3 of the bb (B2B second inventory) area — a stock counter per variant, an append-only movement ledger, adjust and bulk adjust, a low-stock threshold, stock import and export jobs, and an hourly report-only drift check.