Skip to main content
GET
/
ai
/
conversation_histories
JavaScript
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": "<string>",
"title": "<string>",
"detail": "<string>",
"meta": {}
}
]
}
{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10007"
}
}
]
}
{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"meta": {}
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

q
string
required

Natural language search query. The text is embedded into a 1024-dimensional vector and compared against indexed record chunks using semantic similarity.

Minimum string length: 1
Example:

"customer called about billing issue"

region
enum<string>

Restrict search to a specific region. When omitted, all regions are queried in parallel (fan-out) and results are merged by similarity score.

Available options:
USA,
DEU,
AUS,
UAE
Example:

"USA"

page[number]
integer
default:1

Page number to return (1-based). Defaults to 1.

Required range: x >= 1
Example:

1

page[size]
integer
default:20

Number of results per page. Defaults to 20, maximum 100.

Required range: 1 <= x <= 100
Example:

10

min_score
number<float>
default:0

Minimum cosine similarity score threshold (0.0 to 1.0). Results below this threshold are excluded.

Required range: 0 <= x <= 1
Example:

0.5

filter[user_id]
string

Filter to records owned by a specific user (exact match).

Example:

"user-123"

filter[record_id]
string

Filter to chunks belonging to a specific parent record (exact match).

Example:

"rec-001"

filter[region][in]
string

Filter by the region stored on the record. Comma-separated to match multiple regions (USA, DEU, AUS, UAE). Distinct from the region parameter, which selects which cluster(s) are queried.

Example:

"USA,DEU"

filter[record_created_at][gte]
string<date-time>

Only include records whose original creation time is on or after this ISO 8601 timestamp.

Example:

"2026-01-01T00:00:00Z"

filter[record_created_at][lte]
string<date-time>

Only include records whose original creation time is on or before this ISO 8601 timestamp.

Example:

"2026-12-31T23:59:59Z"

filter[ingested_at][gte]
string<date-time>

Only include records ingested (chunked, embedded, and indexed) on or after this ISO 8601 timestamp.

Example:

"2026-01-01T00:00:00Z"

filter[ingested_at][lte]
string<date-time>

Only include records ingested (chunked, embedded, and indexed) on or before this ISO 8601 timestamp.

Example:

"2026-12-31T23:59:59Z"

filter[retention]
string

Filter by retention policy (exact match). Filter-only: not returned in the response body.

Response

Successful search response with ranked conversation history chunks.

Search response following the standard Telnyx V2 API format.

data
object[]
required

Ranked list of matching text chunks, sorted by cosine similarity score descending.

meta
object
required

Pagination metadata following the standard Telnyx V2 API format.