Returns one page of messages in an AI chat conversation, including tool uses and attachments; when searchText is given, only matching messages are returned, with highlightedText marking the matches. Returns 404 if the conversation does not belong to the profile and case. On a case shared with opposing counsel, a profile the caller may not see returns an empty page.
GET
/ai-chat/{caseId}/profile/{providerId}/conversation/{conversationId}/messages
curl \
--request GET 'http://api.example.com/ai-chat/{caseId}/profile/{providerId}/conversation/{conversationId}/messages' \
--header "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
"data": {
"total": 42,
"page": 1,
"perPage": 20,
"skip": 0,
"limit": 20,
"totalPages": 3,
"nextPage": 2,
"previousPage": 42.0,
"data": [
{
"createdAt": "2026-01-15T14:30:00.000Z",
"updatedAt": "2026-01-15T14:30:00.000Z",
"id": "507f1f77bcf86cd799439011",
"aiChatConversation": "65a1b2c3d4e5f6a7b8c9d0e2",
"aiChatProvider": "65a1b2c3d4e5f6a7b8c9d0e2",
"externalId": "msg_01HZX3K9Q2",
"role": "user",
"text": "Summarise clause 4 of the lease in plain English.",
"date": "2026-01-15T14:30:00.000Z",
"senderName": "Jane Doe",
"senderId": "string",
"model": "gpt-4o",
"inputTokens": 38,
"outputTokens": 0,
"toolUses": [
{
"toolName": "web_search",
"toolInput": {
"query": "statute of limitations Illinois"
},
"toolOutput": null,
"toolCallId": "toolu_01A2B3C4D5"
}
],
"attachments": [
{
"fileName": "contract-draft.pdf",
"fileType": "application/pdf",
"fileSize": 48213,
"externalUrl": null,
"userFile": "507f1f77bcf86cd799439011"
}
],
"artifacts": [
"65a1b2c3d4e5f6a7b8c9d0e2"
],
"highlightedText": "Summarise [hl]clause 4[/hl] of the lease in plain English."
}
]
},
"statusCode": 200,
"timestamp": "2026-01-15T10:15:00.000Z"
}