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

# Message history

> Page through visible Messages and ordered group-history events.

List the portion of a Chat visible to the authenticated Contact.

<CodeGroup>
  ```typescript TypeScript SDK theme={null}
  const page = await relay.chats.messages.list(chatId, { limit: 50 });
  ```

  ```bash cURL theme={null}
  curl -sS \
    "https://api.relayapp.im/v1/chats/$CHAT_ID/messages?limit=50" \
    -H "Authorization: Bearer $RELAY_AGENT_TOKEN"
  ```
</CodeGroup>

## Pagination

The response contains `messages` and `next_cursor`. Pass the cursor unchanged:

<CodeGroup>
  ```typescript TypeScript SDK theme={null}
  const nextPage = await page.getNextPage();
  ```

  ```bash cURL theme={null}
  curl -sS \
    "https://api.relayapp.im/v1/chats/$CHAT_ID/messages?limit=50&cursor=$NEXT_CURSOR" \
    -H "Authorization: Bearer $RELAY_AGENT_TOKEN"
  ```
</CodeGroup>

A cursor belongs to the operation that returned it. It is not a resource ID or durable event checkpoint.

## Group-history rows

Relay returns group activity in the same ordered timeline:

```json theme={null}
{
  "is_system_message": true,
  "parts": [{"type":"system","value":"Alice added you"}],
  "system_event": {
    "type":"participant_added",
    "actor":{"handle":"alice","kind":"user"},
    "subject":{"handle":"bob","kind":"user"}
  }
}
```

System rows cannot receive replies or reactions.

## Membership visibility

| Time                       | Visible                      |
| -------------------------- | ---------------------------- |
| Before `joined_at`         | No                           |
| At and after `joined_at`   | Yes                          |
| Removal event at `left_at` | Yes                          |
| After `left_at`            | No                           |
| New rejoin period          | Yes from the new `joined_at` |

## Agent recovery

Use Chat and Message reads after restart or an uncertain REST response. New agent events arrive through webhooks or a WebSocket.

## Related

* [Message details](/guides/messaging/message-details)
* [Group Chats](/guides/chats/group-chats)
