Create a collection
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.
POST
/
ai
/
collections
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const CollectionEnvelope = await client.ai.collections.create({
name: 'Support Transcripts',
});
console.log(CollectionEnvelope.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
collection_envelope = client.ai.collections.create(
name="Support Transcripts",
)
print(collection_envelope.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
collection, err := client.AI.Collections.New(
context.TODO(),
telnyx.AICollectionNewParams{
Name: "Support Transcripts",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", collection.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.ai.collections.CollectionCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CollectionCreateParams params = CollectionCreateParams.builder()
.name("Support Transcripts")
.build();
var response = client.ai().collections().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
collection_envelope = telnyx.ai.collections.create(name: "Support Transcripts")
puts(collection_envelope)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$collection_envelope = $client->ai->collections->create(
name: 'Support Transcripts',
);
var_dump($collection_envelope);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:collections create \
--api-key 'My API Key' \
--name 'Support Transcripts'curl --request POST \
--url https://api.telnyx.com/v2/ai/collections \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Support Transcripts",
"description": "All customer support voice transcripts.",
"slug": "support-transcripts",
"sources": [
{
"source_type": "voice",
"bucket_id": "policy-docs"
}
],
"settings": {
"retrieval": {
"top_k": 5,
"retrieval_type": "vector"
}
}
}
'{
"data": {
"uuid": "6a09ccbd-8f9b-4c3a-9b0e-2f1d3c4b5a6e",
"slug": "support-transcripts",
"record_type": "ai_collection",
"name": "Support Transcripts",
"description": "All customer support voice transcripts.",
"status": "ready",
"sources": [
{
"id": "source_8vkvtcksnawvbnxq48yv2l06wx",
"record_type": "ai_collection_source",
"collection_id": "6a09ccbd-8f9b-4c3a-9b0e-2f1d3c4b5a6e",
"source_type": "voice",
"bucket_id": "policy-docs",
"status": "ready"
}
],
"settings": {
"record_type": "ai_collection_settings",
"retrieval": {
"top_k": 5,
"retrieval_type": "vector"
}
},
"created_at": "2026-08-04T12:00:00Z",
"updated_at": "2026-08-04T12:00:00Z"
}
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The request failed because it was not well-formed.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "The required authentication headers were either invalid or not included in the request.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "collection_slug_taken",
"title": "Collection slug already in use",
"detail": "A collection with slug 'support-transcripts' already exists for this account.",
"meta": {
"pointer": "/slug"
}
}
]
}{
"errors": [
{
"code": "invalid_source_configuration",
"title": "Invalid source configuration",
"detail": "The bucket_id field is required when source_type is bucket.",
"meta": {
"pointer": "/sources/0/bucket_id"
}
}
]
}Authorizations
Telnyx API key. Collections and results are automatically scoped to the authenticated user's organization.
Body
application/json
Human-readable collection name.
Example:
"Support Transcripts"
Optional description.
Example:
"All customer support voice transcripts."
Optional slug (unique per organization). Derived from name when omitted.
Example:
"support-transcripts"
Optional sources to attach at creation time.
Show child attributes
Show child attributes
Optional retrieval settings.
Show child attributes
Show child attributes
Response
Collection created.
Show child attributes
Show child attributes
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const CollectionEnvelope = await client.ai.collections.create({
name: 'Support Transcripts',
});
console.log(CollectionEnvelope.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
collection_envelope = client.ai.collections.create(
name="Support Transcripts",
)
print(collection_envelope.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
collection, err := client.AI.Collections.New(
context.TODO(),
telnyx.AICollectionNewParams{
Name: "Support Transcripts",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", collection.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.ai.collections.CollectionCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CollectionCreateParams params = CollectionCreateParams.builder()
.name("Support Transcripts")
.build();
var response = client.ai().collections().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
collection_envelope = telnyx.ai.collections.create(name: "Support Transcripts")
puts(collection_envelope)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$collection_envelope = $client->ai->collections->create(
name: 'Support Transcripts',
);
var_dump($collection_envelope);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:collections create \
--api-key 'My API Key' \
--name 'Support Transcripts'curl --request POST \
--url https://api.telnyx.com/v2/ai/collections \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Support Transcripts",
"description": "All customer support voice transcripts.",
"slug": "support-transcripts",
"sources": [
{
"source_type": "voice",
"bucket_id": "policy-docs"
}
],
"settings": {
"retrieval": {
"top_k": 5,
"retrieval_type": "vector"
}
}
}
'{
"data": {
"uuid": "6a09ccbd-8f9b-4c3a-9b0e-2f1d3c4b5a6e",
"slug": "support-transcripts",
"record_type": "ai_collection",
"name": "Support Transcripts",
"description": "All customer support voice transcripts.",
"status": "ready",
"sources": [
{
"id": "source_8vkvtcksnawvbnxq48yv2l06wx",
"record_type": "ai_collection_source",
"collection_id": "6a09ccbd-8f9b-4c3a-9b0e-2f1d3c4b5a6e",
"source_type": "voice",
"bucket_id": "policy-docs",
"status": "ready"
}
],
"settings": {
"record_type": "ai_collection_settings",
"retrieval": {
"top_k": 5,
"retrieval_type": "vector"
}
},
"created_at": "2026-08-04T12:00:00Z",
"updated_at": "2026-08-04T12:00:00Z"
}
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The request failed because it was not well-formed.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "The required authentication headers were either invalid or not included in the request.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "collection_slug_taken",
"title": "Collection slug already in use",
"detail": "A collection with slug 'support-transcripts' already exists for this account.",
"meta": {
"pointer": "/slug"
}
}
]
}{
"errors": [
{
"code": "invalid_source_configuration",
"title": "Invalid source configuration",
"detail": "The bucket_id field is required when source_type is bucket.",
"meta": {
"pointer": "/sources/0/bucket_id"
}
}
]
}