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

# Create Collection

> Create a collection to hold files for retrieval-augmented chat.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.doctly.ai/api/v1/collections \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"name": "Contracts 2026"}'
  ```
</RequestExample>

**POST** `/api/v1/collections`

A collection is a named set of files you can query with the [Query](/api-reference/chat/query) and [Chat Sessions](/api-reference/chat/create-session) APIs. Collection names are unique within your account.

## Request

<ParamField body="name" type="string" required>
  Display name for the collection. Maximum 255 characters, unique per account.
</ParamField>

## Response

<ResponseField name="id" type="string">
  Unique identifier (UUID) for the collection.
</ResponseField>

<ResponseField name="name" type="string">
  The collection name.
</ResponseField>

<ResponseField name="file_count" type="integer">
  Number of files in the collection.
</ResponseField>

<ResponseField name="total_size" type="integer">
  Combined size of all files, in bytes.
</ResponseField>

```json Response theme={null}
{
  "id": "8f14e45f-ceea-467f-a34e-cbb17b0dbe1b",
  "name": "Contracts 2026",
  "file_count": 0,
  "total_size": 0
}
```

## Errors

| Status | Meaning                                    |
| ------ | ------------------------------------------ |
| `409`  | A collection with this name already exists |
