---
schema_version: "1"
id: f443c7b1c0c21d94c1f6934eed2248f9f109d1d841b1792fc2d43e006eb33331
title: PlatformEventChannel
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_platformeventchannel.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_platformeventchannel.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 8ea1978a5f406c434a326a4710dae2f1b7d000524bf826835e7ae6a07354ae42
description: Represents a channel that you can subscribe to in order to receive a stream of events. In API version 46.0 and earlier, it is the default standard channel for change data capture events. In API version 47.0 and later, it is a custom channel for change data capture events.
---
# PlatformEventChannel

Represents a channel that you can subscribe to in order to receive a stream of events. In API version 46.0 and earlier, it is the default standard channel for change data capture events. In API version 47.0 and later, it is a custom channel for change data capture events.

The default standard channel corresponds to the entity selection in the Change Data Capture page in Setup. A custom channel is a channel that you define using this metadata type. Starting in API version 47.0, the channel doesn’t contain the selected entities, which are represented each by PlatformEventChannelMember. This type extends the [Metadata](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/metadata.htm "The base class for all metadata types. You can’t edit this object. A component is an instance of a metadata type.") metadata type and inherits its fullName field.

## File Suffix and Directory Location

PlatformEventChannel components have the suffix .platformEventChannel and are stored in the platformEventChannels folder.

## Version

PlatformEventChannel components are available in API version 45.0 and later.

## Special Access Rules

You must have the Customize Application permission to deploy and retrieve this type.

## Fields

<table class="featureTable sort_table" summary="">



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d749625e105">Field Name</th>

              <th class="featureTableHeader  " id="d749625e108">Field Type</th>

              <th class="featureTableHeader  " id="d749625e111">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d749625e105" data-title="Field Name"><span class="keyword parmname">channelMembers</span></td>

              <td class="entry" headers="d749625e108" data-title="Field Type">
                <a class="xref" href="#PlatformEventChannelSelectedEntity">PlatformEventChannel​SelectedEntity</a>[]
              </td>

              <td class="entry" headers="d749625e111" data-title="Description">Removed. A list of event names of entities, including standard
                and custom objects, selected for Change Data Capture
                notifications.<div class="box message info">
                  <div class="inner">
                    <div class="bd">
                      <div class="media">
                        <img class="img mtm" src="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note.png" alt="Note">
                        <div class="mediaBd">
                          <h4 class="mbs">Note</h4>
                          <p>This field is removed in API version 47.0
                            and later and is available only in API versions 45.0 and 46.0.
                            In API version 47.0 and later, the channel members are each
                            defined in a PlatformEventChannelMember
                            component.</p>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d749625e105" data-title="Field Name"><span class="keyword parmname">channelType</span></td>

              <td class="entry" headers="d749625e108" data-title="Field Type">PlatformEventChannel​Type (enumeration of type
                string)</td>

              <td class="entry" headers="d749625e111" data-title="Description">Required. The channel type. Valid values are: <ul class="ul bulletList">
                  <li class="li">
                    <samp class="codeph nolang">data</samp>—Change Data
                    Capture channel corresponding to the selected entities.
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">event</samp>—A channel
                    that contains platform events.
                  </li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d749625e105" data-title="Field Name"><span class="keyword parmname">eventType</span></td>

              <td class="entry" headers="d749625e108" data-title="Field Type">PlatformEventChannel​EventType (enumeration of type
                string)</td>

              <td class="entry" headers="d749625e111" data-title="Description">The type of events that the channel can hold. A channel can hold
                only one type of events. Use this field to optionally specify a
                specific type of events for a channel in combination with the
                <span class="keyword parmname">channelType</span> field. Valid values are: <ul class="ul bulletList">
                  <li class="li">
                    <samp class="codeph nolang">custom</samp>—The
                    channel contains custom platform events. This value is valid
                    with the <span class="keyword parmname">channelType</span> of <samp class="codeph nolang">event</samp>.
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">data</samp>—The channel
                    contains change data capture events. This value is valid
                    with the <span class="keyword parmname">channelType</span> of <samp class="codeph nolang">data</samp>.
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">monitoring</samp>—The
                    channel contains Real-Time Event Monitoring events. This
                    value is valid with the <span class="keyword parmname">channelType</span> of
                    <samp class="codeph nolang">event</samp>.
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">standard</samp>—Reserved for internal use.
                  </li>

                </ul>
                <p class="p">Available in API version 61.0 and later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d749625e105" data-title="Field Name"><span class="keyword parmname">label</span></td>

              <td class="entry" headers="d749625e108" data-title="Field Type">string</td>

              <td class="entry" headers="d749625e111" data-title="Description">Required. The channel label.</td>

            </tr>

          </tbody>

        </table>

## PlatformEventChannelSelectedEntity

![Note](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note.png)

#### Note

This field type is removed in API version 47.0 and later and is available only in API versions 45.0 and 46.0.

| Field Name | Field Type | Description |
| --- | --- | --- |
| selectedEntity | string | Required. The event name of an entity selected for Change Data Capture notifications. For example, for the Account standard object, the name is AccountChangeEvent, or for a custom object MyObject\_\_c, the name is MyObject\_\_ChangeEvent. |

## Usage

