Skip to main content
ADMIN ACCESS REQUIRED - This endpoint requires authentication with an ADMIN role.

Overview

Deletes a category from the system. This performs a soft delete, marking the category with a deleted_at timestamp rather than permanently removing it from the database.

Authentication

This endpoint requires:
  • Valid JWT token in the Authorization header
  • User must have ADMIN role

Request

name
string
required
The name of the category to delete. This is used as the route parameter.

Response

success
boolean
required
Indicates if the request was successful
message
string
required
Success message indicating the category was deleted

Code Examples

curl -X DELETE "https://api.example.com/category/Hardware" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Accept: application/json" \
  -H "Accept-Language: en"

Response Examples

Success Response (200 OK)

{
  "success": true,
  "message": "Category deleted successfully"
}

Not Found Response (404 Not Found)

Returned when the category with the specified name does not exist:
{
  "success": false,
  "message": "Category not found"
}

Unauthorized Response (401 Unauthorized)

{
  "success": false,
  "message": "Unauthenticated"
}

Forbidden Response (403 Forbidden)

Returned when the authenticated user does not have ADMIN role:
{
  "success": false,
  "message": "Unauthorized. Admin access required."
}

Error Codes

Status CodeDescription
200Success - Category deleted
401Unauthorized - Invalid or missing JWT token
403Forbidden - User does not have ADMIN role
404Not Found - Category does not exist
500Internal Server Error

Notes

  • This endpoint performs a soft delete. The category record is not permanently removed from the database
  • Instead, the deleted_at timestamp is set to the current time
  • Soft-deleted categories can potentially be restored by database administrators
  • Associated subcategories and articles may be affected by the deletion
  • Consider checking for dependencies before deleting a category that may be in use

Build docs developers (and LLMs) love