---
title: "Create a collection"
method: POST
path: "/ai/collections"
tags: ["AI Collections"]
---

# Create a collection

`POST /ai/collections`

## Request

- Base URL: `https://api.telnyx.com/v2`
- URL: `https://api.telnyx.com/v2/ai/collections`
- Auth: HTTP bearer

Creates a new collection scoped to your organization. Optionally attach sources and retrieval settings at creation time. If `slug` is omitted, one is derived from `name` and must be unique within your organization.

## Request body

- CreateCollectionRequest
  - `name` string, required: Human-readable collection name.
  - `description` string: Optional description.
  - `slug` string: Optional slug (unique per organization). Derived from `name` when omitted.
  - `sources` SourceRequest[]: Optional sources to attach at creation time.
    - `source_type` 'voice' | 'meeting_bot' | 'message' | 'bucket', required: The type of Telnyx data attached as a source. `bucket` requires an additional `bucket_id`. Only `voice` is searchable today; `meeting_bot`, `message`, and `bucket` attach but are not yet searchable (Coming soon).
    - `bucket_id` string: The Telnyx Storage bucket name. Required when `source_type` is `bucket`; ignored otherwise.
  - `settings` RetrievalSettingsWrapper
    - `record_type` string: Identifies the record type. Always `ai_collection_settings`.
    - `retrieval` RetrievalSettings: How documents are retrieved when searching the collection.
      - `top_k` integer: Number of top results to retrieve (1–50).
      - `retrieval_type` 'vector' | 'hybrid': Retrieval strategy. `vector` runs semantic similarity search; `hybrid` combines vector similarity with keyword matching; `keyword` runs lexical (BM25) matching. `keyword` is not accepted yet: setting it returns 422 `unsupported_retrieval_type`. A collection set to `hybrid` is accepted here but cannot be searched until hybrid execution ships.

## Response `201`

Collection created.

- CollectionEnvelope
  - `data` Collection
    - `uuid` string, uuid
    - `slug` string
    - `record_type` string: Identifies the record type. Always `ai_collection`.
    - `name` string
    - `description` string
    - `status` string
    - `sources` CollectionsSource[]
      - `id` string
      - `record_type` string: Identifies the record type. Always `ai_collection_source`.
      - `collection_id` string, uuid
      - `source_type` 'voice' | 'meeting_bot' | 'message' | 'bucket': The type of Telnyx data attached as a source. `bucket` requires an additional `bucket_id`. Only `voice` is searchable today; `meeting_bot`, `message`, and `bucket` attach but are not yet searchable (Coming soon).
      - `bucket_id` string: The Telnyx Storage bucket name. Present only for `bucket` sources.
      - `status` string
    - `settings` RetrievalSettingsWrapper
      - `record_type` string: Identifies the record type. Always `ai_collection_settings`.
      - `retrieval` RetrievalSettings: How documents are retrieved when searching the collection.
        - `top_k` integer: Number of top results to retrieve (1–50).
        - `retrieval_type` 'vector' | 'hybrid': Retrieval strategy. `vector` runs semantic similarity search; `hybrid` combines vector similarity with keyword matching; `keyword` runs lexical (BM25) matching. `keyword` is not accepted yet: setting it returns 422 `unsupported_retrieval_type`. A collection set to `hybrid` is accepted here but cannot be searched until hybrid execution ships.
    - `created_at` string, date-time
    - `updated_at` string, date-time

## Other responses

- `400`: The request was malformed or failed validation.
- `401`: Missing or invalid authentication.
- `409`: The request conflicts with existing state (e.g. duplicate slug or duplicate source).
- `422`: Validation error -- a `bucket` source without a `bucket_id` (`invalid_source_configuration`), an unknown `source_type` (`invalid_source_type`), an unsupported `retrieval_type` (`unsupported_retrieval_type`), or `top_k` out of range 1-50 (`invalid_top_k`).

## Changes

- **2026-10-21** `67df31283a8a`: 4 breaking, 4 info
  - the `errors/items/code` response's property type changed from `integer` to `string`, and format from `int32` to no format for status `400`
  - the `errors/items/code` response's property type changed from `integer` to `string`, and format from `int32` to no format for status `401`
  - the `errors/items/code` response's property type changed from `integer` to `string`, and format from `int32` to no format for status `409`
  - the `errors/items/code` response's property type changed from `integer` to `string`, and format from `int32` to no format for status `422`
  - …4 more
- **2026-10-15** `a72569d69430`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/team-telnyx/apis/telnyx-api/changes/ai/collections/post.md)

---

[API](https://skmtc.dev/team-telnyx/apis/telnyx-api.md) - [All operations](https://skmtc.dev/team-telnyx/apis/telnyx-api/llms.txt) - [OpenAPI document](https://skmtc.dev/team-telnyx/apis/telnyx-api/revisions/0f17b8167873?raw)
