Skip to main content
DELETE
/
categories
/
{id}
Delete Category
curl --request DELETE \
  --url https://api.example.com/categories/{id}
{
  "id": 123,
  "name": "<string>"
}
Delete a category by ID.

Authentication

This endpoint requires authentication with the admin role.
Authorization: Bearer <admin_token>

Path Parameters

id
integer
required
The unique identifier of the category to delete.

Response

Returns the deleted category object.
id
number
The unique identifier of the deleted category.
name
string
The name of the deleted category.

Example Request

curl -X DELETE https://api.example.com/categories/1 \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN"

Example Response

{
  "id": 1,
  "name": "Beverages"
}

Error Responses

400 Bad Request

Returned when the ID parameter is invalid.
{
  "statusCode": 400,
  "message": "Validation failed (numeric string is expected)",
  "error": "Bad Request"
}

401 Unauthorized

Returned when authentication credentials are missing or invalid.
{
  "statusCode": 401,
  "message": "Unauthorized"
}

403 Forbidden

Returned when the user does not have admin role.
{
  "statusCode": 403,
  "message": "Forbidden resource",
  "error": "Forbidden"
}

404 Not Found

Returned when the category with the specified ID does not exist.
{
  "statusCode": 404,
  "message": "Category not found",
  "error": "Not Found"
}

Build docs developers (and LLMs) love