---
openapi: 3.0.3
info:
  title: Braze REST API – Export campaign analytics
  description: 'Use this endpoint to retrieve a daily series of various stats for a campaign over time.

    '
  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:
  "/campaigns/data_series":
    get:
      summary: Export campaign analytics
      description: "## Prerequisites\n\nTo use this endpoint, you'll need an [API key]({{site.baseurl}}/api/basics#rest-api-key-permissions) with the `campaigns.data_series` permission.\n\n## Rate limit\n\nThis endpoint has a rate limit of 50,000 requests per minute.\n\n## Request parameters\n\nThe following table lists the request parameters for this endpoint.\n\n| Parameter | Required | Data Type | Description |\n| --------- | -------- | --------- | ----------- |\n| `campaign_id` | Required | String | See [campaign API identifier]({{site.baseurl}}/api/identifier_types/).<br><br> The `campaign_id` for API campaigns can be found on the [API Keys]({{site.baseurl}}/user_guide/administer/global/workspace_settings/apis_and_identifiers/) page and the **Campaign Details** page within your dashboard, or you can use the [List campaigns endpoint]({{site.baseurl}}/api/endpoints/export/campaigns/get_campaigns/). |\n| `length` | Required | Integer | Maximum number of days before `ending_at` to include in the returned series. Must be between 1 and 100 (inclusive). |\n| `ending_at` | Optional | Datetime <br>([ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) string) | Date on which the data series should end. Defaults to time of the request. |\n\n\n## Example request\n\n\nThe following sample request shows an example of how to export campaign analytics.\n\n```\ncurl --location -g --request GET 'https://rest.iad-01.braze.com/campaigns/data_series?campaign_id={{campaign_identifier}}&length=7&ending_at=2020-06-28T23:59:59-5:00' \\\n--header 'Authorization: Bearer YOUR_REST_API_KEY'\n```\n\n\n## Responses\n\n### Multichannel response\n\nThe following sample response shows an example of the response returned when you export campaign analytics.\n\n```json\n{\n    \"message\": (string) returns 'success' when the request completes without errors,\n    \"data\" : [\n        {\n            \"time\": (string) the date as ISO 8601 date,\n            \"conversions_by_send_time\": (optional, int),\n            \"conversions1_by_send_time\": (optional, int),\n            \"conversions2_by_send_time\": (optional, int),\n            \"conversions3_by_send_time\": (optional, int),\n            \"conversions\": (optional, int),\n            \"conversions1\": (optional, int),\n            \"conversions2\": (optional, int),\n            \"conversions3\": (optional, int),\n            \"unique_recipients\": (int),\n            \"revenue\": (optional, float)\n            \"messages\" : {\n                \"ios_push\" : [\n                    {\n                      \"variation_api_id\": (string) the variation API identifier,\n                      \"sent\" : (int) the number of sends,\n                      \"direct_opens\" : (int) the number of direct opens,\n                      \"total_opens\" : (int)the number of total opens,\n                      \"bounces\" : (int) the number of bounces,\n                      \"body_clicks\" : (int) the number of body clicks\n                    }\n                ],\n                \"android_push\" : [\n                    {\n                      \"variation_api_id\": (string) the variation API identifier,\n                      \"sent\" : (int) the number of sends,\n                      \"direct_opens\" : (int) the number of direct opens,\n                      \"total_opens\" : (int)the number of total opens,\n                      \"bounces\" : (int) the number of bounces,\n                      \"body_clicks\" : (int) the number of body clicks\n                    }\n                ],\n                \"webhook\": [\n                    {\n                      \"variation_api_id\": (string) the variation API identifier,\n                      \"sent\": (int) the number of sends,\n                      \"errors\": (int) the number of errors\n                    }\n                ],\n                \"email\" : [\n                    {\n                      \"variation_api_id\": (string) the variation API identifier,\n                      \"sent\": (int) the number of sends,\n                      \"opens\": (int) the number of opens,\n                      \"unique_opens\": (int) the number of unique opens,\n                      \"clicks\": (int) the number of clicks,\n                      \"unique_clicks\": (int) the number of unique clicks,\n                      \"unsubscribes\": (int) the number of unsubscribes,\n                      \"bounces\": (int) the number of bounces,\n                      \"delivered\": (int) the number of messages delivered,\n                      \"reported_spam\": (int) the number of messages reported as spam\n                    }\n                ],\n                \"sms\" : [\n                    {\n                      \"variation_api_id\": (string) the variation API identifier,\n                      \"sent\": (int) the number of sends,\n                      \"sent_to_carrier\" : (int) the number of messages sent to the carrier,\n                      \"delivered\": (int) the number of delivered messages,\n                      \"rejected\": (int) the number of rejected messages,\n                      \"delivery_failed\": (int) the number of failed deliveries,\n                      \"clicks\": (int) the number of clicks on shortened links,\n                      \"opt_out\" : (int) the number of opt outs,\n                      \"help\" : (int) the number of help messages received\n                  }\n                ],\n                \"whats_app\": [\n                    {\n                      \"variation_api_id\": (string) the variation API identifier,\n                      \"sent\": (int) the number of sends,\n                      \"delivered\": (int) the number of delivered messages,\n                      \"failed\": (int) the number of failed deliveries,\n                      \"read\": (int) the number of opened messages\n                    },\n                ],\n                \"content_cards\" : [\n                  {\n                    \"variation_api_id\": (string) the variation API identifier,\n                    \"sent\": (int) the number of sends,\n                    \"total_clicks\": (int) the number of total clicks,\n                    \"total_dismissals\": (int) the number of total dismissals,\n                    \"total_impressions\": (int) the number of total impressions,\n                    \"unique_clicks\": (int) the number of unique clicks,\n                    \"unique_dismissals\": (int) the number of unique dismissals,\n                    \"unique_impressions\": (int) the number of unique impressions\n                  }\n                ],\n                ...\n            }\n        }\n    ],\n}\n```\n\n### Multivariate response\n\nThe following sample response shows an example of the response returned when you export campaign analytics.\n\n```json\n{\n    \"data\" : [\n        {\n            \"time\" : (string) the date as ISO 8601 date,\n            \"conversions\" : (int) the number of conversions,\n            \"revenue\": (float) the number of dollars of revenue (USD),\n            \"conversions_by_send_time\": (int) the number of conversions attributed to the date the campaign was sent,\n            \"messages\" : {\n               \"trigger_in_app_message\": [{\n                    \"variation_name\": (optional, string) the variation name,\n                    \"impressions\": (int) the number of impressions,\n                    \"clicks\": (int) the number of clicks,\n                    \"first_button_clicks\": (int) the number of first button clicks,\n                    \"second_button_clicks\": (int) the number of second button clicks,\n                    \"revenue\": (float) the number of dollars of revenue (USD),\n                    \"unique_recipients\": (int) the number of unique recipients,\n                    \"conversions\": (int) the number of conversions,\n                    \"conversions_by_send_time\": (int) the number of conversions attributed to the date the campaign was sent,\n                    \"conversions1\": (optional, int) the number of conversions for the second conversion event,\n                    \"conversions1_by_send_time\": (optional, int) the number of conversions for the second conversion event attributed to the date the campaign was sent,\n                    \"conversions2\": (optional, int) the number of conversions for the third conversion event,\n                    \"conversions2_by_send_time\": (optional, int) the number of conversions for the third conversion event attributed to the date the campaign was sent,\n                    \"conversions3\": (optional, int) the number of conversions for the fourth conversion event,\n                    \"conversions3_by_send_time\": (optional, int) the number of conversions for the fourth conversion event attributed to the date the campaign was sent\n      \t\t\t}, {\n      \t\t\t\t\"variation_name\": (optional, string) the variation name,\n      \t\t\t\t\"impressions\": (int) the number of impressions,\n      \t\t\t\t\"clicks\": (int) the number of clicks,\n      \t\t\t\t\"first_button_clicks\": (int) the number of first button clicks,\n      \t\t\t\t\"second_button_clicks\": (int) the number of second button clicks,\n                    \"revenue\": (float) the number of dollars of revenue (USD),\n                    \"unique_recipients\": (int) the number of unique recipients,\n                    \"conversions\": (int) the number of conversions,\n                    \"conversions_by_send_time\": (int) the number of conversions attributed to the date the campaign was sent,\n                    \"conversions1\": (optional, int) the number of conversions for the second conversion event,\n                    \"conversions1_by_send_time\": (optional, int) the number of conversions for the second conversion event attributed to the date the campaign was sent,\n                    \"conversions2\": (optional, int) the number of conversions for the third conversion event,\n                    \"conversions2_by_send_time\": (optional, int) the number of conversions for the third conversion event attributed to the date the campaign was sent,\n                    \"conversions3\": (optional, int) the number of conversions for the fourth conversion event,\n                    \"conversions3_by_send_time\": (optional, int) the number of conversions for the fourth conversion event attributed to the date the campaign was sent\n      \t\t\t}, {\n      \t\t\t\t\"variation_name\": (optional, string) the variation name,\n      \t\t\t\t\"revenue\": (float) the number of dollars of revenue (USD),\n      \t\t\t\t\"unique_recipients\": (int) the number of unique recipients,\n      \t\t\t\t\"conversions\": (int) the number of conversions,\n                    \"conversions_by_send_time\": (int) the number of conversions attributed to the date the campaign was sent,\n                    \"conversions1\": (optional, int) the number of conversions for the second conversion event,\n                    \"conversions1_by_send_time\": (optional, int) the number of conversions for the second conversion event attributed to the date the campaign was sent,\n                    \"conversions2\": (optional, int) the number of conversions for the third conversion event,\n                    \"conversions2_by_send_time\": (optional, int) the number of conversions for the third conversion event attributed to the date the campaign was sent,\n                    \"conversions3\": (optional, int) the number of conversions for the fourth conversion event,\n                    \"conversions3_by_send_time\": (optional, int) the number of conversions for the fourth conversion event attributed to the date the campaign was sent\n      \t\t\t\t\"enrolled\": (optional, int) the number of enrolled users\n      \t\t\t}]\n      \t\t},\n      \t\t\"conversions_by_send_time\": (optional, int),\n      \t\t\"conversions1_by_send_time\": (optional, int),\n      \t\t\"conversions2_by_send_time\": (optional, int),\n      \t\t\"conversions3_by_send_time\": (optional, int),\n      \t\t\"conversions\": (optional, int),\n      \t\t\"conversions1\": (optional, int),\n      \t\t\"conversions2\": (optional, int),\n      \t\t\"conversions3\": (optional, int),\n      \t\t\"unique_recipients\": (int),\n      \t\t\"revenue\": (optional, float)\n         }],\n         ...\n}\n```\n\nThe possible message types are: `email`, `trigger_in_app_message`, `webhook`, `android_push`, `ios_push`, `kindle_push`, and `web_push`. All push message types will have the same statistics shown for `android_push`.\n\n## Response status codes\n\nThe following table lists the responses for this endpoint, the error message you may receive, and how to resolve it.\n\n| Status code | Meaning | Error message | How to resolve |\n| --- | --- | --- | --- |\n| `200 OK` | The request succeeded and the response body includes the requested data. | `success` | No action needed. |\n| `400 Bad Request` | The `campaign_id` is missing or doesn't match a campaign in this workspace. | `campaign_id must be a valid campaign id` | Pass a valid `campaign_id`. Find it with the [List campaigns endpoint]({{site.baseurl}}/api/endpoints/export/campaigns/get_campaigns/). |\n| `400 Bad Request` | The `length` is missing, isn't an integer, or is out of range. | `an integer length must be provided`<br>`series range must be greater than 0 and less than 100` | Pass an integer `length` between 1 and 100. |\n| `400 Bad Request` | The `ending_at` value is improperly formatted or out of range. | `ending_at time is improperly formatted`<br>`ending_at time is out of range` | Provide `ending_at` as an ISO-8601 datetime that isn't in the future or before the year 2000. |\n| `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). |\n| `403 Access Denied` | The REST API key doesn't have the required permission. | `Access Denied` | Use a REST API key that has the `campaigns.data_series` permission. |\n| `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/). |\n| `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/). |\n\n**Tip:**\nFor help with CSV and API exports, visit [Export troubleshooting]({{site.baseurl}}/user_guide/data/distribution/export_braze_data/export_troubleshooting/).\n\n## Troubleshooting\n\n### Viewing delivery failures for API-triggered campaigns\n\nThe [`/campaigns/data_series`]({{site.baseurl}}/api/endpoints/export/campaigns/get_campaign_analytics/) endpoint returns aggregated daily stats (for example, `delivery_failed` for SMS or `errors` for webhooks). It does not return per-recipient failure reasons.\n\nFor per-message send failures, bounces, and aborts from API-triggered or API campaigns, use the [Message Activity Log]({{site.baseurl}}/user_guide/administer/global/workspace_settings/logs_and_alerts/message_activity_log/) in the dashboard. For custom reports on send and delivery events, use [Query Builder]({{site.baseurl}}/user_guide/analytics/reports/query_builder/) with [query templates]({{site.baseurl}}/user_guide/analytics/reports/query_builder/query_templates/) or custom SQL. You can also stream failure events through Currents or Snowflake Data Sharing if your workspace has those products enabled.\n\n"
      operationId: get_campaigns_data_series_get_campaign_analytics
      tags:
      - Export
      responses:
        '200':
          description: The request succeeded and the response body includes the requested data.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CampaignAnalyticsResponse'
        '400':
          description: |-
            Bad Request. Causes include:

            - `campaign_id must be a valid campaign id` — The `campaign_id` is missing or doesn't match a campaign in this workspace.
            - The `length` is missing, isn't an integer, or is out of range.
            - The `ending_at` value is improperly formatted or out of range.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '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: campaign_id
        in: query
        required: true
        description: See campaign API identifier.   The `campaign_id` for API campaigns can be found on the API Keys page and the **Campaign Details** page within your dashboard, or you can use the List campaigns endpoint.
        schema:
          type: string
      - name: length
        in: query
        required: true
        description: Maximum number of days before `ending_at` to include in the returned series. Must be between 1 and 100 (inclusive).
        schema:
          type: integer
      - name: ending_at
        in: query
        required: false
        description: Date on which the data series should end. Defaults to time of the request.
        schema:
          type: string
