Pull the full conversation transcript for any chat session in your AVCodex agent. Useful for logging conversations, syncing chat data to your CRM or PM tool, or building analytics on top of your AVCodex agent.
Note: This endpoint uses the same API key as the Chat Completions API. Find your key in the Share tab of your agent.
GET https://app.avcodex.com/api/v1/chat/transcript/{sessionId}
Include your agent's API key as a Bearer token:
Authorization: Bearer YOUR_API_KEY
This is the same API key used for the Chat Completions API. Both your test and live API keys are accepted.
| Parameter | Type | Required | Description |
|---|---|---|---|
sessionId |
string (UUID) | Yes | The chat session ID to retrieve. |
curl https://app.avcodex.com/api/v1/chat/transcript/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer YOUR_API_KEY"
Success (200)#
{
"sessionId": "550e8400-e29b-41d4-a716-446655440000",
"title": "Boardroom 4 commissioning Q&A",
"messageCount": 6,
"userMessageCount": 3,
"botMessageCount": 3,
"messages": [
{
"role": "user",
"content": "Hi, I have a question about the Q-SYS Core firmware in Boardroom 4.",
"timestamp": "2026-01-15T10:30:00.000Z"
},
{
"role": "assistant",
"content": "Happy to help. What firmware version is currently loaded?",
"timestamp": "2026-01-15T10:30:02.000Z"
}
],
"createdAt": "2026-01-15T10:29:55.000Z",
"updatedAt": "2026-01-15T10:35:12.000Z"
}
Response fields#
| Field | Type | Description |
|---|---|---|
sessionId |
string | The chat session ID. |
title |
string | Auto-generated session title (may be null). |
messageCount |
number | Total number of messages. |
userMessageCount |
number | Number of user messages. |
botMessageCount |
number | Number of assistant messages. |
messages |
array | Ordered list of messages. |
messages[].role |
string | "user" or "assistant". |
messages[].content |
string | The message text. |
messages[].timestamp |
string | ISO 8601 timestamp. |
createdAt |
string | When the session was created. |
updatedAt |
string | When the session was last updated. |
Authentication failed (401)#
{ "error": "Missing API key" }
No Authorization header provided.
{ "error": "Invalid API key" }
The API key is incorrect or does not belong to any agent.
Session not found (404)#
{ "error": "Session not found" }
The session ID does not exist or does not belong to your agent. For security, the same error is returned in both cases.
Server error (500)#
{ "error": "Failed to fetch session" }
Webhook integration#
If your AVCodex agent uses a Custom Action to send data to a webhook, include the session ID in the webhook payload and fetch the full transcript from your backend:
# Your webhook handler receives the session ID
session_id = webhook_payload["chatSessionId"]
# Fetch the full transcript
import requests
response = requests.get(
f"https://app.avcodex.com/api/v1/chat/transcript/{session_id}",
headers={"Authorization": "Bearer YOUR_API_KEY"}
)
transcript = response.json()
# Store or process the transcript
for message in transcript["messages"]:
print(f"{message['role']}: {message['content']}")
CRM sync#
After a conversation ends, fetch the transcript and attach it to a contact record in your CRM (HubSpot, Salesforce, ConnectWise):
const response = await fetch(
`https://app.avcodex.com/api/v1/chat/transcript/${sessionId}`,
{
headers: { Authorization: `Bearer ${process.env.AVCODEX_API_KEY}` },
}
);
const { messages, messageCount } = await response.json();
// Format for a CRM note
const note = messages
.map((m) => `${m.role === "user" ? "Tech" : "Agent"}: ${m.content}`)
.join("\n\n");
- Each API key is scoped to a single agent. You can only retrieve transcripts for sessions that belong to your agent.
- Attempting to access a session from a different agent returns a
404(not403) to avoid leaking information about session existence. - Both test and live API keys are accepted.
*AVCodex · Your AV expertise. Amplified by AI.*