JavaScript
import Cerca from '@cerca-dev/sdk';
const client = new Cerca({
apiKey: process.env['CERCA_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const message of client.threads.listMessages('agent_abc123', 'thread_abc123')) {
console.log(message.content);
}import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
page = client.threads.list_messages(
agent_id="agent_abc123",
thread_id="thread_abc123",
)
page = page.messages[0]
print(page.content)package main
import (
"context"
"fmt"
"github.com/matrices/cerca-go"
"github.com/matrices/cerca-go/option"
)
func main() {
client := cercago.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Threads.ListMessages(
context.TODO(),
"agent_abc123",
"thread_abc123",
cercago.ThreadListMessagesParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
page = cerca.threads.list_messages("agent_abc123", "thread_abc123")
puts(page)cerca threads list-messages \
--api-key 'My API Key' \
--agent-id agent_abc123 \
--thread-id thread_abc123curl --request GET \
--url https://api.cerca.dev/agents/{agentId}/threads/{threadId}/messages \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/agents/{agentId}/threads/{threadId}/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.cerca.dev/agents/{agentId}/threads/{threadId}/messages")
.header("Authorization", "Bearer <token>")
.asString();{
"cursor": "<string>",
"hasMore": true,
"messages": [
{
"content": [
{
"text": "Hello",
"type": "text"
}
],
"createdAt": "<string>",
"seq": 123
}
]
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}Threads
List thread messages
List a bounded page of transcript messages for a thread, newest first. Use the returned cursor to page older messages.
GET
/
agents
/
{agentId}
/
threads
/
{threadId}
/
messages
JavaScript
import Cerca from '@cerca-dev/sdk';
const client = new Cerca({
apiKey: process.env['CERCA_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const message of client.threads.listMessages('agent_abc123', 'thread_abc123')) {
console.log(message.content);
}import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
page = client.threads.list_messages(
agent_id="agent_abc123",
thread_id="thread_abc123",
)
page = page.messages[0]
print(page.content)package main
import (
"context"
"fmt"
"github.com/matrices/cerca-go"
"github.com/matrices/cerca-go/option"
)
func main() {
client := cercago.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Threads.ListMessages(
context.TODO(),
"agent_abc123",
"thread_abc123",
cercago.ThreadListMessagesParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
page = cerca.threads.list_messages("agent_abc123", "thread_abc123")
puts(page)cerca threads list-messages \
--api-key 'My API Key' \
--agent-id agent_abc123 \
--thread-id thread_abc123curl --request GET \
--url https://api.cerca.dev/agents/{agentId}/threads/{threadId}/messages \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/agents/{agentId}/threads/{threadId}/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.cerca.dev/agents/{agentId}/threads/{threadId}/messages")
.header("Authorization", "Bearer <token>")
.asString();{
"cursor": "<string>",
"hasMore": true,
"messages": [
{
"content": [
{
"text": "Hello",
"type": "text"
}
],
"createdAt": "<string>",
"seq": 123
}
]
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Minimum string length:
1Example:
"agent_abc123"
Minimum string length:
1Example:
"thread_abc123"
Query Parameters
Cursor returned by a previous thread messages response.
Pattern:
^\d+$Example:
"42"
Optional fleet id for index-backed authorization.
Maximum number of messages to include, capped at 500.
Pattern:
^\d+$Example:
"100"
⌘I