> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwoty.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Category

> Update an existing product category

## Authorization

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication. Format: `Bearer qwoty_your_token`
</ParamField>

## Path Parameters

<ParamField path="id" type="string" required>
  Category UUID
</ParamField>

## Request Body

All fields are optional. Only provided fields will be updated.

<ParamField body="name" type="string">
  Category name
</ParamField>

<ParamField body="description" type="string">
  Category description
</ParamField>

<ParamField body="is_active" type="boolean">
  Active status
</ParamField>

<ParamField body="parent_category_id" type="string">
  UUID of parent category for hierarchical organization. Set to `null` to remove
  parent.
</ParamField>

<Note>
  The `api_name` field is immutable and cannot be updated after creation.
</Note>

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH https://qwoty.app/api/categories/550e8400-e29b-41d4-a716-446655440001 \
    -H "Authorization: Bearer qwoty_your_token" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Updated Electronics",
      "description": "Updated description for electronics",
      "is_active": false
    }'
  ```

  ```bash Update Parent theme={null}
  curl -X PATCH https://qwoty.app/api/categories/550e8400-e29b-41d4-a716-446655440002 \
    -H "Authorization: Bearer qwoty_your_token" \
    -H "Content-Type: application/json" \
    -d '{
      "parent_category_id": "550e8400-e29b-41d4-a716-446655440001"
    }'
  ```

  ```javascript JavaScript theme={null}
  const categoryId = '550e8400-e29b-41d4-a716-446655440001'

  const response = await fetch(`https://qwoty.app/api/categories/${categoryId}`, {
    method: 'PATCH',
    headers: {
      Authorization: 'Bearer qwoty_your_token',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      name: 'Updated Electronics',
      description: 'Updated description for electronics',
      is_active: false,
    }),
  })

  const data = await response.json()
  ```

  ```python Python theme={null}
  import requests

  category_id = '550e8400-e29b-41d4-a716-446655440001'

  response = requests.patch(
      f'https://qwoty.app/api/categories/{category_id}',
      headers={
          'Authorization': 'Bearer qwoty_your_token',
          'Content-Type': 'application/json'
      },
      json={
          'name': 'Updated Electronics',
          'description': 'Updated description for electronics',
          'is_active': False
      }
  )

  data = response.json()
  ```
</CodeGroup>

## Response

<ResponseField name="success" type="boolean">
  Indicates whether the request was successful
</ResponseField>

<ResponseField name="data" type="object">
  Updated category object

  <Expandable title="Category Object">
    <ResponseField name="id" type="string">
      Unique identifier (UUID)
    </ResponseField>

    <ResponseField name="workspace_id" type="string">
      Workspace ID (UUID)
    </ResponseField>

    <ResponseField name="name" type="string">
      Category name
    </ResponseField>

    <ResponseField name="api_name" type="string">
      API identifier (immutable)
    </ResponseField>

    <ResponseField name="description" type="string">
      Category description
    </ResponseField>

    <ResponseField name="is_active" type="boolean">
      Active status
    </ResponseField>

    <ResponseField name="parent_category_id" type="string | null">
      ID of parent category (UUID)
    </ResponseField>

    <ResponseField name="created_at" type="string">
      Creation timestamp (ISO 8601)
    </ResponseField>

    <ResponseField name="updated_at" type="string">
      Last update timestamp (ISO 8601)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json 200 Success theme={null}
  {
    "success": true,
    "data": {
      "id": "550e8400-e29b-41d4-a716-446655440001",
      "workspace_id": "660e8400-e29b-41d4-a716-446655440000",
      "name": "Updated Electronics",
      "api_name": "electronics",
      "description": "Updated description for electronics",
      "is_active": false,
      "parent_category_id": null,
      "created_at": "2026-01-15T10:00:00Z",
      "updated_at": "2026-06-03T14:30:00Z"
    }
  }
  ```
</ResponseExample>

## Error Responses

<ResponseExample>
  ```json 404 Not Found theme={null}
  {
    "success": false,
    "error": "Category not found"
  }
  ```

  ```json 400 Validation Error theme={null}
  {
    "success": false,
    "error": "Validation error",
    "details": ["Field 'api_name' is required when creating a category"]
  }
  ```
</ResponseExample>