The [createMetadata()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_createMetadata.htm "Adds one or more new metadata components to your organization synchronously.") and [deleteMetadata()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deleteMetadata.htm "Deletes one or more metadata components from your organization synchronously.") calls aren’t supported with the PlatformEventChannel metadata type.

In API version 47.0 and later, you can’t deploy or retrieve the ChangeEvents standard channel.

You can't delete the ChangeEvents standard channel with destructiveChanges.xml, but you can delete channel members using the PlatformEventChannelMember type with destructiveChanges.xml.

You can delete a custom channel with destructiveChanges.xml. If you delete a custom channel, all its member PlatformEventChannelMember components are also deleted.

You can update only the fullName field and the label field of a PlatformEventChannel component.

## Declarative Metadata Sample Definition for a Custom Channel

The PlatformEventChannel component contains the label of the custom channel and the channel type.

<?xml version="1.0" encoding="UTF-8"?>
<PlatformEventChannel xmlns="http://soap.sforce.com/2006/04/metadata">
    <channelType\>data</channelType\>
    <label\>Custom Channel for Sales Events</label\>
</PlatformEventChannel\>

This package.xml references the previous definition. The custom channel name is SalesEvents\_\_chn.

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types\>
        <members\>SalesEvents\_\_chn</members\>
        <name\>PlatformEventChannel</name\>
    </types\>
    <version\>68.0</version\>
</Package\>

## Wildcard Support in the Manifest File

To deploy or retrieve all custom channels, specify the wildcard character \* (asterisk) in the <members> field.

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types\>
        <members\>\*</members\>
        <name\>PlatformEventChannel</name\>
    </types\>
    <version\>68.0</version\>
</Package\>

## Upgrading to Version 47.0 or Later From an Earlier Version

The channelMembers field of the PlatformEventChannel type is removed in API version 47.0 and later. As a result, PlatformEventChannel components created in prior versions can’t be deployed using a later API version but you can deploy them in the same API version they were created with.

To deploy a custom channel component using API version 47.0 and later, upgrade the PlatformEventChannel definition by removing the <channelMembers> fields. For the ChangeEvents standard channel, it can’t be deployed or retrieved, so delete the PlatformEventChannel definition file.

For example, if you had custom channel called SalesEvents\_\_chn, this could be your custom channel definition in API version 46.0.

<?xml version="1.0" encoding="UTF-8"?>
<PlatformEventChannel xmlns="http://soap.sforce.com/2006/04/metadata">
    <channelMembers\>
        <selectedEntity\>AccountChangeEvent</selectedEntity\>
    </channelMembers\>
    <channelMembers\>
        <selectedEntity\>ContactChangeEvent</selectedEntity\>
    </channelMembers\>
    <channelType\>data</channelType\>
    <label\>Sales Events</label\>
</PlatformEventChannel\>

To upgrade to version 47.0 or later, you would replace the custom channel definition with this definition, which doesn’t contain any channel members.

<?xml version="1.0" encoding="UTF-8"?>
<PlatformEventChannel xmlns="http://soap.sforce.com/2006/04/metadata">
    <channelType\>data</channelType\>
    <label\>SalesEvents\_\_chn</label\>
</PlatformEventChannel\>

For each channel member that is part of either a custom or the standard ChangeEvents channel, add a PlatformEventChannelMember metadata component. Also, in the package.xml file, reference both the PlatformEventChannel and PlatformEventChannelMember components.

For example, this PlatformEventChannelMember component is for the AccountChangeEvent member.

<?xml version="1.0" encoding="UTF-8"?>
<PlatformEventChannelMember xmlns="http://soap.sforce.com/2006/04/metadata">
    <eventChannel\>SalesEvents\_\_chn</eventChannel\>
    <selectedEntity\>AccountChangeEvent</selectedEntity\>
</PlatformEventChannelMember\>

For more information, see [PlatformEventChannelMember](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_platformeventchannelmember.htm "Represents an entity selected for Change Data Capture notifications on a standard or custom channel, or a platform event selected on a custom channel.").

For an example of a custom channel that holds custom platform events and Real-Time Event Monitoring events, see [Group Platform Events into One Stream with a Custom Channel](https://developer.salesforce.com/docs/atlas.en-us.264.0.platform_events.meta/platform_events/platform_events_subscribe_custom_channels.htm) in the Platform Events Developer Guide.

#### See Also

- [_Change Data Capture Developer Guide_: Subscription Channels](https://developer.salesforce.com/docs/atlas.en-us.264.0.change_data_capture.meta/change_data_capture/cdc_subscribe_channels.htm "Change Data Capture Developer Guide: Subscription
    Channels - HTML (New Window)")
- [_Change Data Capture Developer Guide_: Compose Streams of Change Data Capture Notifications with Custom Channels](https://developer.salesforce.com/docs/atlas.en-us.264.0.change_data_capture.meta/change_data_capture/cdc_custom_channel.htm "Change Data Capture Developer Guide: Compose
    Streams of Change Data Capture Notifications with Custom
    Channels - HTML (New Window)")
- [PlatformEventChannelMember](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_platformeventchannelmember.htm "Represents an entity selected for Change Data Capture notifications on a standard or custom channel, or a platform event selected on a custom channel.")