List messages in a conversation
Retrieves messages in a specific conversation with cursor-based pagination. Messages are sorted chronologically from oldest to newest.
Use the beforeUUID
parameter to get older messages and the afterUUID
parameter to get newer messages. Please note:
- When
beforeUUID
is specified, the most recent messages beforebeforeUUID
are returned. - When
beforeUUID
andafterUUID
are both specified, the most recent messages beforebeforeUUID
are returned. - When
afterUUID
is specified on its own, the least recent messages afterafterUUID
are returned.
Headers
-
X-API-Version
string Default value is
2025-03-25
.
Path parameters
-
replicaUUID
string(uuid) Required The replica unique identifier (UUID)
-
conversationUUID
string(uuid) Required The conversation UUID.
Query parameters
-
limit
number The number of messages to fetch.
Minimum value is
1
, maximum value is100
. Default value is20
. -
afterUUID
string(uuid) Only show messages after given message UUID. Excludes given message UUID.
-
beforeUUID
string(uuid) Only show messages before given message UUID. Excludes given message UUID.
GET
/v1/replicas/{replicaUUID}/conversations/{conversationUUID}/messages
curl \
--request GET 'https://api.sensay.io/v1/replicas/03db5651-cb61-4bdf-9ef0-89561f7c9c53/conversations/4e162bcb-2a32-4b35-89bf-7cf729a73687/messages' \
--header "X-ORGANIZATION-SECRET: $API_KEY" \
--header "X-USER-ID: $API_KEY" \
--header "X-API-Version: 2025-03-25"
Response examples (200)
{
"success": true,
"items": [
{
"uuid": "03db5651-cb61-4bdf-9ef0-89561f7c9c53",
"createdAt": "2024-09-24T09:09:55.66709+00:00",
"content": "Hello world!",
"role": "user",
"source": "web",
"replicaUUID": "03db5651-cb61-4bdf-9ef0-89561f7c9c53"
}
],
"total": 42.0
}
Response examples (400)
{
"success": true,
"error": "string",
"fingerprint": "14fceadd84e74ec499afe9b0f7952d6b",
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab"
}
Response examples (401)
{
"success": true,
"error": "string",
"fingerprint": "14fceadd84e74ec499afe9b0f7952d6b",
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab"
}
Response examples (404)
{
"success": true,
"error": "string",
"fingerprint": "14fceadd84e74ec499afe9b0f7952d6b",
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab"
}
Response examples (415)
{
"success": true,
"error": "string",
"fingerprint": "14fceadd84e74ec499afe9b0f7952d6b",
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab"
}
Response examples (500)
{
"success": true,
"error": "string",
"fingerprint": "14fceadd84e74ec499afe9b0f7952d6b",
"request_id": "xyz1::reg1:reg1::ab3c4-1234567890123-0123456789ab",
"inner_exception": {
"name": "Server overheated",
"cause": "Request too complicated",
"stack": "Error: Server overheated due to an unexpected situation\n at Object.eval (eval at <anonymous>...",
"message": "The server overheated due to an unexpected situation"
}
}