Permanently deletes a category from 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.
This operation is irreversible. Make sure you want to permanently delete the category before proceeding.
Request
Path Parameters
The unique MongoDB ObjectId of the category to delete
Bearer token with admin privilegesExample: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Response
Success message confirming the deletion
{
"message": "Category deleted successfully"
}
Error Responses
Error message describing what went wrong
404 - Category Not Found
Returned when no category exists with the specified ID.
{
"error": "Category not found"
}
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 DELETE https://api.vaniyk-empire.com/api/categories/507f1f77bcf86cd799439011 \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN"
Notes
- The deletion is permanent and cannot be undone
- The
categoryId parameter must be a valid MongoDB ObjectId
- Consider the impact on any content (articles, posts, etc.) that may be associated with this category before deletion