# List a conversation's messages

GET /v1/conversations/{conversationId}/messages. Lists one conversation's messages.

`GET https://api.chatwise.so/v1/conversations/{conversationId}/messages`

Lists one conversation's messages. Deleted and hidden messages are left out.

The API key needs the `messages:read` scope. See [authentication and scopes](https://chatwise.so/docs/authentication.md).

## Example

**curl**:

```bash
curl 'https://api.chatwise.so/v1/conversations/1234/messages?limit=25&from=2026-11-12T00%3A00%3A00Z&order=asc' \
  -H "Authorization: Bearer $CHATWISE_API_KEY"
```

**Node.js**:

```js
const response = await fetch("https://api.chatwise.so/v1/conversations/1234/messages?limit=25&from=2026-11-12T00%3A00%3A00Z&order=asc", {
  headers: {
    Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`,
  },
});
const body = await response.json();
if (!response.ok) throw new Error(`${response.status}: ${body.message}`);
console.log(body.data);
```

**Python**:

```python
import json
import os
import urllib.request

request = urllib.request.Request(
    "https://api.chatwise.so/v1/conversations/1234/messages?limit=25&from=2026-11-12T00%3A00%3A00Z&order=asc",
    headers={
        "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}",
    },
)
with urllib.request.urlopen(request) as response:
    print(json.load(response)["data"])
```

## Path parameters

| Name | Type | Description |
| --- | --- | --- |
| `conversationId` | string | **Required.** The conversation's id. |

## Query parameters

| Name | Type | Description |
| --- | --- | --- |
| `limit` | integer | How many to return, from 1 to 100. Default: `50`. |
| `cursor` | string | The previous page's `pagination.nextCursor`. Repeat the same filters and order with it. At most 512 characters. |
| `from` | string | Only messages at or after this time. ISO 8601 with a time zone, at most milliseconds. |
| `to` | string | Only messages before this time, which must be after `from`. ISO 8601 with a time zone, at most milliseconds. |
| `direction` | string | `inbound` from the customer, `outbound` from the workspace. Leave out for both. |
| `timeField` | string | The time to filter and sort by: `sentAt`, or `ingestedAt` for when Chatwise stored the message. Default: `sentAt`. |
| `order` | string | `desc` for newest first, `asc` for oldest first. Default: `desc`. |

Unknown query parameters are refused with a 400.

## Response

**200.** A page of messages.

```json
{
  "data": [
    {
      "id": "5678",
      "conversationId": "1234",
      "channel": "WHATSAPP",
      "direction": "inbound",
      "type": "text",
      "text": "Is this available in blue?",
      "sentAt": "2026-11-12T09:25:36.000Z",
      "ingestedAt": "2026-11-12T09:25:36.412Z",
      "replyToMessageId": null,
      "attachments": []
    },
    {
      "id": "5680",
      "conversationId": "1234",
      "channel": "WHATSAPP",
      "direction": "outbound",
      "type": "text",
      "text": "Yes, in two shades of blue.",
      "sentAt": "2026-11-12T09:31:02.000Z",
      "ingestedAt": "2026-11-12T09:31:02.350Z",
      "replyToMessageId": null,
      "attachments": []
    }
  ],
  "pagination": {
    "nextCursor": null
  }
}
```

| Field | Type | Description |
| --- | --- | --- |
| `data[].id` | string | The message's id. |
| `data[].conversationId` | string | The conversation the message is in. |
| `data[].channel` | string | The channel the message is on. One of `WHATSAPP`, `INSTAGRAM`, `MESSENGER`, `WEBSITE_CHAT`. |
| `data[].direction` | string | `inbound` from the customer, `outbound` from the workspace. |
| `data[].type` | string | The message's type, such as `text`, `image`, `audio`, `interactive` or `whatsapp_template`. |
| `data[].text` | string or null | The text or caption. For other types, text that Chatwise makes of the message, such as JSON for a location or contacts. Null for WhatsApp authentication templates, so a one-time code is never returned. |
| `data[].sentAt` | string | When the message was sent. ISO 8601, in UTC. |
| `data[].ingestedAt` | string | When Chatwise stored the message. ISO 8601, in UTC. |
| `data[].replyToMessageId` | string or null | The message this one replies to, if any and still visible. |
| `data[].attachments` | array of objects | The message's attachments, at most 10. Always empty on Messenger and Website Chat, and for WhatsApp authentication templates. |
| `data[].attachments[].type` | string | The attachment's type, such as `image`, `video`, `audio` or `document`. |
| `data[].attachments[].mediaId` | string or null | The channel's id for the media, when Chatwise has it: usually on Instagram only. |
| `pagination.nextCursor` | string or null | Send it as `cursor` for the next page. Null on the last page. |

## Errors

| Status | Message | What it means |
| --- | --- | --- |
| 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. |
| 400 | Invalid cursor or cursor does not match this request | The cursor isn't one this route returned, or the filters or order changed since. |
| 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer <API key>`. |
| 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. |
| 401 | Invalid API key | Chatwise couldn't check the key. Try again. |
| 403 | API key does not have the required scope: messages:read | The key lacks the route's scope. Create a key that has it. |
| 404 | Conversation not found | No conversation with this id in the key's workspace. |
| 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. |
| 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. |

The body of an error is described in [errors](https://chatwise.so/docs/errors.md).
