---
source_url: https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/list
title: List all channels
updated_at: 2026-05-19T12:10:27.521Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# List all channels

Get a paginated list of all channels with `GetChannels()`. Custom channel metadata is included by default.

:::note Requires App Context
Enable [App Context](https://youtu.be/9UEoSlngpYI) for your keyset in the [Admin Portal](https://admin.pubnub.com/). With [Access Manager](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/permissions) enabled, uncheck `Disallow Get All Channel Metadata` in the [App Context configuration](https://www.pubnub.com/docs/general/metadata/basics#configuration) to retrieve all channel metadata without defining permissions in the authentication token.
:::

To list channels a user belongs to, use [GetMemberships()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/membership#get-membership) instead.

### Method signature

This method takes the following parameters:

```csharp
chat.GetChannels(
    string filter = "",
    string sort = "",
    int limit = 0,
    PNPageObject page = null
)
```

#### Input

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| filter | string | Optional | `empty string` | Expression used to filter the results. Returns only these memberships whose properties satisfy the given expression. The filter language is [defined here](https://www.pubnub.com/docs/general/metadata/filtering). |
| sort | string | Optional | `empty string` | Key-value pair of a property to sort by, and a sort direction. Available options are `id`, `name`, and `updated`. Use `asc` or `desc` to specify the sorting direction, or specify `null` to take the default sorting direction (ascending). For example: `{name: "asc"}`. By default, the items are sorted by the last updated date. |
| limit | int | Optional | `0` | Number of objects to return in response. |
| page | PNPageObject | Optional | `null` | Object used for pagination to define which previous or next result page you want to fetch. |

#### Output

| Type | Description |
| --- | --- |
| `Task<ChannelsResponseWrapper>` | An awaitable `Task` with the object containing the filtered, sorted, and paginated list of channels. |

### Sample code

Fetch all existing channel IDs.

```csharp
using System.Threading.Tasks;
using PubnubApi;
using PubnubChatApi;
using UnityEngine;

// Configuration
PubnubChatConfig chatConfig = new PubnubChatConfig();
        
PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId"))
{
    SubscribeKey = "demo",
    PublishKey = "demo",
    Secure = true
};

// Initialize Unity Chat
var chatResult = await UnityChat.CreateInstance(chatConfig, pnConfiguration);
if (!chatResult.Error)
{
    chat = chatResult.Result;
}
// fetch all channels
var channelsWrapper = await chat.GetChannels();

// print all channel IDs
foreach (var channel in channelsWrapper.Channels)
{
    Debug.Log(channel.Id);
}
```

### Other examples

#### Pagination

Get the number of 25 channels and then specify that you want to fetch the results from the next page using a string previously returned from the PubNub server.

```csharp
using System.Threading.Tasks;
using PubnubApi;
using PubnubChatApi;
using UnityEngine;

// Configuration
PubnubChatConfig chatConfig = new PubnubChatConfig();
        
PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId"))
{
    SubscribeKey = "demo",
    PublishKey = "demo",
    Secure = true
};

// Initialize Unity Chat
var chatResult = await UnityChat.CreateInstance(chatConfig, pnConfiguration);
if (!chatResult.Error)
{
    chat = chatResult.Result;
}
// fetch the initial 25 channels
var channelsWrapper = await chat.GetChannels(limit: 25);

Debug.Log("Initial 25 channels:");
foreach (var channel in channelsWrapper.Channels)
{
    Debug.Log($"Id: {channel.Id}");
}

// fetch the next set of channels using the page object from returned wrapper
var nextChannelsWrapper = await chat.GetChannels(limit: 25, page: channelsWrapper.Page);

Debug.Log("\nNext set of channels:");
foreach (var channel in nextChannelsWrapper.Channels)
{
    Debug.Log($"Id: {channel.Id}");
}
```