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

# Update Collection

> Update an existing collection

## Path Parameters

<ParamField path="organizationId" type="string" required>
  Organization ID
</ParamField>

<ParamField path="projectId" type="string" required>
  Project ID
</ParamField>

<ParamField path="id" type="string" required>
  Collection ID
</ParamField>

## Request Body

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

<ParamField body="folderId" type="string">
  New parent folder ID (null for root level)
</ParamField>

### Example Request

```json theme={null}
{
  "name": "Updated Name",
  "folderId": "folder456"
}
```

## Response

Returns the updated Collection object.

```json theme={null}
{
  "id": "coll123",
  "name": "Updated Name",
  "folderId": "folder456",
  "createdAt": "2024-03-20T10:00:00Z",
  "updatedAt": "2024-03-22T10:00:00Z"
}
```

## Error Responses

### Collection Not Found

```json theme={null}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "Collection not found"
  }
}
```

### Circular Reference

```json theme={null}
{
  "error": {
    "code": "CIRCULAR_REFERENCE",
    "message": "Cannot move collection - would create a circular reference"
  }
}
```

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT "https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/collections/coll123" \
    -H "Authorization: Bearer YOUR_JWT" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Updated Name"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/collections/coll123',
    {
      method: 'PUT',
      headers: {
        'Authorization': 'Bearer YOUR_JWT',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        name: 'Updated Name'
      })
    }
  );

  const collection = await response.json();
  console.log(`Updated collection: ${collection.name}`);
  ```
</CodeGroup>
