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

# Update Collection

> Update an existing API collection (admin only)

## Authentication

<ParamField header="Authorization" type="string" required>
  Bearer token: `Bearer <admin_token>`
</ParamField>

<Note>
  This endpoint requires admin privileges.
</Note>

## Path Parameters

<ParamField path="collection_id" type="string" required>
  Collection ID (UUID)
</ParamField>

## Request Body

<ParamField body="name" type="string">
  Updated collection name
</ParamField>

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

<ParamField body="openapi_spec" type="object">
  Updated OpenAPI specification
</ParamField>

### Example Request

```bash theme={null}
curl -X PUT https://api.sari-platform.com/api/collections/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer <admin_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Name",
    "description": "Updated description"
  }'
```

## Response

Returns the updated collection object.

```json theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Updated Name",
  "description": "Updated description",
  "updated_at": "2024-01-16T12:00:00Z"
}
```

## What Happens

1. **Collection Updated** - Changes saved to database
2. **Vector Regenerated** - If name/description changed, embedding updated
3. **Cache Invalidated** - All related caches cleared

## Errors

| Status | Description              |
| ------ | ------------------------ |
| 400    | Invalid request body     |
| 401    | Invalid or expired token |
| 403    | Admin access required    |
| 404    | Collection not found     |
