Skip to main content
POST
/
agents
/
session
/
messages
/
list
List agent messages
curl --request POST \
  --url https://api.kaizenautomation.com/agents/session/messages/list \
  --header 'Content-Type: application/json' \
  --data '
{
  "id": "agent_conversation_thread_abc123",
  "limit": 1000,
  "offset": 0
}
'
import requests

url = "https://api.kaizenautomation.com/agents/session/messages/list"

payload = {
"id": "agent_conversation_thread_abc123",
"limit": 1000,
"offset": 0
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({id: 'agent_conversation_thread_abc123', limit: 1000, offset: 0})
};

fetch('https://api.kaizenautomation.com/agents/session/messages/list', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kaizenautomation.com/agents/session/messages/list",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => 'agent_conversation_thread_abc123',
'limit' => 1000,
'offset' => 0
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.kaizenautomation.com/agents/session/messages/list"

payload := strings.NewReader("{\n \"id\": \"agent_conversation_thread_abc123\",\n \"limit\": 1000,\n \"offset\": 0\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.kaizenautomation.com/agents/session/messages/list")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"agent_conversation_thread_abc123\",\n \"limit\": 1000,\n \"offset\": 0\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.kaizenautomation.com/agents/session/messages/list")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"agent_conversation_thread_abc123\",\n \"limit\": 1000,\n \"offset\": 0\n}"

response = http.request(request)
puts response.read_body
{
  "messages": [
    {
      "role": "<string>",
      "parts": [
        {
          "type": "<string>",
          "text": "<string>"
        }
      ]
    }
  ],
  "total": 123
}
{
"error": "<string>"
}
{
"error": "<string>"
}

Body

application/json

Request parameters for listing messages in a thread

id
string
required

External ID of the thread to list messages for

Example:

"agent_conversation_thread_abc123"

limit
integer
default:1000

Maximum number of messages to return (default 1000, max 1000)

Required range: 1 <= x <= 1000
offset
integer
default:0

Number of messages to skip for pagination

Required range: x >= 0

Response

Messages retrieved successfully

Paginated list of messages in a thread

messages
object[]
required

List of messages in the thread

A message in the conversation

total
integer
required

Total number of messages in the thread