List messages page
Gets the messages from a chat by its ID.
GET https://api.cogfy.com/collections/:collectionId/chats/:chatId/messages
Path params
collectionId
: The ID of the collection that has the record to be found.chatId
: The ID of the chat to be found.
Query params
pageNumber
: The page number to retrieve. Starts at 0. Defaults to 0.pageSize
: The number of results per page. Defaults to 10.roles
: An array of the message roles to filter by ('system'
|'user'
|'assistant'
|'tool'
).sendDateOrderBy
: The sorting direction by date ('asc'
|'desc'
). Defaults to'asc'
.
Response body
pageNumber
: The number of the current page of messages. Starts at 0.pageSize
: The number of results per page.totalSize
: The total number of messages on the chat.data
: An array of the message objects.
Example JSON response
{
"data": [
{
"role": "assistant",
"content": "How can I help you?",
"sendDate": "2025-05-06T17:17:36.087Z"
},
{
"role": "user",
"content": "I want to learn more about Cogfy!",
"sendDate": "2025-05-06T17:18:37.087Z"
}
],
"pageNumber": 0,
"pageSize": 10,
"totalSize": 2,
}