Skip to main content
GET
/
api
/
v1
/
user-sessions
/
{user_session_id}
/
agent-sessions
/
{agent_session_id}
/
messages
Get Agent Session Messages
curl --request GET \
  --url https://api.example.com/api/v1/user-sessions/{user_session_id}/agent-sessions/{agent_session_id}/messages \
  --header 'Authorization: Bearer <token>'
{
  "messages": [
    {
      "message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "sender": {
        "kind": "user",
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      },
      "payload": {
        "content": {
          "text": "<string>",
          "type": "text",
          "channel": "<string>",
          "annotations": [
            "<string>"
          ],
          "attachments": [
            {
              "storage_path": "<string>",
              "media_type": "image/jpeg",
              "type": "image",
              "filename": "<string>",
              "size_bytes": 0
            }
          ]
        },
        "version": 0,
        "metadata": {}
      },
      "created_at": "2023-11-07T05:31:56Z",
      "metadata": {},
      "delivery_mode": "queued",
      "delivered_at": "2023-11-07T05:31:56Z",
      "canceled_at": "2023-11-07T05:31:56Z"
    }
  ],
  "has_more": false,
  "next_cursor": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

user_session_id
string
required
agent_session_id
string
required

Query Parameters

limit
integer
default:50

Maximum number of messages to return.

Required range: 1 <= x <= 200
before_id
string | null

Return messages created strictly before this message id.

after_id
string | null

Return messages created strictly after this message id.

Response

Successful Response

Paginated response for session messages.

Returns ALL messages for the session regardless of delivery state. Messages include delivered_at and canceled_at fields so the frontend can filter/display based on message state:

  • Delivered: delivered_at IS NOT NULL
  • Pending: delivered_at IS NULL AND canceled_at IS NULL
  • Canceled: canceled_at IS NOT NULL AND delivered_at IS NULL
messages
MessageEnvelope · object[]
required

List of message envelopes for this page

has_more
boolean
default:false

True if more messages exist beyond this page

next_cursor
string | null

Cursor (message id) to pass as before_id for the next page