---
docId: doc_425232661b36408fb54f3068595536ff
title: List messages
description: Read the visible history of a conversation, page by page, newest or oldest first.
version: v2
versionGroup: conversations-messages
api:
  group: conversaciones
  auth: bearer
  operations:
    - operationId: listConversationMessagesV2
      method: GET
      path: '/v2/conversations/{conversationId}/messages'
      postmanName: List Conversation Messages
---

<script>
  import { Ways, Note, Collapsible } from '$lib/components';
</script>

# List messages

Get one page of the messages of a conversation, newest first by default. Only what the contact and the brand wrote is listed: system events, tool calls and empty messages never appear.

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl "https://api.platic.ai/v2/conversations/$CONVERSATION_ID/messages?limit=20&include=agents,members" \
  -H "Authorization: Bearer $PLATIC_API_KEY"
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
const page = await platic.conversations.messages.list("8Yc2kQ1mZ0rTq4Lp7WvX", {
  limit: 20,
  include: ["agents", "members"],
});
for (const message of page.data) console.log(message.sender?.type, message.content);

// The whole history, oldest first
for await (const message of platic.conversations.messages.iterate("8Yc2kQ1mZ0rTq4Lp7WvX", { sortDirection: "asc" })) {
  console.log(message.createdAt, message.content);
}
```

`iterate` follows `nextPageToken` until it is `null`; use `list` when you need each page's `included`.

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `conversationId` | string | The conversation's `id`. Never a phone number or the old V1 `conversationId` key | ✓ |

## Query parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `fields` | string | Fields to return, comma-separated. Replaces the default fields; `id` is always returned |
| `include` | string | Relations to resolve once per page in `included`: `agents`, `members` |
| `limit` | integer | Messages per page, from `1` to `100`. Default: `20` |
| `pageToken` | string | The `nextPageToken` of the previous page |
| `sortBy` | string | `createdAt`, the only order. Default: `createdAt` |
| `sortDirection` | string | `desc` (default) returns the latest messages first; `asc` starts from the first one |
| `workspace` | string | The workspace to read, for an API key that covers several. Other credentials always read their own workspace |

## Fields

Without `fields`, each message has:

```text
id, createdAt, role, sender, contentType, content, attachments
```

`fields` replaces the defaults. An unknown field answers `400 INVALID_FIELD` with the accepted names in `details.allowed`.

| Field | Type | Description |
|-------|------|-------------|
| `id` | string | ID of the message in Platica. Always present. It is never the provider's ID |
| `createdAt` | string \| null | When the message was created, ISO 8601 in UTC |
| `role` | string | `user` (the contact) or `assistant` (the brand) |
| `sender` | object | Who wrote it. See [Who wrote each message](#who-wrote-each-message) |
| `contentType` | string \| null | `text`, `image`, `audio`, `video`, `document`, `email` or `interactive`. A message without text takes the type of its first attachment |
| `content` | string \| null | Visible text. On email, the plain text, never the HTML |
| `attachments` | object[] | Files of the message, each once: `{ type, url, mimeType, name }`. `type` is `image`, `audio`, `video` or `document`; `mimeType` and `name` can be `null` |
| `direction` | string \| null | `incoming` (to the brand) or `outgoing` (from the brand) |
| `deliveryStatus` | string \| null | Delivery state: `queued`, `sent`, `delivered`, `received`, `failed`… |
| `updatedAt` | string \| null | Last change of the message, ISO 8601 |
| `providerMessageId` | string \| null | ID the provider (WhatsApp, Meta…) gave the message, when known |
| `email` | object | Only on email messages: subject, addresses and references. Left out on other messages. See [the `email` block](/api-reference/conversations/message#the-email-block) |

<Note type="tip">

Attachment URLs can expire. To get a fresh URL, read the message again with [Get a message](/api-reference/conversations/message).

</Note>

## Who wrote each message

`role` only says which side wrote: `user` is the contact and `assistant` is the brand. `sender` says who wrote it, based on what Platica recorded when the message was sent:

| `sender.type` | Who | `sender.id` |
|---------------|-----|-------------|
| `contact` | The contact | The contact's ID (`/v1/clients/{id}`), or `null` |
| `agent` | An AI agent | The agent's ID |
| `member` | A person on your team | The team member's ID |
| `brand` | The brand, when the author was not recorded | Not present |

`role: "assistant"` alone does not mean an agent wrote the message: a person on your team also writes as `assistant`.

With `include=agents` and `include=members`, `included.agents` and `included.members` give the name of each agent and team member that wrote on the page (members also carry `email`). A record that cannot be found keeps its ID with `"resolved": false`. An unknown relation answers `400 INVALID_INCLUDE`.

## Response

```json
{
  "status": "success",
  "data": [
    {
      "id": "msg_9a2Fq7",
      "createdAt": "2026-11-30T18:00:00.000Z",
      "role": "assistant",
      "sender": { "type": "member", "id": "usr_ana" },
      "contentType": "text",
      "content": "The refund for order 1042 was approved.",
      "attachments": []
    },
    {
      "id": "msg_9a2Fp1",
      "createdAt": "2026-11-30T17:58:00.000Z",
      "role": "user",
      "sender": { "type": "contact", "id": "cl_3h7Jt9Q2" },
      "contentType": "image",
      "content": null,
      "attachments": [
        { "type": "image", "url": "https://files.example.com/receipt.jpg", "mimeType": "image/jpeg", "name": "receipt.jpg" }
      ]
    }
  ],
  "included": {
    "agents": [],
    "members": [{ "id": "usr_ana", "name": "Ana López", "email": "ana@acme.com", "resolved": true }]
  },
  "nextPageToken": "eyJ2IjoyLCJyIjoibWVzc2FnZXMifQ...",
  "pagination": { "limit": 20, "returnedCount": 2, "hasMore": true },
  "meta": {
    "fields": ["id", "createdAt", "role", "sender", "contentType", "content", "attachments"],
    "include": ["agents", "members"],
    "requestId": "req_7f3d",
    "history": "current"
  }
}
```

| Field | Description |
|-------|-------------|
| `data` | The messages of this page, in the requested order |
| `included` | Agents and team members that wrote on the page, only when you sent `include` |
| `nextPageToken` | Token of the next page; `null` on the last one |
| `pagination` | `limit`, `returnedCount` and `hasMore` (always the same as `nextPageToken !== null`) |
| `meta.fields`, `meta.include` | Fields and relations applied |
| `meta.history` | `current`, or `legacy` for some older conversations whose history is stored the old way. Their message IDs look like `legacy_12` |

## Pagination

- Messages are ordered by creation date, and by message ID when two share the same date. The order does not change between pages.
- A page can be shorter than `limit`, or even empty, and still have a token: events and tool calls are skipped. Keep going until `nextPageToken` is `null`.
- A token works only for the same conversation, workspace and sort order. Otherwise the API answers `400 INVALID_CURSOR`. You can change `limit`, `fields` and `include` between pages.

## Errors

| Status | `details.code` | When it happens |
|--------|----------------|-----------------|
| `400` | `INVALID_REQUEST` | A query parameter is invalid, for example `limit` above `100`. `details.issues` says which |
| `400` | `INVALID_FIELD` | A name in `fields` does not exist. `details.allowed` lists the accepted ones |
| `400` | `INVALID_INCLUDE` | A name in `include` does not exist. `details.allowed` lists the accepted ones |
| `400` | `INVALID_CURSOR` | The `pageToken` belongs to another conversation, workspace or sort order. Start again without it |
| `401` | `UNAUTHENTICATED` | The credential is missing or invalid |
| `403` | `FORBIDDEN` | The credential has no access to conversations in this workspace |
| `404` | `CONVERSATION_NOT_FOUND` | No conversation has this `id`, or the credential cannot read it |
| `404` | `NOT_A_CONVERSATION` | The ID belongs to a comment post you can read. `details.href` says where to read it |

The general error format is in [Errors](/api-reference/errors).
