Shop It Docs
Developer ResourcescatalogCategory

Category Module API & Integration Guide

HTTP contracts for catalog category admin, customer, and mobile APIs.

Overview

Category APIs support:

  • admin category CRUD, restore, and sibling reorder
  • customer/mobile category listing and slug detail
  • slug-history fallback for old slugs
  • product kind tagging and filtering

Soft-deleted categories are excluded from normal reads by default.

Routes

MethodPathAuth
GET/api/admin/categoriesAdmin + Categories_READ
GET/api/admin/categories/:idAdmin + Categories_READ
POST/api/admin/categoriesAdmin + Categories_CREATE
PATCH/api/admin/categories/:idAdmin + Categories_UPDATE
DELETE/api/admin/categories/:idAdmin + Categories_DELETE (soft delete)
POST/api/admin/categories/:id/restoreAdmin + Categories_UPDATE
POST/api/admin/categories/reorderAdmin + Categories_UPDATE
GET/api/categories and /api/mobile/categoriesPublic
GET/api/categories/:slug and /api/mobile/categories/:slugPublic

Admin Query/Body Contracts

GET /api/admin/categories

  • supports search, parentId, isVisible, sort, order, pagination from QueryDto
  • supports includeDeleted (default false)
  • supports productKind filter: physical | digital | both (exact match, optional)

GET /api/admin/categories/:id

  • supports includeDeleted (default false)

POST /api/admin/categories

All existing fields plus:

FieldTypeRequiredDescription
productKind"physical" | "digital" | "both"NoProduct kind for this category. Omit for unconstrained.

PATCH /api/admin/categories/:id

All existing fields plus:

FieldTypeRequiredDescription
productKind"physical" | "digital" | "both" | nullNoSet to null to clear kind constraint. Omit to leave unchanged.

POST /api/admin/categories/reorder

{
  "parentId": null,
  "ids": [5, 7, 9]
}
  • parentId: number | null
  • all ids must be active categories and direct children of parentId

Admin Response Shape

All admin category responses include:

{
  "id": 1,
  "name": "Laptops",
  "slug": "laptops",
  "description": null,
  "parentId": null,
  "order": 0,
  "isVisible": true,
  "productKind": "physical",
  "imageUrl": null,
  "deletedAt": null,
  "deletedBy": null,
  "createdAt": "2026-06-13T10:00:00.000Z",
  "updatedAt": "2026-06-13T10:00:00.000Z"
}

productKind is null for categories created before this feature was added.

Customer/Mobile Contracts

  • list defaults: isVisible=true, pagination=false, sort name asc

  • soft-deleted categories are always excluded

  • supports productKind filter: physical | digital (customer only — both is not a valid filter value)

  • when productKind=physical is provided: returns categories where productKind = 'physical' or productKind = 'both'

  • when productKind=digital is provided: returns categories where productKind = 'digital' or productKind = 'both'

  • when productKind is omitted: returns all visible active categories regardless of kind

  • slug detail resolves:

    1. current visible + active slug
    2. fallback to category_slug_history
    3. only returns if mapped category is visible + active

Customer Response Shape

{
  "id": 1,
  "name": "Laptops",
  "slug": "laptops",
  "description": null,
  "parentId": null,
  "order": 0,
  "isVisible": true,
  "productKind": "physical",
  "imageUrl": null,
  "createdAt": "2026-06-13T10:00:00.000Z",
  "updatedAt": "2026-06-13T10:00:00.000Z"
}

Error Codes

HTTPerrorCodeCondition
400CATEGORY_SELF_PARENTCategory set as its own parent
400CATEGORY_MOVE_TO_DESCENDANTMove under descendant
400CATEGORY_MISSING_PARENTParent not found
400CATEGORY_DEPTH_EXCEEDEDDepth > 3
400CATEGORY_DUPLICATE_IDSDuplicate ids in reorder payload
400CATEGORY_INVALID_SORTUnsupported customer sort field
400CATEGORY_REORDER_PARENT_MISMATCHReorder ids do not belong to provided parent
400— class-validator —Invalid productKind value (not in allowed enum)
404CATEGORY_NOT_FOUNDCategory or slug not found
409CATEGORY_HAS_CHILDRENSoft delete blocked by active children
409CATEGORY_ALREADY_DELETEDSoft delete requested for already deleted category
409CATEGORY_DELETEDMutation requested on deleted category
409CATEGORY_RESTORE_PARENT_DELETEDRestore blocked because parent is deleted

Cache

Write invalidation on admin create/update/delete/restore/reorder:

  • catalog:categories:visible*
  • catalog:categories:list:*
  • catalog:category:slug:*

Customer list cache key includes productKind segment — different kind filters are cached independently.