Skip to main content
PUT
/
categories
/
:id
curl -X PUT https://api.example.com/categories/1 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Consumer Electronics"
  }'
{
  "id": "1",
  "name": "Consumer Electronics",
  "createdAt": "2024-01-15T10:30:00Z"
}
This endpoint updates an existing category by ID. Requires authentication and admin role.

Authentication

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

Path Parameters

id
string
required
The unique identifier of the category to update

Request Body

name
string
New name for the category (optional)
curl -X PUT https://api.example.com/categories/1 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Consumer Electronics"
  }'

Response

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

Response Fields

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

Error Responses

{
  "message": "Unauthorized"
}

Build docs developers (and LLMs) love