> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bota.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# List Messages

> Retrieve a session’s messages in chronological order

Retrieve a session's messages, oldest first. Assistant messages carry `citation` parts that deep-link to a `recording_id` + `start_ms`.

## Authentication

Requires an [API key](/authentication). The session is looked up within the key's project; an unknown session returns `404`. An end-user-scoped key can only read its own sessions.

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.bota.dev/v1/ask/sessions/as_abc123/messages?limit=50" \
    -H "Authorization: Bearer sk_live_..."
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.bota.dev/v1/ask/sessions/as_abc123/messages?limit=50',
    { headers: { 'Authorization': 'Bearer sk_live_...' } },
  );

  const { data, has_more, next_cursor } = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.bota.dev/v1/ask/sessions/as_abc123/messages',
      headers={'Authorization': 'Bearer sk_live_...'},
      params={'limit': 50},
  )

  messages = response.json()['data']
  ```
</RequestExample>

## Path Parameters

<ParamField path="id" type="string" required>
  Session identifier (`as_*`).
</ParamField>

## Query Parameters

<ParamField query="limit" type="integer" default="20">
  Maximum number of messages to return (1–100).
</ParamField>

<ParamField query="cursor" type="string">
  Pagination cursor from a previous response's `next_cursor`.
</ParamField>

## Response

Returns a paginated list of messages, oldest first.

<ResponseExample>
  ```json 200 theme={null}
  {
    "data": [
      {
        "id": "msg_111",
        "role": "user",
        "content": "What did I commit to this week?",
        "parts": [{ "type": "text", "text": "What did I commit to this week?" }],
        "tokens": { "input": null, "output": null, "cached": null },
        "model": null,
        "provider": null,
        "finish_reason": null,
        "created_at": "2026-05-20T10:23:40Z"
      },
      {
        "id": "msg_222",
        "role": "assistant",
        "content": "You agreed to send the budget draft by Friday.",
        "parts": [
          { "type": "text", "text": "You agreed to send the budget draft by Friday." },
          { "type": "citation", "recording_id": "rec_ghi789", "start_ms": 754000 }
        ],
        "tokens": { "input": 1240, "output": 32, "cached": 0 },
        "model": "gemini-2.0-flash",
        "provider": "gemini",
        "finish_reason": "stop",
        "created_at": "2026-05-20T10:23:45Z"
      }
    ],
    "has_more": false,
    "next_cursor": null
  }
  ```
</ResponseExample>

## Message Fields

| Field                | Type           | Description                                                                                              |
| -------------------- | -------------- | -------------------------------------------------------------------------------------------------------- |
| `role`               | string         | `user` or `assistant`                                                                                    |
| `content`            | string         | Plain-text message content                                                                               |
| `parts`              | array          | Rich content: `text` segments and (assistant only) `citation` parts (`{ type, recording_id, start_ms }`) |
| `tokens`             | object         | Token usage `{ input, output, cached }`; `null` for user messages                                        |
| `model` / `provider` | string \| null | The model and provider that produced an assistant message                                                |
| `finish_reason`      | string \| null | Why generation stopped (assistant only)                                                                  |
| `created_at`         | string         | Timestamp                                                                                                |
