---
openapi: 3.0.3
info:
  title: Braze REST API – Export custom events
  description: 'Use this endpoint to export a list of custom events recorded for your app. The events are returned in groups of 50, sorted alphabetically.

    '
  version: 1.0.0
  contact:
    name: Braze Support
    url: https://www.braze.com/docs/braze_support/
  license:
    name: Braze Documentation
    url: https://www.braze.com/docs/api/home/
servers:
  - url: https://rest.iad-01.braze.com
    description: US-01
  - url: https://rest.iad-02.braze.com
    description: US-02
  - url: https://rest.iad-03.braze.com
    description: US-03
  - url: https://rest.iad-04.braze.com
    description: US-04
  - url: https://rest.iad-05.braze.com
    description: US-05
  - url: https://rest.iad-06.braze.com
    description: US-06
  - url: https://rest.iad-07.braze.com
    description: US-07
  - url: https://rest.iad-08.braze.com
    description: US-08
  - url: https://rest.us-10.braze.com
    description: US-10
  - url: https://rest.fra-01.braze.eu
    description: EU-01
  - url: https://rest.fra-02.braze.eu
    description: EU-02
  - url: https://rest.au-01.braze.com
    description: AU-01
  - url: https://rest.id-01.braze.com
    description: ID-01
  - url: https://rest.jp-01.braze.com
    description: JP-01
  - url: https://rest.kr-01.braze.com
    description: KR-01
security:
- BearerAuth: []
paths:
  "/events":
    get:
      summary: Export custom events
      description: |
        > Use this endpoint to export a list of custom events recorded for your app. The events are returned in groups of 50, sorted alphabetically.

        ## Prerequisites

        To use this endpoint, you'll need an [API key]({{site.baseurl}}/api/basics#rest-api-key/) with the `events.get` permission.

        ## Rate limit

        We apply a shared rate limit of 1,000 requests per hour to this endpoint. This rate limit is shared with the `/custom_attributes`, `/events/list`, and `/purchases/product_list` endpoints, as documented in [API rate limits]({{site.baseurl}}/api/api_limits/).

        ## Query parameters

        Note that each call to this endpoint will return 50 events. For more than 50 events, use the `Link` header to retrieve the data on the next page as shown in the following example response.

        | Parameter | Required | Data Type | Description |
        |---|---|---|---|
        | `cursor` | Optional | String | Determines the pagination of the custom events. |


        ## Example requests

        ### Without cursor

        The following sample request shows an example without a cursor.

        ```
        curl --location --request GET 'https://rest.iad-01.braze.com/events' \
        --header 'Content-Type: application/json' \
        --header 'Authorization: Bearer YOUR_REST_API_KEY'
        ```

        ### With cursor

        The following sample request shows an example with a cursor.

        ```
        curl --location --request GET 'https://rest.iad-03.braze.com/events?cursor=c2tpcDow' \
        --header 'Content-Type: application/json' \
        --header 'Authorization: Bearer YOUR_REST_API_KEY'
        ```

        ## Response

        The following sample response shows an example of the response returned when you export custom events.

        ```json
        {
            "message": (string) returns 'success' when the request completes without errors,
            "events" : [
                {
                    "name": "The event name", (string) the event name,
                    "description": "The event description", (string) the event description,
                    "included_in_analytics_report": false, (boolean) the analytics report inclusion,
                    "status": "Active", (string) the event status,
                    "tag_names": ["Tag One", "Tag Two"] (array) the tag names associated with the event formatted as strings,
                },
                ...
            ]
        }
        ```

        ### Fatal error response codes {#fatal-export}

        For status codes and associated error messages that will be returned if your request encounters a fatal error, reference [Fatal errors]({{site.baseurl}}/api/errors/#fatal-errors).

        ## Response status codes

        The following table lists the responses for this endpoint, the error message you may receive, and how to resolve it.

        | Status code | Meaning | Error message | How to resolve |
        | --- | --- | --- | --- |
        | `200 OK` | The request succeeded and the response body includes the custom event data. | `success` | No action needed. |
        | `401 Unauthorized` | The REST API key is missing, malformed, or sent to the wrong REST endpoint. | `Invalid API key` | Send the key as `Authorization: Bearer YOUR_REST_API_KEY` to the correct [REST endpoint]({{site.baseurl}}/api/basics/#endpoints). For more causes, see [Errors and responses]({{site.baseurl}}/api/errors/#fatal-errors). |
        | `403 Access Denied` | The REST API key doesn't have the required permission. | `Access Denied` | Use a REST API key that has the `events.get` permission. |
        | `429 Rate Limited` | You exceeded the rate limit for this endpoint. | `Over rate limit` | Slow your request rate and retry with exponential backoff. See [API rate limits]({{site.baseurl}}/api/api_limits/). |
        | `5XX Internal Server Error` | An unexpected error occurred on the Braze server. | `Internal Server Error` | Retry with exponential backoff. If the error persists, contact [Support]({{site.baseurl}}/braze_support/). |


        **Tip:**
        For help with CSV and API exports, visit [Export troubleshooting]({{site.baseurl}}/user_guide/data/distribution/export_braze_data/export_troubleshooting/).

      operationId: get_events_get_custom_events_data
      tags:
      - Export
      responses:
        '200':
          description: The request succeeded and the response body includes the custom event data.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomEventsDataResponse'
        '401':
          description: The REST API key is missing, malformed, or sent to the wrong REST endpoint.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: The REST API key doesn't have the required permission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: You exceeded the rate limit for this endpoint.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '5XX':
          description: An unexpected error occurred on the Braze server.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      parameters:
      - name: cursor
        in: query
        required: false
        description: Determines the pagination of the custom events.
        schema:
          type: string
components:
  schemas:
    CustomEventsDataResponse:
      type: object
      properties:
        message:
          type: string
          description: Returns 'success' when the request completes without errors.
        events:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              description:
                type: string
              included_in_analytics_report:
                type: boolean
              status:
                type: string
              tag_names:
                type: array
                items:
                  type: string
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: The error message describing why the request failed.
        errors:
          type: array
          description: Non-fatal errors encountered while processing the request. Data unaffected by these errors is still processed.
          items:
            type: object
            properties:
              type:
                type: string
                description: The error type.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: REST API key
