---
schema_version: "1"
id: e632d959f182aed76eb6fcd2c3e3b433d7901243d14f4224d528ec34159d9525
title: PlatformEventUsageMetric
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/object_reference/sforce_api_objects_platformeventusagemetric.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_platformeventusagemetric.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: c2ad9a01fc270c323f0a92f0b1681fb999e38a992e4b9e573573a84ffcd18636
description: Contains usage data for event publishing and delivery to CometD and Pub/Sub API clients, empApi Lightning components, and event relays. If Enhanced Usage Metrics isn't enabled, usage data is available for the last 24 hours, ending at the last hour, and for historical daily usage. In API 58.0 and later, you can enable Enhanced Usage Metrics to get usage data by event name and client for granular time intervals. PlatformEventUsageMetric contains separate usage metrics for platform events and change data capture events. This object is available in API version 50.0 and later.
---
# PlatformEventUsageMetric

Contains usage data for event publishing and delivery to CometD and Pub/Sub API clients, empApi Lightning components, and event relays. If Enhanced Usage Metrics isn't enabled, usage data is available for the last 24 hours, ending at the last hour, and for historical daily usage. In API 58.0 and later, you can enable Enhanced Usage Metrics to get usage data by event name and client for granular time intervals. PlatformEventUsageMetric contains separate usage metrics for platform events and change data capture events. This object is available in API version 50.0 and later.

## Supported Calls

describeSObjects(), query()

