Skip to main content
GET
Get Chat Messages

Get Chat Messages

This endpoint retrieves paginated messages from a specific chat session. Messages are returned in chronological order and include both user and AI assistant messages.

Authentication

string
required
Authentication header with your tenant’s API key

Path Parameters

string
required
The unique identifier (UUID) of the chat whose messages you want to retrieve

Query Parameters

integer
default:"0"
The number of messages to skip before starting to collect results
integer
default:"50"
The maximum number of messages to return (max 100)
string
default:"asc"
Sort order for messages by creation time. Options: ‘asc’ (oldest first) or ‘desc’ (newest first)

Response

array
Array of message objects from the chat
integer
Total number of messages in this chat
integer
Current offset value used for pagination
integer
Current limit value used for pagination
boolean
Indicates if there are more messages available

Message Object

string
Unique identifier for the message
string
The text content of the message
string
Role of the message sender. Values: ‘user’ or ‘assistant’
string | null
Type of media attachment, if any (e.g., ‘image’, ‘file’)
string | null
URL to the media attachment, if any
string
Timestamp when the message was created
object
Additional metadata associated with the message

Error Responses

Invalid query parameters (e.g., limit exceeds maximum)
Invalid or missing API key
Chat not found or doesn’t belong to your tenant
Server error processing the request

Example Usage

cURL

JavaScript

Python

React Component Example

Pagination Example

To load all messages in a chat, you can implement pagination:

Notes

  • Messages are returned in chronological order when using order=asc (recommended for chat display)
  • Use order=desc to get the most recent messages first
  • The maximum limit is 100 messages per request
  • Empty chats will return an empty messages array with total: 0
  • Media attachments (if any) are referenced via media_url fields
  • Message metadata may contain additional information like AI model details or user context