List chat session history
curl --request GET \
--url http://localhost:8080/chat/sessions/{session_id}/history \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:8080/chat/sessions/{session_id}/history"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:8080/chat/sessions/{session_id}/history', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/chat/sessions/{session_id}/history",
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;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8080/chat/sessions/{session_id}/history"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:8080/chat/sessions/{session_id}/history")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/chat/sessions/{session_id}/history")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"items": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"event": {
"type": "message",
"sender": {
"type": "contact",
"name": "<string>"
},
"content": {
"type": "text",
"text": "<string>"
},
"attachments": [
{
"id": "<string>",
"name": "<string>",
"size": 123,
"type": "<string>",
"url": "<string>"
}
],
"email": {
"to": [
"<string>"
],
"cc": [
"<string>"
],
"from": "<string>"
},
"context": {},
"custom_data": {},
"options": [
{
"id": "<string>",
"label": "<string>",
"type": "text"
}
]
}
}
],
"next": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Sessions
List chat session history
Returns a paginated list of events (messages, handoffs, status changes, etc.) for a chat session.
GET
/
chat
/
sessions
/
{session_id}
/
history
List chat session history
curl --request GET \
--url http://localhost:8080/chat/sessions/{session_id}/history \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:8080/chat/sessions/{session_id}/history"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:8080/chat/sessions/{session_id}/history', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/chat/sessions/{session_id}/history",
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;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8080/chat/sessions/{session_id}/history"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:8080/chat/sessions/{session_id}/history")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/chat/sessions/{session_id}/history")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"items": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"event": {
"type": "message",
"sender": {
"type": "contact",
"name": "<string>"
},
"content": {
"type": "text",
"text": "<string>"
},
"attachments": [
{
"id": "<string>",
"name": "<string>",
"size": 123,
"type": "<string>",
"url": "<string>"
}
],
"email": {
"to": [
"<string>"
],
"cc": [
"<string>"
],
"from": "<string>"
},
"context": {},
"custom_data": {},
"options": [
{
"id": "<string>",
"label": "<string>",
"type": "text"
}
]
}
}
],
"next": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Merge entries
Merged histories remain in their original sessions. The primary and each source receive an internalsession_merged event containing the merge identifier and source/primary links. New customer messages received in a merged source produce a merged_session_message event in the final primary, referencing the original source session and message UUID.
For the Merge sessions workflow action, event.merge.actor.type is workflow, with the workflow ID in event.merge.actor.id and the run ID in event.merge.actor.workflow_run_id. Manual Inbox merges use agent with agentId; direct API merges use api. The events export also includes the workflow and run in its top-level actor and details fields.
These entries are internal to your team. Do not display them in customer-facing transcripts. Fetch the referenced source history to display its current message content; a reference does not make the source contact a recipient of replies sent from the primary.
Paused AI services
When paused AI services hand a session to your team, anai_services_paused event follows its handoff event. An incoming call that rings your team instead of the AI for the same reason gets the ai_services_paused event too. Like the merge entries, it is internal to your team.
Retention erasures
When session retention erases a session, its history gets asession_erased_by_system_due_to_retention_threshold event. Its optional reason says which rule erased it, for example Closed for 30 days or No activity for 90 days. The session’s other messages return [REDACTED] as their content.
This entry is internal to your team. Do not display it in customer-facing transcripts.
Deleted replies
A reply an agent deleted from the inbox is omitted, as are deleted internal notes. The deletion itself is not listed here; the events export records it.Email recipients
Message events with stored email headers include an optionalevent.email object:
{
"email": {
"from": "[email protected]",
"to": ["[email protected]"],
"cc": ["[email protected]"]
}
}
from is the original sender address when available;
to and cc are address arrays and can be empty. The original sender can differ
from the session contact when a connected inbox honors Reply-To.
The object is omitted for non-email messages and messages without stored email
headers, including older imported messages. Missing metadata does not mean the
original email had no recipients. Companion can read these details through its
existing session-history tool.
BCC recipients are not included. Receiving a blind copy does not reveal other
hidden recipients; the original visible To and CC recipients remain useful when
your inbox receives a blind copy.Authorizations
Was this page helpful?