# List conversation messages

> GET https://api.nabrah.ai/api/ext/omni_v2/conversation/conversation/{id}/messages

Group: Conversations. Page: https://www.nabrah.ai/en/docs/api-reference/conversations/list-conversation-messages

Returns a page of messages for the conversation, newest-relevant first, using cursor-based pagination via the `before` query parameter. `meta` carries thread-level context (contact, labels, last-seen timestamps) and `payload` is the array of message objects (content, sender, attachments, message_type, status). This is the canonical way to load and lazily back-fill a long thread's history rather than relying on the messages embedded in the conversation detail response.

## Cursor-based pagination

Use `before` to walk backwards through the thread history.

- **First page**: Call without `before` to get the most recent page of messages.
- **Older pages**: To fetch older messages, take the smallest (oldest) message `id` from the page you just received and pass it as `before` on the next request. Repeat until a page returns no further messages, which means you have reached the start of the thread.

`before` is exclusive — it returns messages older than the supplied message id.

## Authorization

- `X-API-Key` (string, header, required): your workspace API key.

## Path parameters

- `id` (integer, required): Integer id of the conversation whose messages to list. From a list endpoint or `GET.../conversation/{id}`.

## Query parameters

- `before` (integer, optional): Cursor for fetching older messages. Pass the oldest message `id` from the previous page to retrieve messages that precede it. Omit on the first request to start from the most recent messages.

## Response

### 200 Successful Response

Content type: `application/json`

```json
{
  "meta": {
    "labels": [
      "string"
    ],
    "additional_attributes": {},
    "contact": {
      "additional_attributes": {},
      "custom_attributes": {},
      "email": "string",
      "id": 0,
      "identifier": "string",
      "name": "string",
      "phone_number": "string",
      "thumbnail": "string",
      "blocked": false,
      "type": "string"
    },
    "agent_last_seen_at": "string",
    "assignee_last_seen_at": "string"
  },
  "payload": [
    {
      "content": "string",
      "content_attributes": {},
      "content_type": "string",
      "conversation_id": 0,
      "created_at": 0,
      "echo_id": "string",
      "id": 0,
      "inbox_id": 0,
      "message_type": 0,
      "private": false,
      "sender": {
        "id": 0,
        "name": "string",
        "available_name": "string",
        "avatar_url": "string",
        "type": "string"
      },
      "source_id": "string",
      "status": "string",
      "attachments": [
        {
          "id": null,
          "account_id": null,
          "message_id": null,
          "thumb_url": null,
          "data_url": null,
          "file_size": null,
          "file_type": null,
          "extension": null,
          "width": null,
          "height": null,
          "created_at": null,
          "sender": null,
          "coordinates_lat": null,
          "coordinates_lng": null,
          "fallback_title": null,
          "meta": null
        }
      ]
    }
  ]
}
```

### 422 Validation Error

Content type: `application/json`

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
```

## Request examples

### cURL

```bash
curl --request GET \
  --url 'https://api.nabrah.ai/api/ext/omni_v2/conversation/conversation/<id>/messages' \
  --header 'X-API-Key: <your-api-key>'
```

### Python

```python
import requests

url = "https://api.nabrah.ai/api/ext/omni_v2/conversation/conversation/<id>/messages"
headers = {"X-API-Key": "<your-api-key>"}

response = requests.get(url, headers=headers)
response.raise_for_status()
print(response.json())
```

### JavaScript

```javascript
const response = await fetch("https://api.nabrah.ai/api/ext/omni_v2/conversation/conversation/<id>/messages", {
  method: "GET",
  headers: { "X-API-Key": "<your-api-key>" },
});

const data = await response.json();
console.log(data);
```

### Go

```go
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://api.nabrah.ai/api/ext/omni_v2/conversation/conversation/<id>/messages", nil)
	req.Header.Set("X-API-Key", "<your-api-key>")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	out, _ := io.ReadAll(res.Body)
	fmt.Println(string(out))
}
```
