List messages in a conversation

GET /v1/replicas/{replicaUUID}/conversations/{conversationUUID}/messages

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 before beforeUUID are returned.
  • When beforeUUID and afterUUID are both specified, the most recent messages before beforeUUID are returned.
  • When afterUUID is specified on its own, the least recent messages after afterUUID are returned.

Headers

Path parameters

Query parameters

  • limit number

    The number of messages to fetch.

    Minimum value is 1, maximum value is 100. Default value is 20.

  • 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.

Responses

  • 200 application/json

    List of messages in the conversation

    Hide response attributes Show response attributes object
    • success boolean Required

      Indicates the status of the request

    • items array[object] Required
      Hide items attributes Show items attributes object
      • uuid string(uuid) Required

        The UUID of the message.

      • createdAt string(date-time) Required

        The date and time the message was created.

      • content string Required

        The content of the message.

      • role string Required

        The role of the message sender.

        Values are user or assistant.

      • source string Required

        The source of the message.

        Values are discord, telegram, embed, web, or telegram_autopilot.

      • replicaUUID string(uuid) Required

        The replica unique identifier (UUID)

    • total number Required
  • 400 application/json

    Bad Request

    Hide response attributes Show response attributes object
    • success boolean Required

      Indicates the status of the request

    • error string Required

      A text representation of the error

    • A unique identifier of the event, useful for reporting

    • request_id string Required

      A unique identifier of the request, useful for reporting

  • 401 application/json

    Unauthorized

    Hide response attributes Show response attributes object
    • success boolean Required

      Indicates the status of the request

    • error string Required

      A text representation of the error

    • A unique identifier of the event, useful for reporting

    • request_id string Required

      A unique identifier of the request, useful for reporting

  • 404 application/json

    Not Found

    Hide response attributes Show response attributes object
    • success boolean Required

      Indicates the status of the request

    • error string Required

      A text representation of the error

    • A unique identifier of the event, useful for reporting

    • request_id string Required

      A unique identifier of the request, useful for reporting

  • 415 application/json

    Unsupported Media Type

    Hide response attributes Show response attributes object
    • success boolean Required

      Indicates the status of the request

    • error string Required

      A text representation of the error

    • A unique identifier of the event, useful for reporting

    • request_id string Required

      A unique identifier of the request, useful for reporting

  • 500 application/json

    Internal Server Error

    Hide response attributes Show response attributes object
    • success boolean Required

      Indicates the status of the request

    • error string Required

      A text representation of the error

    • A unique identifier of the event, useful for reporting

    • request_id string Required

      A unique identifier of the request, useful for reporting

    • The inner exception

      Hide inner_exception attributes Show inner_exception attributes object
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"
  }
}