Skip to content

List messages ​

Returns a conversation's messages, newest first, paginated. Covers every message in the thread: the contact's messages (role = user), the AI agent's replies and manual sends (role = assistant).

Use it to read the AI reply after sending a test message, since the reply is generated asynchronously.

GET/api/user/{conversation}/messages
Required scope: conversations:read
Path parameters
integer
Query parameters
integer
integer
curl -X GET "https://loopx-console.test/api/user/89328/messages?per_page=10&page=1" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json"
<?php

use GuzzleHttp\Client;

$client = new Client();
$response = $client->request('GET', 'https://loopx-console.test/api/user/89328/messages?per_page=10&page=1', [
    'headers' => [
        'Authorization' => 'Bearer $TOKEN',
        'Accept'        => 'application/json',
    ]
]);

$data = json_decode($response->getBody(), true);
const res = await fetch('https://loopx-console.test/api/user/89328/messages?per_page=10&page=1', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer $TOKEN',
    Accept: 'application/json'
  }
});

const data = await res.json();

Example response

{
  "status": true,
  "code": 200,
  "validation": [],
  "message": "Messages List",
  "data": {
    "current_page": 1,
    "data": [
      {
        "_id": "68e0f4b9c2b1a9f0d3e5a7c4",
        "role": "assistant",
        "status": "sent_to_user",
        "message": "Hi Ali! Our Pro plan is 499 EGP per month. Would you like a quick demo?",
        "cost_for_user": 0.42,
        "conversation_id": 89328,
        "opportunity_id": 98314,
        "contact_id": 44016,
        "channel_id": 512,
        "stage_id": 189,
        "pipeline_id": 17,
        "call_type": "chat",
        "files": [],
        "stage": {
          "id": 189,
          "name": "Qualification",
          "order": 1,
          "nature": "neutral"
        },
        "created_at": "2026-11-24T10:22:47.000000Z",
        "updated_at": "2026-11-24T10:22:48.000000Z"
      },
      {
        "_id": "68e0f4a3c2b1a9f0d3e5a7b2",
        "role": "user",
        "status": "sent_to_agent",
        "is_test": true,
        "message": "How much is the Pro plan?",
        "conversation_id": 89328,
        "opportunity_id": 98314,
        "contact_id": 44016,
        "channel_id": 512,
        "stage_id": 189,
        "pipeline_id": 17,
        "call_type": "chat",
        "stage": {
          "id": 189,
          "name": "Qualification",
          "order": 1,
          "nature": "neutral"
        },
        "created_at": "2026-11-24T10:22:41.000000Z",
        "updated_at": "2026-11-24T10:22:41.000000Z"
      }
    ],
    "from": 1,
    "last_page": 1,
    "per_page": 10,
    "to": 2,
    "total": 2
  }
}

Path parameters ​

NameTypeRequiredDescription
conversationintegeryesConversation id. Must belong to your workspace (or a workspace you manage)

Query parameters ​

NameTypeDescription
per_pageintegerMessages per page. Default 10
pageintegerPage number. Default 1. Page 1 holds the newest messages

Response ​

data is a paginated list (current_page, per_page, last_page, total, …). Each entry in data.data is a message:

FieldTypeDescription
_idstringMessage id
rolestringuser for the contact's messages, assistant for AI replies and manual sends
statusenumreceived, sent_to_agent, responded_by_agent, sent_to_user, created_manually, stopped, failed
messagestring | nullMessage text
is_testbooleantrue on messages sent through Send a test message
filesobject[]Attachments: path, full_path (signed download URL, valid for 10 minutes), mimetype, type, size
cost_for_usernumberCredits charged for this message (AI replies)
stageobject | nullThe stage the opportunity was in when the message was saved: id, name, order, nature
conversation_id, opportunity_id, contact_id, channel_id, stage_id, pipeline_idintegerRelational context
created_atstringISO-8601 timestamp

Errors ​

CodeWhen
403Token missing conversations:read scope, or the conversation belongs to a different workspace
404Conversation not found