Skip to main content

Create Category (v1)

Method + Path

POST /v1/workspace/:workspaceId/storefront/categories

Actual backend path: /v1/workspace/:workspaceId/storefront/categories

Description

Create a new storefront category.

Authentication

Required - JWT token in Authorization header

Required Permissions:

  • store.manage

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token: Bearer <token>
Content-TypestringYesapplication/json

Path Parameters

ParameterTypeRequiredDescription
workspaceIdstringYesWorkspace identifier

Request Body

{
"parentId": null,
"name": "Electronics",
"slug": "electronics",
"description": "Electronic products",
"sortOrder": 1
}

Body Parameters

ParameterTypeRequiredDescription
parentIdstringNoParent category ID (null for root categories)
namestringYesCategory name (1-120 characters)
slugstringNoURL-friendly slug (1-80 characters, auto-generated if omitted)
descriptionstringNoCategory description (maximum 2000 characters)
sortOrdernumberNoSort order (integer)

Response (201)

{
"category": {
"id": "507f1f77bcf86cd799439011",
"parentId": null,
"name": "Electronics",
"slug": "electronics",
"description": "Electronic products",
"sortOrder": 1,
"status": "active",
"createdAt": "2024-01-15T10:00:00Z"
}
}

Common Errors

  • 400 Bad Request: Invalid request body
  • 401 Unauthorized: Missing or invalid authentication token
  • 403 Forbidden: Insufficient permissions (requires store.manage)
  • 404 Not Found: Workspace or parent category not found
  • 409 Conflict: Slug already exists
  • 422 Unprocessable Entity: Validation errors
  • 500 Internal Server Error: Server error