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

# Create a collection

`POST /ai/collections`

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
  - `description` string — Optional description.
  - `name` string, required — Human-readable collection name.
  - `settings` RetrievalSettingsWrapper
    - `record_type` string — Identifies the record type. Always `ai_collection_settings`.
    - `retrieval` RetrievalSettings — How documents are retrieved when searching the collection.
      - `retrieval_type` 'vector' | 'hybrid' | 'keyword' — Retrieval strategy. `vector` runs semantic similarity search; `hybrid` combines vector similarity with keyword matching; `keyword` runs lexical (BM25) matching.
      - `top_k` integer — Number of top results to retrieve (1–50).
  - `slug` string — Optional slug (unique per organization). Derived from `name` when omitted.
  - `sources` SourceRequest[] — Optional sources to attach at creation time.
    - `bucket_id` string — The Telnyx Storage bucket name. Required when `source_type` is `bucket`; ignored otherwise.
    - `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).

## Response `201`

Collection created.

- CollectionEnvelope
  - `data` Collection
    - `created_at` string, date-time
    - `description` string
    - `name` string
    - `record_type` string — Identifies the record type. Always `ai_collection`.
    - `settings` RetrievalSettingsWrapper
      - `record_type` string — Identifies the record type. Always `ai_collection_settings`.
      - `retrieval` RetrievalSettings — How documents are retrieved when searching the collection.
        - `retrieval_type` 'vector' | 'hybrid' | 'keyword' — Retrieval strategy. `vector` runs semantic similarity search; `hybrid` combines vector similarity with keyword matching; `keyword` runs lexical (BM25) matching.
        - `top_k` integer — Number of top results to retrieve (1–50).
    - `slug` string
    - `sources` Source[]
      - `bucket_id` string — The Telnyx Storage bucket name. Present only for `bucket` sources.
      - `collection_id` string, uuid
      - `id` string
      - `record_type` string — Identifies the record type. Always `ai_collection_source`.
      - `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).
      - `status` string
    - `status` string
    - `updated_at` string, date-time
    - `uuid` string, uuid

## 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`).

---

[API](https://skmtc.net/team-telnyx/apis/telnyx-api-2.md) · [All operations](https://skmtc.net/team-telnyx/apis/telnyx-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/team-telnyx/telnyx-api-2/revisions/3fdc16374d70/schema)