## Fields

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


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

              <th class="featureTableHeader  " id="d1528439e78">Details</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d1528439e75" data-title="Field"><span class="keyword parmname">Client</span></td>

              <td class="entry" headers="d1528439e78" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">This field is available only when Enhanced Usage Metrics is enabled. The ID
                    of the client. The <span class="keyword parmname">Client</span> field is populated with one of
                    the following values.</dd>

                  <dd class="dd">The <span class="keyword parmname">Client</span> field can be one of these values. <ul class="ul bulletList">
                      <li class="li">For a Streaming API (CometD) client and the empApi Lightning component,
                        the client value is the ID of the CometD session.</li>

                      <li class="li">For a Pub/Sub API client, the client value is <samp class="codeph nolang">PUB_SUB_API</samp>.</li>

                      <li class="li">For an event relay, the client value is <samp class="codeph nolang">EVENT_RELAY</samp>.</li>

                      <li class="li">For the publish usage of Change Data Capture events, the client value is
                        <samp class="codeph nolang">SYSTEM</samp>.
                      </li>

                      <li class="li">For publish usages using REST API, the client value is <samp class="codeph nolang">REST_API</samp>.</li>

                      <li class="li">For publish usages using Flow, the client value is <samp class="codeph nolang">FLOW</samp>.</li>

                      <li class="li">For publish usages using SOAP API, the client value is <samp class="codeph nolang">SOAP_API</samp>.</li>

                      <li class="li">For publish usages using Bulk API, the client value is <samp class="codeph nolang">BULK_API</samp>.</li>

                      <li class="li">For Apex, the publish usage client value is <samp class="codeph nolang">APEX</samp> and the delivery usage client value is the Apex Trigger
                        ID starting with 01q.</li>

                    </ul>
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1528439e75" data-title="Field"><span class="keyword parmname">EndDate</span></td>

              <td class="entry" headers="d1528439e78" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">dateTime</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The end date and time in UTC used for querying usage metrics. The date
                    granularity is hourly.</dd>

                  <dd class="dd">To get usage data for the last 24 hours, the end date is the current date in
                    UTC. The time is the current time in UTC rounded down to the previous hour.
                    For example, 11:23 is 11:00 and the date format is:
                    2020-08-04T11:00:00.000Z</dd>

                  <dd class="dd">To get historical data, the end date in UTC is the end of the date range
                    with hours specified as 0. For example: 2020-08-04T00:00:00.000Z. To query a
                    date range, you can use the &lt; or &lt;= operators.</dd>

                  <dd class="dd">For the date format to use, see <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.264.0.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_dateformats.htm" target="_blank" title="HTML (New Window)">Date Formats and Date
                      Literals</a> in the <cite class="cite">SOQL and SOSL Reference</cite>.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1528439e75" data-title="Field"><span class="keyword parmname">EventName</span></td>

              <td class="entry" headers="d1528439e78" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">This field is available only when Enhanced Usage Metrics is enabled. The API
                    name of a custom platform event or a change event. <ul class="ul bulletList">
                      <li class="li">Custom platform event with the label My Event: <samp class="codeph nolang">My_Event__e</samp>
                      </li>

                      <li class="li">Change event example: <samp class="codeph nolang">AccountChangeEvent</samp>
                      </li>

                    </ul>
                  </dd>

                  <dd class="dd">When you query usage metrics for <span class="keyword parmname">EventName</span>, specify the
                    <span class="keyword parmname">UsageType</span> field in the <samp class="codeph nolang">SELECT</samp> or <samp class="codeph nolang">WHERE</samp> clause.
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1528439e75" data-title="Field"><span class="keyword parmname">EventType</span></td>

              <td class="entry" headers="d1528439e78" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">picklist</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Restricted picklist, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">This field is available when Enhanced Usage Metrics is enabled. The type of
                    event you would like to query usage metrics for, such as a change event or a
                    custom platform event.</dd>

                  <dd class="dd">Possible values are: <ul class="ul bulletList">
                      <li class="li">
                        <samp class="codeph nolang">CHANGE_EVENT</samp>—A Change Data
                        Capture event.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">CUSTOM_PLATFORM_EVENT</samp>—A
                        platform event that an admin defined in your Salesforce org.
                      </li>

                    </ul>
                  </dd>

                  <dd class="dd">When you query usage metrics for <span class="keyword parmname">EventType</span>, specify the
                    <span class="keyword parmname">UsageType</span> field in the <samp class="codeph nolang">SELECT</samp> or <samp class="codeph nolang">WHERE</samp> clause.
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1528439e75" data-title="Field"><span class="keyword parmname">ExternalId</span></td>

              <td class="entry" headers="d1528439e78" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">This field is not in use.</dd>



                </dl>

              </td>

            </tr>

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

              <td class="entry" headers="d1528439e78" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">picklist</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Restricted picklist, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The name of the metric to get usage for.</dd>

                  <dd class="dd">Possible values are: <ul class="ul bulletList">
                      <li class="li">
                        <samp class="codeph nolang">CHANGE_EVENTS_DELIVERED</samp>—Number of change data capture
                        events delivered to CometD and Pub/Sub API clients,
                        <samp class="ph systemoutput">empApi</samp> Lightning components, and event
                        relays
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">CHANGE_EVENTS_PUBLISHED</samp>—Number of change data capture
                        events published
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">PLATFORM_EVENTS_DELIVERED</samp>—Number of platform events
                        delivered to CometD and Pub/Sub API clients,
                        <samp class="ph systemoutput">empApi</samp> Lightning components, and event
                        relays
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">PLATFORM_EVENTS_PUBLISHED</samp>—Number of platform events
                        published
                      </li>

                    </ul>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1528439e75" data-title="Field"><span class="keyword parmname">StartDate</span></td>

              <td class="entry" headers="d1528439e78" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">dateTime</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The start date and time in UTC used for querying usage metrics. The date
                    granularity is hourly.</dd>

                  <dd class="dd">To get usage data for the last 24 hours, the start date is the previous day
                    in UTC. The time is the current time in UTC rounded down to the previous hour.
                    For example, 11:23 is 11:00 and the date format is:
                    2020-08-03T11:00:00.000Z</dd>

                  <dd class="dd">To get historical data, the start date is the start of the date range with
                    hours specified as 0. For example: 2020-08-03T00:00:00.000Z. To specify a date
                    range, you can use the &gt; or &gt;= operators.</dd>

                  <dd class="dd">If Enhanced Usage Metrics is enabled, keep in mind these tips.<ul class="ul bulletList">
                      <li class="li">Make sure the time span between <span class="keyword parmname">StartDate</span> and
                        <span class="keyword parmname">EndDate</span> is valid for the
                        <span class="keyword parmname">TimeSegment</span> value chosen.
                      </li>

                      <li class="li">The maximum date range that you can specify between
                        <span class="keyword parmname">StartDate</span> and <span class="keyword parmname">EndDate</span> is 60
                        days.
                      </li>

                    </ul>
                  </dd>

                  <dd class="dd">For the date format to use, see <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.264.0.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_dateformats.htm" target="_blank" title="HTML (New Window)">Date Formats and Date
                      Literals</a> in the <cite class="cite">SOQL and SOSL Reference</cite>.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1528439e75" data-title="Field"><span class="keyword parmname">TimeSegment</span></td>

              <td class="entry" headers="d1528439e78" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">picklist</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Restricted picklist, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">This field is available when Enhanced Usage Metrics is enabled. &nbsp;The time
                    interval used for aggregating usage data returned in the query results. Valid
                    <span class="keyword parmname">TimeSegment</span> values depend on the time range specified
                    with <span class="keyword parmname">StartDate</span> and <span class="keyword parmname">EndDate</span>.
                  </dd>

                  <dd class="dd">Possible values are:
                    <div class="data colSort">
                      <table class="featureTable sort_table" summary="">



                        <thead class="thead sorted" align="left">
                          <tr>
                            <th class="featureTableHeader  " id="d1528439e638"></th>

                            <th class="featureTableHeader  " id="d1528439e640"></th>

                            <th class="featureTableHeader  " id="d1528439e642"></th>

                          </tr>

                        </thead>

                        <tbody class="tbody">
                          <tr>
                            <td class="entry" headers="d1528439e638" data-title=""><samp class="codeph nolang">Daily</samp></td>

                            <td class="entry" headers="d1528439e640" data-title="">Usage data is aggregated for each day within the specified time
                              range.</td>

                            <td class="entry" headers="d1528439e642" data-title="">Valid only if the time range specified with
                              <span class="keyword parmname">StartDate</span> and <span class="keyword parmname">EndDate</span> in
                              the query is at least 24 hours.
                            </td>

                          </tr>

                          <tr>
                            <td class="entry" headers="d1528439e638" data-title=""><samp class="codeph nolang">Hourly</samp></td>

                            <td class="entry" headers="d1528439e640" data-title="">Usage data is aggregated for each hour within the specified
                              time range.</td>

                            <td class="entry" headers="d1528439e642" data-title="">Valid only if the time range specified with
                              <span class="keyword parmname">StartDate</span> and <span class="keyword parmname">EndDate</span> in
                              the query is between one hour and 24 hours.
                            </td>

                          </tr>

                          <tr>
                            <td class="entry" headers="d1528439e638" data-title=""><samp class="codeph nolang">FifteenMinutes</samp></td>

                            <td class="entry" headers="d1528439e640" data-title="">Usage data is aggregated for each 15-minute period within the
                              specified time range. </td>

                            <td class="entry" headers="d1528439e642" data-title="">Valid only if the time range specified with
                              <span class="keyword parmname">StartDate</span> and <span class="keyword parmname">EndDate</span> in
                              the query is between 15 minutes and one hour.
                            </td>

                          </tr>

                        </tbody>

                      </table>
                    </div>
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1528439e75" data-title="Field"><span class="keyword parmname">UsageType</span></td>

              <td class="entry" headers="d1528439e78" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">picklist</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Restricted picklist, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">This field is available when Enhanced Usage Metrics is enabled. The type of
                    event usage metrics to query for, such as event publishing or event delivery.
                    Use this field with the <span class="keyword parmname">EventName</span> or
                    <span class="keyword parmname">EventType</span> fields.
                  </dd>

                  <dd class="dd">Possible values are: <ul class="ul bulletList">
                      <li class="li">
                        <samp class="codeph nolang">PUBLISH</samp>—Usage metrics for
                        published events.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">DELIVERY</samp>—Usage metrics for
                        events that were delivered to subscribers.
                      </li>

                    </ul>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1528439e75" data-title="Field"><span class="keyword parmname">Value</span></td>

              <td class="entry" headers="d1528439e78" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">long</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The usage value for the specified metric and date range.</dd>


                </dl>

              </td>

            </tr>

          </tbody>

        </table>

## Usage

For more information, see [Monitor Platform Event Publishing and Delivery Usage](https://developer.salesforce.com/docs/atlas.en-us.264.0.platform_events.meta/platform_events/platform_events_monitor_usage.htm "HTML (New Window)") in the Platform Events Developer Guide.