Catalog Integrity and Client IP API Reference
Changed behavior, new 409 codes and bulk failure shapes for the catalog delete and restore endpoints, plus the internal client-IP headers.
Audience and scope. Admin-panel and API developers. No endpoint was added and no request or response shape changed. This page covers the new refusals on existing catalog and product routes, the bulk per-id failures, and the two internal headers the admin sends.
Route Surfaces
| Surface | Prefix | Auth |
|---|---|---|
| Catalog admin | /api/admin/catalog | JWT + Categories_*, Brands_*, BrandSeries_* |
| Product admin | /api/admin/products | JWT + Products_* |
| Activity log | /api/activity | JWT + Activity_READ |
Endpoint Reference
Admin — changed behavior
| Method | Path | Auth | Description |
|---|---|---|---|
DELETE | /api/admin/catalog/categories/:publicId | Categories_DELETE | Refused with CATEGORY_HAS_ACTIVE_PRODUCTS or CATALOG_RESOURCE_BUSY |
POST | /api/admin/catalog/categories/:publicId/restore | Categories_RESTORE | Refused with CATEGORY_PARENT_DELETED when the parent is deleted or missing |
POST | /api/admin/catalog/categories/bulk/delete | Categories_DELETE | Per-id CATEGORY_HAS_ACTIVE_PRODUCTS; whole request CATALOG_RESOURCE_BUSY |
DELETE | /api/admin/catalog/brands/:publicId | Brands_DELETE | Refused with BRAND_HAS_ACTIVE_PRODUCTS or CATALOG_RESOURCE_BUSY |
POST | /api/admin/catalog/brands/bulk/delete | Brands_DELETE | Per-id BRAND_HAS_ACTIVE_PRODUCTS; whole request CATALOG_RESOURCE_BUSY |
DELETE | /api/admin/catalog/brand-series/:publicId | BrandSeries_DELETE | Refused with BRAND_SERIES_HAS_ACTIVE_PRODUCTS or CATALOG_RESOURCE_BUSY |
POST | /api/admin/catalog/brand-series/bulk/delete | BrandSeries_DELETE | Per-id BRAND_SERIES_HAS_ACTIVE_PRODUCTS; whole request CATALOG_RESOURCE_BUSY |
POST | /api/admin/catalog/brand-series, PATCH .../:publicId, POST .../:publicId/restore, POST .../bulk/restore | BrandSeries_CREATE, _UPDATE, _RESTORE | BRAND_SERIES_BRAND_DELETED when the owning brand is deleted |
POST | /api/admin/products/:publicId/restore, /api/admin/products/bulk/restore | Products_RESTORE | PRODUCT_CATEGORY_DELETED, PRODUCT_BRAND_DELETED, PRODUCT_SERIES_DELETED; now race-safe |
PATCH | /api/admin/products/:publicId | Products_UPDATE | An unchanged classification under a deleted referent is accepted |
Activity
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /api/activity | Activity_READ | List entries; each carries ipAddress |
GET | /api/activity/:id | Activity_READ | One entry; carries ipAddress |
Key Contracts
DELETE /api/admin/catalog/categories/:publicId
Response — 200
{
"message": "Category deleted successfully",
"errorCode": null
}Response — 409, live products remain
{
"statusCode": 409,
"errorCode": "CATEGORY_HAS_ACTIVE_PRODUCTS",
"message": "Category has 3 active product(s); move or delete them before deleting the category."
}Outside production the error body also carries timestamp and path. The message text for the other two codes reads Brand has N active product(s); move or delete them before deleting the brand. and Brand series has N active product(s); move or delete them before deleting the series.
POST /api/admin/catalog/categories/bulk/delete
Request
{
"publicIds": [
"018f4e2a-7b3c-7c1e-9b2a-3d4e5f6a7b8c",
"018f4e2a-7b3c-7c1e-9b2a-3d4e5f6a7b8d"
]
}publicIds must be a non-empty array of UUIDv7 strings. Duplicates count once. The route is processed deepest-first.
Response — 200, one id blocked
{
"message": "Bulk delete processed",
"data": {
"succeeded": ["018f4e2a-7b3c-7c1e-9b2a-3d4e5f6a7b8d"],
"failures": [
{
"publicId": "018f4e2a-7b3c-7c1e-9b2a-3d4e5f6a7b8c",
"errorCode": "CATEGORY_HAS_ACTIVE_PRODUCTS"
}
]
},
"errorCode": null
}A partial failure is still a 200. The envelope errorCode stays null and per-id outcomes live in failures. Possible per-id codes on category bulk delete: CATEGORY_ALREADY_DELETED, CATEGORY_HAS_ACTIVE_CHILDREN, CATEGORY_HAS_ACTIVE_PRODUCTS. Brand and series bulk delete return the same shape with BRAND_HAS_ACTIVE_PRODUCTS and BRAND_SERIES_HAS_ACTIVE_PRODUCTS.
Response — 409, locks unavailable
{
"statusCode": 409,
"errorCode": "CATALOG_RESOURCE_BUSY",
"message": "Another catalog change is in progress; try again shortly."
}Nothing was deleted. Retry the whole request.
Internal client-IP headers
Sent by the admin server to the API. Browsers and other clients must not send them; Nginx clears them.
| Header | Value |
|---|---|
x-internal-client-ip | One IP literal. No list, no zone id |
x-internal-client-ip-token | The value of INTERNAL_CLIENT_IP_TOKEN |
The API honors the address only when the token matches and each header appears once. Otherwise it ignores both and records the direct peer.
Error Reference
{
"statusCode": 409,
"errorCode": "CATALOG_RESOURCE_BUSY",
"message": "Another catalog change is in progress; try again shortly."
}errorCode | HTTP | Raised when |
|---|---|---|
CATEGORY_HAS_ACTIVE_PRODUCTS | 409 | A product with deleted_at IS NULL, in any status, references the category |
BRAND_HAS_ACTIVE_PRODUCTS | 409 | Same, for the brand |
BRAND_SERIES_HAS_ACTIVE_PRODUCTS | 409 | Same, for the series |
CATALOG_RESOURCE_BUSY | 409 | A catalog delete could not take its locks within CATALOG_DELETE_LOCK_TIMEOUT_MS |
CATEGORY_PARENT_DELETED | 409 | Restore, create or move under a deleted or missing parent |
BRAND_SERIES_BRAND_DELETED | 409 | Series create, restore or re-parent under a deleted brand |
CATEGORY_HAS_ACTIVE_CHILDREN | 409 | Unchanged; evaluated before the product check |
BRAND_HAS_ACTIVE_SERIES | 409 | Unchanged; evaluated before the product check |
PRODUCT_SKU_ALREADY_EXISTS | 409 | Duplicate live SKU. Previously a 500 |
PRODUCT_SERIES_BRAND_MISMATCH | 409 | Series belongs to another brand. Previously a 500 on the constraint path |
PRODUCT_THUMBNAIL_REQUIRED_TO_PUBLISH | 409 | Live product without a thumbnail, caught at the constraint |
PRODUCT_SELLING_PRICE_ABOVE_MRP | 409 | Selling price above MRP, caught at the constraint |
VALIDATION_FAILED | 400 | thumbnailAlt without thumbnailKey, caught at the constraint |
TAG_SLUG_ALREADY_EXISTS | 409 | Duplicate live tag slug |
Consumers map errorCode to user-facing copy. They never parse message.
Guardrail Summary
- Branch on
errorCode, never onmessage. The count in the*_HAS_ACTIVE_PRODUCTSmessages is for people. - Treat
CATALOG_RESOURCE_BUSYas retryable and every*_HAS_ACTIVE_PRODUCTSas not retryable until the user moves or deletes the products. - Read
failureson every bulk response. A200does not mean every id succeeded. - Archived products block a delete. They must be set back to draft before they can be moved.
- To restore a category, restore its parent first. To restore a series, its brand must be live.
- Never send
x-internal-client-ipor its token from a browser or a third party. The admin server is the only sender. - The login limiter and
IpThrottlerGuardkey on the forwarded address only when the token matches; otherwise the guard usesreq.ipand the login limiter uses the direct peer only if it is public (see Login Brute-Force Throttling). On login-tier routes a Redis outage answers503 AUTH_LOGIN_UNAVAILABLEand the tier's 429 carriesRetry-After: 900.POST /api/mobile/user/change-passwordis throttled and can answer429 AUTH_LOGIN_TEMPORARILY_LOCKED(5 per 15 minutes per IP viaAUTH_ATTEMPT, plus the per-user limiter). During a Redis outage it answers500, not503.
See Also
Catalog Integrity and Client IP Backend Architecture
Lock protocol, delete guards, constraint-error mapping and the client-IP resolution chain across the API and the admin BFF.
Login Brute-Force Throttling
Per-account and per-account-plus-IP login limits, the known-IP exemption, reset behavior, fail-closed rules, error codes and env keys.