Endpoints
List conversation messages
Page through a conversation's messages, oldest or newest first
A conversation's messages come from the same tool as the conversation itself, get_conversation_detail, 20 per page. Page forward from the start of the conversation, or send newestFirst to read backward from the latest message, for example to show the last few messages of a long conversation.
POST
https://api.qwryai.com/public/v1/tools/get_conversation_detailAuthentication
Send your API key as Authorization: Bearer <api-key>, or in an x-api-key header. The key needs Manage conversations and helpdesk. See Authentication.
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
chatbotId | string | Yes | The agent's id, from List agents. |
conversationId | string | Yes | The conversation's _id from query_conversations or search_conversations. |
page | integer | Yes | The page of messages, from 1. Each page holds 20. |
newestFirst | boolean | No | true makes page 1 the 20 most recent messages, newest first. |
fullText | boolean | No | true returns whole messages instead of 800-character excerpts. |
Request example
curl -X POST 'https://api.qwryai.com/public/v1/tools/get_conversation_detail' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"chatbotId": "YOUR_AGENT_ID",
"conversationId": "CONVERSATION_RECORD_ID",
"page": 1,
"newestFirst": true
}'async function allMessages(conversationId) {
const messages = [];
for (let page = 1; ; page++) {
const response = await fetch("https://api.qwryai.com/public/v1/tools/get_conversation_detail", {
method: "POST",
headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json" },
body: JSON.stringify({ chatbotId: "YOUR_AGENT_ID", conversationId, page, fullText: true }),
});
const { data } = await response.json();
messages.push(...data.messages);
if (!data.mayHaveMore) return messages;
}
}import requests
def all_messages(conversation_id: str):
messages, page = [], 1
while True:
data = requests.post(
"https://api.qwryai.com/public/v1/tools/get_conversation_detail",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"chatbotId": "YOUR_AGENT_ID", "conversationId": conversation_id,
"page": page, "fullText": True},
).json()["data"]
messages.extend(data["messages"])
if not data["mayHaveMore"]:
return messages
page += 1Response
{
"success": true,
"data": {
"conversation": {
"_id": "CONVERSATION_RECORD_ID",
"conversationId": "fd5ae9e1-9b30-4503-b346-ccd4d7ef16a3",
"channel": "api",
"lifecycle": "open"
},
"page": 1,
"order": "newest_first",
"messages": [
{
"id": "9e2d4b7c-61a3-4f0e-8c5d-2b7a9f1e3c48",
"sender": "ai",
"timestamp": "2026-11-30T19:24:45.362Z",
"content": "Done! Order 1042 will now go to 14 Harbour Street, Wellington.",
"truncated": false
},
{
"id": "7a1c3e5f-2b4d-4f6a-8c9e-0d1f3a5b7c92",
"sender": "user",
"timestamp": "2026-11-30T19:24:40.018Z",
"content": "It's 14 Harbour Street, Wellington.",
"truncated": false
}
],
"mayHaveMore": false
}
}The conversation object is shortened above; it has every field shown in Get a conversation.
| Field | Description |
|---|---|
messages[].id | The message's id. |
messages[].sender | user for the customer, ai for the agent, agent for a teammate. |
messages[].timestamp | When it was sent. |
messages[].content | The text, cut to 800 characters unless you send fullText. |
messages[].truncated | true when content was cut. |
mayHaveMore | true when the page is full, so there may be another. |
Errors
| HTTP status | Code | When |
|---|---|---|
| 400 | INVALID_ARGUMENTS | conversationId isn't a conversation _id, or page is missing. issues lists each one. |
| 400 | CHATBOT_ID_REQUIRED | The body has no valid chatbotId. |
| 401 | API_KEY_REQUIRED / INVALID_API_KEY | No credential, or an unknown, deleted or expired one. |
| 403 | INSUFFICIENT_PERMISSION | The key doesn't hold Manage conversations and helpdesk. |
| 404 | CHATBOT_NOT_FOUND | No agent with that chatbotId in your workspace. |
| 413 | RESULT_TOO_LARGE | The page is over 40,000 bytes. Leave out fullText. |
| 429 | INTEGRATION_RATE_LIMIT_EXCEEDED | More than 2,000 requests in 15 minutes. |
| 500 | TOOL_FAILED | The conversation isn't on this agent, or the tool failed on our side. |
See Error Handling for every code.