Skip to main content
POST
/
categories
{
  "name": "Electronics"
}
{
  "id": "1",
  "name": "Electronics",
  "createdAt": "2024-01-15T10:30:00Z"
}
This endpoint creates a new category. Requires authentication and admin role.

Authentication

Authorization
string
required
Bearer token for authentication. Must have admin role.

Request Body

name
string
required
Name of the category to create
{
  "name": "Electronics"
}

Response

{
  "id": "1",
  "name": "Electronics",
  "createdAt": "2024-01-15T10:30:00Z"
}

Response Fields

id
string
required
Unique identifier for the newly created category
name
string
required
Name of the category
createdAt
string
required
ISO 8601 timestamp of when the category was created

Error Responses

{
  "message": "Unauthorized"
}

Build docs developers (and LLMs) love