Documentation Index
Fetch the complete documentation index at: https://mintlify.com/PhemiT/vaniykeempire-api/llms.txt
Use this file to discover all available pages before exploring further.
Creates a new category in the system. This endpoint requires admin authentication.
This endpoint requires admin privileges. You must include a valid JWT token with admin role in the Authorization header.
Request
Bearer token with admin privilegesExample: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Must be set to application/json
Body Parameters
The display name of the category. Must be unique. The slug will be automatically generated from this name.
Optional description of the category
{
"name": "Technology",
"description": "Articles about technology and innovation"
}
Response
The newly created category object
Unique identifier for the category
Display name of the category
Auto-generated URL-friendly identifier
Description of the category
ISO 8601 timestamp of when the category was created
{
"message": "Category created successfully",
"category": {
"_id": "507f1f77bcf86cd799439011",
"name": "Technology",
"slug": "technology",
"description": "Articles about technology and innovation",
"createdAt": "2024-01-15T10:30:00.000Z"
}
}
Error Responses
Error message describing what went wrong
400 - Category Already Exists
Returned when a category with the same name already exists.
{
"error": "Category already exists"
}
401 - Unauthorized
Returned when the authentication token is missing or invalid.
{
"error": "No token provided"
}
403 - Forbidden
Returned when the authenticated user is not an admin.
{
"error": "Admin access required"
}
500 - Internal Server Error
{
"error": "Database connection failed"
}
Example Request
curl -X POST https://api.vaniyk-empire.com/api/categories \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Technology",
"description": "Articles about technology and innovation"
}'
Notes
- The
slug field is automatically generated from the name field by converting to lowercase and replacing spaces/special characters with hyphens
- Category names must be unique across the system
- The auto-generated slug must also be unique