> ## 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 Catalog

> Update an existing catalog

## 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>
  UUID of the catalog to update
</ParamField>

## Request Body

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

<ParamField body="api_name" type="string">
  API identifier
</ParamField>

<ParamField body="reference" type="string">
  Internal reference
</ParamField>

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

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

<ParamField body="id_crm" type="string">
  External CRM ID
</ParamField>

<ParamField body="id_erp" type="string">
  External ERP ID
</ParamField>

<ParamField body="id_accounting" type="string">
  External accounting ID
</ParamField>

## Examples

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

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

  const response = await fetch(`https://qwoty.app/api/catalogs/${catalogId}`, {
    method: 'PATCH',
    headers: {
      Authorization: 'Bearer qwoty_your_token',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      name: 'Updated Catalog Name',
      description: 'Updated description',
    }),
  })

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

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

  catalog_id = '550e8400-e29b-41d4-a716-446655440000'

  response = requests.patch(
      f'https://qwoty.app/api/catalogs/{catalog_id}',
      headers={
          'Authorization': 'Bearer qwoty_your_token',
          'Content-Type': 'application/json'
      },
      json={
          'name': 'Updated Catalog Name',
          'description': 'Updated description'
      }
  )

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

## Response

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

<ResponseField name="data" type="object">
  The updated catalog object with all fields
</ResponseField>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true,
    "data": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Updated Catalog Name",
      "api_name": "updated_catalog_name",
      "reference": "CAT-001",
      "description": "Updated description",
      "is_active": true,
      "id_crm": "crm_123",
      "id_erp": "erp_456",
      "id_accounting": "acc_789",
      "created_at": "2024-12-21T10:30:00Z",
      "updated_at": "2024-12-21T14:45:00Z"
    }
  }
  ```
</ResponseExample>

## Error Responses

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

  ```json Validation Error theme={null}
  {
    "success": false,
    "error": "Validation error",
    "details": {
      "name": "Name must be at least 2 characters"
    }
  }
  ```

  ```json Unauthorized theme={null}
  {
    "success": false,
    "error": "Invalid API token"
  }
  ```
</ResponseExample>
