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
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer token: Bearer <token> |
Content-Type | string | Yes | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | Workspace identifier |
Request Body
{
"parentId": null,
"name": "Electronics",
"slug": "electronics",
"description": "Electronic products",
"sortOrder": 1
}
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
parentId | string | No | Parent category ID (null for root categories) |
name | string | Yes | Category name (1-120 characters) |
slug | string | No | URL-friendly slug (1-80 characters, auto-generated if omitted) |
description | string | No | Category description (maximum 2000 characters) |
sortOrder | number | No | Sort 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