# social.colibri.beta.channel.listMessages

> Published by [colibri.social](https://lexicon.garden/identity/did:plc:mprdjqjluoswa7awzggaggj3)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.beta.channel.listMessages)
- [Documentation](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.beta.channel.listMessages/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.beta.channel.listMessages/examples)

## Definitions

### `social.colibri.beta.channel.listMessages`

**Type**: `query`

Lists messages in a channel, newest first by default. Messages from the repo-backed channel this one was migrated from are included and marked legacy.

#### Parameters

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `limit` | `integer` | No | Maximum number of messages to return. |
| `cursor` | `string` | No | Pagination cursor from a previous call. |
| `channel` | `string` (space-ref) | Yes | The channel to list messages from. |
| `reverse` | `boolean` | No | Whether to return the oldest messages first instead of the newest. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `cursor` | `string` | No | Pagination cursor for the next page. |
| `messages` | `array` | Yes | The channel's messages. |

#### Errors

- **AuthRequired**: The request has no valid service auth.
- **Forbidden**: The requesting user may not read this channel.
- **ChannelNotFound**: No channel matches the given space reference.

## Raw Schema

```json
{
  "id": "social.colibri.beta.channel.listMessages",
  "defs": {
    "main": {
      "type": "query",
      "errors": [
        {
          "name": "AuthRequired",
          "description": "The request has no valid service auth."
        },
        {
          "name": "Forbidden",
          "description": "The requesting user may not read this channel."
        },
        {
          "name": "ChannelNotFound",
          "description": "No channel matches the given space reference."
        }
      ],
      "output": {
        "schema": {
          "type": "object",
          "required": [
            "messages"
          ],
          "properties": {
            "cursor": {
              "type": "string",
              "description": "Pagination cursor for the next page."
            },
            "messages": {
              "type": "array",
              "items": {
                "ref": "social.colibri.beta.channel.defs#messageView",
                "type": "ref"
              },
              "description": "The channel's messages."
            }
          }
        },
        "encoding": "application/json"
      },
      "parameters": {
        "type": "params",
        "required": [
          "channel"
        ],
        "properties": {
          "limit": {
            "type": "integer",
            "default": 50,
            "maximum": 100,
            "minimum": 1,
            "description": "Maximum number of messages to return."
          },
          "cursor": {
            "type": "string",
            "description": "Pagination cursor from a previous call."
          },
          "channel": {
            "type": "string",
            "format": "space-ref",
            "description": "The channel to list messages from."
          },
          "reverse": {
            "type": "boolean",
            "default": false,
            "description": "Whether to return the oldest messages first instead of the newest."
          }
        }
      },
      "description": "Lists messages in a channel, newest first by default. Messages from the repo-backed channel this one was migrated from are included and marked legacy."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
