Nano Store - Ecommerce Docs
Developer ResourcesCatalog Integrity and Client IP

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

SurfacePrefixAuth
Catalog admin/api/admin/catalogJWT + Categories_*, Brands_*, BrandSeries_*
Product admin/api/admin/productsJWT + Products_*
Activity log/api/activityJWT + Activity_READ

Endpoint Reference

Admin — changed behavior

MethodPathAuthDescription
DELETE/api/admin/catalog/categories/:publicIdCategories_DELETERefused with CATEGORY_HAS_ACTIVE_PRODUCTS or CATALOG_RESOURCE_BUSY
POST/api/admin/catalog/categories/:publicId/restoreCategories_RESTORERefused with CATEGORY_PARENT_DELETED when the parent is deleted or missing
POST/api/admin/catalog/categories/bulk/deleteCategories_DELETEPer-id CATEGORY_HAS_ACTIVE_PRODUCTS; whole request CATALOG_RESOURCE_BUSY
DELETE/api/admin/catalog/brands/:publicIdBrands_DELETERefused with BRAND_HAS_ACTIVE_PRODUCTS or CATALOG_RESOURCE_BUSY
POST/api/admin/catalog/brands/bulk/deleteBrands_DELETEPer-id BRAND_HAS_ACTIVE_PRODUCTS; whole request CATALOG_RESOURCE_BUSY
DELETE/api/admin/catalog/brand-series/:publicIdBrandSeries_DELETERefused with BRAND_SERIES_HAS_ACTIVE_PRODUCTS or CATALOG_RESOURCE_BUSY
POST/api/admin/catalog/brand-series/bulk/deleteBrandSeries_DELETEPer-id BRAND_SERIES_HAS_ACTIVE_PRODUCTS; whole request CATALOG_RESOURCE_BUSY
POST/api/admin/catalog/brand-series, PATCH .../:publicId, POST .../:publicId/restore, POST .../bulk/restoreBrandSeries_CREATE, _UPDATE, _RESTOREBRAND_SERIES_BRAND_DELETED when the owning brand is deleted
POST/api/admin/products/:publicId/restore, /api/admin/products/bulk/restoreProducts_RESTOREPRODUCT_CATEGORY_DELETED, PRODUCT_BRAND_DELETED, PRODUCT_SERIES_DELETED; now race-safe
PATCH/api/admin/products/:publicIdProducts_UPDATEAn unchanged classification under a deleted referent is accepted

Activity

MethodPathAuthDescription
GET/api/activityActivity_READList entries; each carries ipAddress
GET/api/activity/:idActivity_READOne 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.

HeaderValue
x-internal-client-ipOne IP literal. No list, no zone id
x-internal-client-ip-tokenThe 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."
}
errorCodeHTTPRaised when
CATEGORY_HAS_ACTIVE_PRODUCTS409A product with deleted_at IS NULL, in any status, references the category
BRAND_HAS_ACTIVE_PRODUCTS409Same, for the brand
BRAND_SERIES_HAS_ACTIVE_PRODUCTS409Same, for the series
CATALOG_RESOURCE_BUSY409A catalog delete could not take its locks within CATALOG_DELETE_LOCK_TIMEOUT_MS
CATEGORY_PARENT_DELETED409Restore, create or move under a deleted or missing parent
BRAND_SERIES_BRAND_DELETED409Series create, restore or re-parent under a deleted brand
CATEGORY_HAS_ACTIVE_CHILDREN409Unchanged; evaluated before the product check
BRAND_HAS_ACTIVE_SERIES409Unchanged; evaluated before the product check
PRODUCT_SKU_ALREADY_EXISTS409Duplicate live SKU. Previously a 500
PRODUCT_SERIES_BRAND_MISMATCH409Series belongs to another brand. Previously a 500 on the constraint path
PRODUCT_THUMBNAIL_REQUIRED_TO_PUBLISH409Live product without a thumbnail, caught at the constraint
PRODUCT_SELLING_PRICE_ABOVE_MRP409Selling price above MRP, caught at the constraint
VALIDATION_FAILED400thumbnailAlt without thumbnailKey, caught at the constraint
TAG_SLUG_ALREADY_EXISTS409Duplicate live tag slug

Consumers map errorCode to user-facing copy. They never parse message.

Guardrail Summary

  • Branch on errorCode, never on message. The count in the *_HAS_ACTIVE_PRODUCTS messages is for people.
  • Treat CATALOG_RESOURCE_BUSY as retryable and every *_HAS_ACTIVE_PRODUCTS as not retryable until the user moves or deletes the products.
  • Read failures on every bulk response. A 200 does 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-ip or its token from a browser or a third party. The admin server is the only sender.
  • The login limiter and IpThrottlerGuard key on the forwarded address only when the token matches; otherwise the guard uses req.ip and the login limiter uses the direct peer only if it is public (see Login Brute-Force Throttling). On login-tier routes a Redis outage answers 503 AUTH_LOGIN_UNAVAILABLE and the tier's 429 carries Retry-After: 900. POST /api/mobile/user/change-password is throttled and can answer 429 AUTH_LOGIN_TEMPORARILY_LOCKED (5 per 15 minutes per IP via AUTH_ATTEMPT, plus the per-user limiter). During a Redis outage it answers 500, not 503.

See Also