Search conversation histories
Performs semantic vector search across conversation history records.
How it works:
- The query text is embedded into a 1024-dimensional vector using the multilingual-e5-large model.
- The vector is compared against indexed record chunks using semantic similarity search.
- When no region is specified, all regions are queried in parallel (fan-out) and results are merged by score.
- Results are ranked by similarity score (descending) and paginated via
page[number]/page[size].
Authentication: Requires a Telnyx API key via Authorization: Bearer <key>. Results are automatically scoped to the caller’s organization — organization_id is injected from the auth token and cannot be overridden.
Chunking: Records are split into chunks of up to 480 tokens with 64-token overlap at ingestion time. Each search result represents a single chunk, with chunk_index and chunk_total indicating its position within the original record.
Filtering: Use filter[field][operator]=value query parameters to narrow results before vector search.
Top-level filterable fields: user_id, region, record_id, record_created_at, ingested_at, retention
Note: retention is filter-only — it can be used to narrow results but is not returned in the response body.
Metadata fields: any field not in the list above is resolved to data.metadata.<field> (e.g., filter[language]=en → data.metadata.language).
Supported filter operators:
eq— exact match (default when no operator specified)in— match any of comma-separated valuesgte,gt,lte,lt— range comparisons (useful for date filtering)contains— wildcard substring match
Examples:
GET /v2/ai/conversation_histories?q=billing+issue&page[size]=10GET /v2/ai/conversation_histories?q=setup+guide®ion=USA&min_score=0.5GET /v2/ai/conversation_histories?q=refund&filter[record_created_at][gte]=2026-01-01T00:00:00ZGET /v2/ai/conversation_histories?q=outage&filter[region][in]=USA,DEUGET /v2/ai/conversation_histories?q=hold+time&filter[language]=en
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.ai.searchConversationHistories({
q: 'customer called about billing issue',
});
console.log(response.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
)
response = client.ai.search_conversation_histories(
q="customer called about billing issue",
)
print(response.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"),
)
response, err := client.AI.SearchConversationHistories(context.TODO(), telnyx.AISearchConversationHistoriesParams{
Q: "customer called about billing issue",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.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.AiSearchConversationHistoriesParams;
import com.telnyx.sdk.models.ai.AiSearchConversationHistoriesResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
AiSearchConversationHistoriesParams params = AiSearchConversationHistoriesParams.builder()
.q("customer called about billing issue")
.build();
AiSearchConversationHistoriesResponse response = client.ai().searchConversationHistories(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.ai.search_conversation_histories(q: "customer called about billing issue")
puts(response)<?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 {
$response = $client->ai->searchConversationHistories(
q: 'customer called about billing issue',
filterIngestedAtGte: new \DateTimeImmutable('2026-01-01T00:00:00Z'),
filterIngestedAtLte: new \DateTimeImmutable('2026-12-31T23:59:59Z'),
filterRecordCreatedAtGte: new \DateTimeImmutable('2026-01-01T00:00:00Z'),
filterRecordCreatedAtLte: new \DateTimeImmutable('2026-12-31T23:59:59Z'),
filterRecordID: 'rec-001',
filterRegionIn: 'USA,DEU',
filterRetention: 'filter[retention]',
filterUserID: 'user-123',
minScore: 0.5,
pageNumber: 1,
pageSize: 10,
region: 'USA',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai search-conversation-histories \
--api-key 'My API Key' \
--q 'customer called about billing issue'curl --request GET \
--url https://api.telnyx.com/v2/ai/conversation_histories \
--header 'Authorization: Bearer <token>'{
"data": [
{
"id": "rec-001_chunk_0",
"record_id": "rec-001",
"chunk_index": 0,
"chunk_total": 3,
"text": "Customer called regarding a billing discrepancy on their latest invoice. Agent confirmed the charge was correct and explained the prorated amount.",
"score": 0.92,
"region": "USA",
"user_id": "user-123",
"organization_id": "org-456",
"record_created_at": "2026-05-28T12:00:00Z",
"ingested_at": "2026-05-28T12:01:00Z",
"metadata": {
"source": "call-center",
"language": "en"
}
}
],
"meta": {
"total_pages": 1,
"total_results": 1,
"page_number": 1,
"page_size": 20
}
}{
"errors": [
{
"code": "400",
"title": "Bad Request",
"detail": "Invalid region: invalid. Must be one of: USA, DEU, AUS, UAE"
}
]
}{
"errors": [
{
"code": "10004",
"title": "Authentication failed",
"detail": "The required authentication headers were either invalid or not included in the request."
}
]
}{
"errors": [
{
"code": "10027",
"title": "Unprocessable Entity",
"detail": "The server understood the syntax of the request but was unable to process the instructions."
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10007"
}
}
]
}{
"errors": [
{
"code": "10037",
"title": "Service unavailable",
"detail": "Service is unavailable."
}
]
}Authorizations
Query Parameters
Response
Successful search response with ranked conversation history chunks.
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.ai.searchConversationHistories({
q: 'customer called about billing issue',
});
console.log(response.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
)
response = client.ai.search_conversation_histories(
q="customer called about billing issue",
)
print(response.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"),
)
response, err := client.AI.SearchConversationHistories(context.TODO(), telnyx.AISearchConversationHistoriesParams{
Q: "customer called about billing issue",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.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.AiSearchConversationHistoriesParams;
import com.telnyx.sdk.models.ai.AiSearchConversationHistoriesResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
AiSearchConversationHistoriesParams params = AiSearchConversationHistoriesParams.builder()
.q("customer called about billing issue")
.build();
AiSearchConversationHistoriesResponse response = client.ai().searchConversationHistories(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.ai.search_conversation_histories(q: "customer called about billing issue")
puts(response)<?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 {
$response = $client->ai->searchConversationHistories(
q: 'customer called about billing issue',
filterIngestedAtGte: new \DateTimeImmutable('2026-01-01T00:00:00Z'),
filterIngestedAtLte: new \DateTimeImmutable('2026-12-31T23:59:59Z'),
filterRecordCreatedAtGte: new \DateTimeImmutable('2026-01-01T00:00:00Z'),
filterRecordCreatedAtLte: new \DateTimeImmutable('2026-12-31T23:59:59Z'),
filterRecordID: 'rec-001',
filterRegionIn: 'USA,DEU',
filterRetention: 'filter[retention]',
filterUserID: 'user-123',
minScore: 0.5,
pageNumber: 1,
pageSize: 10,
region: 'USA',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai search-conversation-histories \
--api-key 'My API Key' \
--q 'customer called about billing issue'curl --request GET \
--url https://api.telnyx.com/v2/ai/conversation_histories \
--header 'Authorization: Bearer <token>'{
"data": [
{
"id": "rec-001_chunk_0",
"record_id": "rec-001",
"chunk_index": 0,
"chunk_total": 3,
"text": "Customer called regarding a billing discrepancy on their latest invoice. Agent confirmed the charge was correct and explained the prorated amount.",
"score": 0.92,
"region": "USA",
"user_id": "user-123",
"organization_id": "org-456",
"record_created_at": "2026-05-28T12:00:00Z",
"ingested_at": "2026-05-28T12:01:00Z",
"metadata": {
"source": "call-center",
"language": "en"
}
}
],
"meta": {
"total_pages": 1,
"total_results": 1,
"page_number": 1,
"page_size": 20
}
}{
"errors": [
{
"code": "400",
"title": "Bad Request",
"detail": "Invalid region: invalid. Must be one of: USA, DEU, AUS, UAE"
}
]
}{
"errors": [
{
"code": "10004",
"title": "Authentication failed",
"detail": "The required authentication headers were either invalid or not included in the request."
}
]
}{
"errors": [
{
"code": "10027",
"title": "Unprocessable Entity",
"detail": "The server understood the syntax of the request but was unable to process the instructions."
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10007"
}
}
]
}{
"errors": [
{
"code": "10037",
"title": "Service unavailable",
"detail": "Service is unavailable."
}
]
}