---
source_url: https://www.pubnub.com/docs/general/metadata/channel-metadata
title: Channel Metadata
updated_at: 2026-06-05T11:10:36.903Z
---

> 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


# Channel Metadata

:::tip Manage channel data with BizOps Workspace
Use [BizOps Workspace](https://www.pubnub.com/docs/bizops-workspace/channel-management) in the Admin Portal to create, edit, or delete channels and their data. It lists all channels on your app’s keysets.
:::

The App Context service lets you store metadata for channels, [channel memberships](https://www.pubnub.com/docs/general/metadata/membership-metadata), [channel members](https://www.pubnub.com/docs/general/metadata/membership-metadata#channel-member), and users.

Channel metadata has built‑in `name` and `description` fields. You can also add a `custom` object with extra attributes your app needs on the PubNub platform.

###### Extend channel identity with metadata

A [channel](https://www.pubnub.com/docs/general/channels/overview) in PubNub is created implicitly on first publish. Channel metadata lets you attach a persistent identity to that channel, including a human-readable name, description, and custom attributes. This metadata is stored on the PubNub platform alongside your messaging infrastructure and is available through SDKs, the REST API, and [BizOps Workspace](https://www.pubnub.com/docs/bizops-workspace/channel-management).

:::note Illuminate & sensitive data
You can track App Context data in [Illuminate](https://www.pubnub.com/docs/illuminate/basics) for real‑time analytics.
Illuminate uses JSON paths and [mapping](https://www.pubnub.com/docs/illuminate/business-objects/basics#data-mapping) when you create Business Objects. Avoid PII in `custom` fields, such as email addresses, profile URLs, or IP addresses.
:::

## Channel metadata

The App Context service emits events when a channel’s metadata is set or deleted. Your app can receive these events in real time and update the UI.

The next sections show what you can do with channel metadata.

### Set channel metadata

You can set built‑in and custom metadata by providing key/value pairs.

:::tip API limits
To learn about the maximum length of parameters used to set channel metadata, refer to [REST API docs](https://www.pubnub.com/docs/sdks/rest-api/set-channel-metadata).
:::

The code below adds the `name`, `description`, and custom `owner` information to the channel `my_channel`.

###### JavaScript

```javascript
pubnub.objects.setChannelMetadata({
    channel: "my_channel",
    data: {
      name: "main channel",
      description: "This channel is for company wide chatter.",
      custom: { "owner": "johndoe_1" }
    }
});
```

###### Objective-C

```objective-c
self.client.objects().setChannelMetadata(@"my_channel")
    .name(@"main channel")
    .information(@"This channel is for company wide chatter.")
    .custom(@{ @"owner": @"johndoe_1" })
    .includeFields(PNChannelCustomField)
    .performWithCompletion(^(PNSetChannelMetadataStatus *status) {
      if (!status.isError) {
          /**
           * Channel metadata successfully has been set.
           * Channel metadata information available here: status.data.metadata
           */
      } else {
          /**
           * Handle channel metadata update error. Check 'category' property to find out possible
           * issue because of which request did fail.
           *
           * Request can be resent using: [status retry]
           */
      }
    });
```

###### Java

```java
Map<String, Object> custom = new HashMap<>();
custom.put("owner", "johndoe_1");
pubnub.setChannelMetadata()
    .channel("my_channel")
    .name("main channel")
    .description("This channel is for company wide chatter.")
    .custom(custom)
    .includeCustom(true)
    .async(result -> { /* check result */ });
```

###### C#

```csharp
PNResult<PNSetChannelMetadataResult> setChannelMetadataResponse = await pubnub.SetChannelMetadata()
    .Channel("my_channel")
    .Name("main channel")
    .Description("This channel is for company wide chatter.")
    .Custom(new Dictionary<string, object>() { { "owner", "johndoe_1" } })
    .IncludeCustom(true)
    .ExecuteAsync();
PNSetChannelMetadataResult setChannelMetadataResult = setChannelMetadataResponse.Result;
PNStatus status = setChannelMetadataResponse.Status;
```

On success, the SDK returns the same metadata object with status 200. It also fires an `objects` → `channel` → `set` event for other clients. See [Init & Add Listener](https://www.pubnub.com/docs/general/messages/receive).

### Get channel metadata

Provide the channel ID to get its metadata. You can also include custom metadata in the response. The example below returns all metadata for `my_channel`.

#### JavaScript

```javascript
pubnub.objects.getChannelMetadata({
        channel: "my_channel"
});
```

#### Objective-C

```objectivec
self.client.objects().channelMetadata(@"my_channel")
    .includeFields(PNChannelCustomField)
    .performWithCompletion(^(PNFetchChannelsMetadataResult *result, PNErrorStatus *status) {
        if (!status.isError) {
            /**
             * Channel metadata successfully fetched.
             * Channel metadata information available here: result.data.metadata
             */
        } else {
            /**
             * Handle channel metadata fetch error. Check 'category' property to find out possible
             * issue because of which request did fail.
             *
             * Request can be resent using: [status retry]
             */
        }
    });
```

#### Java

```java
pubnub.getChannelMetadata()
    .channel("my_channel")
    .includeCustom(true)
    .async(result -> { /* check result */ });
```

#### C#

```csharp
PNResult<PNGetChannelMetadataResult> getChannelMetadataResponse = await pubnub.GetChannelMetadata()
    .Channel("my_channel")
    .IncludeCustom(true)
    .ExecuteAsync();
PNGetChannelMetadataResult getChannelMetadataResult = getChannelMetadataResponse.Result;
PNStatus status = getChannelMetadataResponse.Status;
```

On success, the PubNub SDK returns the metadata of the specified channel along with status 200.

### Get metadata for all channels

You can get metadata for all channels for the API key. You can choose to include custom metadata. The example below returns all predefined and custom metadata for all channels:

:::warning Required keyset configuration
To get all channel and user metadata, you must uncheck the
Disallow Get All Channel Metadata
and
Disallow Get All User Metadata
checkboxes in the App Context section of your keyset configuration in the
[Admin Portal](https://admin.pubnub.com)
.
:::

###### JavaScript

```javascript
pubnub.objects.getAllChannelMetadata();
```

###### Objective-C

```objectivec
self.client.objects().allChannelsMetadata()
    .start(@"<next from previous request>")
    .includeFields(PNChannelCustomField)
    .performWithCompletion(^(PNFetchAllChannelsMetadataResult *result, PNErrorStatus *status) {
        if (!status.isError) {
            /**
             * Channels metadata successfully fetched.
             * Result object has following information:
             *   result.data.metadata - List of fetched channels metadata.
             *   result.data.next - Random string returned from the server, indicating a specific position in a data set. Used for forward pagination, it fetches the next page, allowing you to continue from where you left off.
             *   result.data.prev - Random string returned from the server, indicating a specific position in a data set. Used for backward pagination, it fetches the previous page, enabling access to earlier data.
             *   result.data.totalCount - Total number of associated channel metadata.
        } else {
            /**
             * Handle channels metadata fetch error. Check 'category' property to find out possible
             * issue because of which request did fail.
             *
             * Request can be resent using: [status retry]
             */
        }
    });
```

###### Java

```java
pubnub.getAllChannelsMetadata()
    .includeCustom(true)
    .async(result -> { /* check result */ });
```

###### C#

```csharp
PNResult<PNGetAllChannelMetadataResult> getAllChannelMetadataResponse = await pubnub.GetAllChannelMetadata()
    .IncludeCustom(true)
    .ExecuteAsync();
PNGetAllChannelMetadataResult getAllChannelMetadataResult = getAllChannelMetadataResponse.Result;
PNStatus status2 = getAllChannelMetadataResponse.Status;
```

On success, the PubNub SDK returns a paginated list of metadata for all channels.

### Remove channel metadata

You can remove all metadata for one channel. The example below removes all metadata for `my_channel`.

:::note Cascading deletes
When you enable [referential integrity](https://www.pubnub.com/docs/general/metadata/basics#configuration) on a keyset in the Admin Portal, deleting a channel also deletes its memberships.
If it’s not enabled, deleting a channel won’t delete related memberships.
:::

###### JavaScript

```javascript
pubnub.objects.removeChannelMetadata({
    channel: "my_channel"
});
```

###### Objective-C

```objectivec
self.client.objects().removeChannelMetadata(@"my_channel")
    .performWithCompletion(^(PNAcknowledgmentStatus *status) {
        if (!status.isError) {
            // Channel metadata successfully removed.
        } else {
            /**
             * Handle channel metadata remove error. Check 'category' property to find out possible
             * issue because of which request did fail.
             *
             * Request can be resent using: [status retry]
             */
        }
    });
```

###### Java

```java
pubnub.removeChannelMetadata()
    .channel("my_channel")
    .async(result -> { /* check result */ });
```

###### C-Sharp

```csharp
PNResult<PNRemoveChannelMetadataResult> removeChannelMetadataResponse = await pubnub.RemoveChannelMetadata()
    .Channel("my_channel")
    .ExecuteAsync();
PNRemoveChannelMetadataResult removeChannelMetadataResult = removeChannelMetadataResponse.Result;
PNStatus status = removeChannelMetadataResponse.Status;
```

On completion, the PubNub SDK will fire the `objects` -> `channel` -> `delete` event so it can be consumed for other clients (users). Refer to [Receive Messages](https://www.pubnub.com/docs/general/messages/receive) to learn more.

## Terms in this document

* **Channel** - A pathway for sending and receiving messages between devices, created automatically when you first use it, that can handle any number of users and messages for different communication needs, like 1-1 text chats, group conversations, and other data streaming.
* **PubNub** - PubNub is a real-time messaging platform that provides APIs and SDKs for building scalable applications. It handles the complex infrastructure of real-time communication, including: Message delivery and persistence, Presence detection, Access control, Push notifications, File sharing, Serverless processing with Functions and Events & Actions, Analytics and monitoring with BizOps Workspace, AI-powered insights with Illuminate.