components:
  schemas:
    CampaignAnalyticsResponse:
      type: object
      properties:
        message:
          type: string
          description: Returns 'success' when the request completes without errors.
        data:
          type: array
          items:
            type: object
            properties:
              time:
                type: string
                description: The date as ISO 8601 date.
              conversions_by_send_time:
                type: integer
              conversions1_by_send_time:
                type: integer
              conversions2_by_send_time:
                type: integer
              conversions3_by_send_time:
                type: integer
              conversions:
                type: integer
              conversions1:
                type: integer
              conversions2:
                type: integer
              conversions3:
                type: integer
              unique_recipients:
                type: integer
              revenue:
                type: number
              messages:
                type: object
                properties:
                  ios_push:
                    type: array
                    items:
                      type: object
                      properties:
                        variation_api_id:
                          type: string
                          description: The variation API identifier.
                        sent:
                          type: integer
                          description: The number of sends.
                        direct_opens:
                          type: integer
                          description: The number of direct opens.
                        total_opens:
                          type: integer
                          description: The number of total opens.
                        bounces:
                          type: integer
                          description: The number of bounces.
                        body_clicks:
                          type: integer
                          description: The number of body clicks.
                  android_push:
                    type: array
                    items:
                      type: object
                      properties:
                        variation_api_id:
                          type: string
                          description: The variation API identifier.
                        sent:
                          type: integer
                          description: The number of sends.
                        direct_opens:
                          type: integer
                          description: The number of direct opens.
                        total_opens:
                          type: integer
                          description: The number of total opens.
                        bounces:
                          type: integer
                          description: The number of bounces.
                        body_clicks:
                          type: integer
                          description: The number of body clicks.
                  webhook:
                    type: array
                    items:
                      type: object
                      properties:
                        variation_api_id:
                          type: string
                          description: The variation API identifier.
                        sent:
                          type: integer
                          description: The number of sends.
                        errors:
                          type: integer
                          description: The number of errors.
                  email:
                    type: array
                    items:
                      type: object
                      properties:
                        variation_api_id:
                          type: string
                          description: The variation API identifier.
                        sent:
                          type: integer
                          description: The number of sends.
                        opens:
                          type: integer
                          description: The number of opens.
                        unique_opens:
                          type: integer
                          description: The number of unique opens.
                        clicks:
                          type: integer
                          description: The number of clicks.
                        unique_clicks:
                          type: integer
                          description: The number of unique clicks.
                        unsubscribes:
                          type: integer
                          description: The number of unsubscribes.
                        bounces:
                          type: integer
                          description: The number of bounces.
                        delivered:
                          type: integer
                          description: The number of messages delivered.
                        reported_spam:
                          type: integer
                          description: The number of messages reported as spam.
                  sms:
                    type: array
                    items:
                      type: object
                      properties:
                        variation_api_id:
                          type: string
                          description: The variation API identifier.
                        sent:
                          type: integer
                          description: The number of sends.
                        sent_to_carrier:
                          type: integer
                          description: The number of messages sent to the carrier.
                        delivered:
                          type: integer
                          description: The number of delivered messages.
                        rejected:
                          type: integer
                          description: The number of rejected messages.
                        delivery_failed:
                          type: integer
                          description: The number of failed deliveries.
                        clicks:
                          type: integer
                          description: The number of clicks on shortened links.
                        opt_out:
                          type: integer
                          description: The number of opt outs.
                        help:
                          type: integer
                          description: The number of help messages received.
                  whats_app:
                    type: array
                    items:
                      type: object
                      properties:
                        variation_api_id:
                          type: string
                          description: The variation API identifier.
                        sent:
                          type: integer
                          description: The number of sends.
                        delivered:
                          type: integer
                          description: The number of delivered messages.
                        failed:
                          type: integer
                          description: The number of failed deliveries.
                        read:
                          type: integer
                          description: The number of opened messages.
                  content_cards:
                    type: array
                    items:
                      type: object
                      properties:
                        variation_api_id:
                          type: string
                          description: The variation API identifier.
                        sent:
                          type: integer
                          description: The number of sends.
                        total_clicks:
                          type: integer
                          description: The number of total clicks.
                        total_dismissals:
                          type: integer
                          description: The number of total dismissals.
                        total_impressions:
                          type: integer
                          description: The number of total impressions.
                        unique_clicks:
                          type: integer
                          description: The number of unique clicks.
                        unique_dismissals:
                          type: integer
                          description: The number of unique dismissals.
                        unique_impressions:
                          type: integer
                          description: The number of unique impressions.
    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
