---
title: "Create a data export config"
method: POST
path: "/data-export"
---

# Create a data export config

`POST /data-export`

## Request body

- union
  - ExportToNorthbeamDocuments
    - `export_file_name` string — Name of the exported file, if not provided, default one will be used.
    - `level` 'platform' | 'campaign' | 'adset' | 'ad' — Level of metrics to export.
    - `time_granularity` 'MONTHLY' | 'WEEKLY' | 'DAILY' | 'HOURLY' — Data time granularity.
    - `period_type` 'FIXED' | 'TODAY' | 'YESTERDAY' | 'YESTERDAY_AND_TODAY' | 'LAST_3_DAYS' | 'LAST_7_DAYS' | 'LAST_14_DAYS' | 'LAST_28_DAYS' | 'LAST_30_DAYS' | 'LAST_60_DAYS' | 'LAST_90_DAYS' | 'LAST_180_DAYS' | 'MONTH_TO_DATE' | 'LAST_MONTH' | 'THIS_WEEK' | 'LAST_WEEK' | 'THIS_WEEK_AND_LAST_WEEK' | 'LAST_3_WEEKS' | 'LAST_4_WEEKS' | 'LAST_7_WEEKS' | 'LAST_12_WEEKS' | 'LAST_14_WEEKS' | 'LAST_26_WEEKS' | 'LAST_28_WEEKS' | 'LAST_52_WEEKS' | 'THIS_MONTH' | 'THIS_MONTH_AND_LAST_MONTH' | 'LAST_3_MONTHS' | 'LAST_6_MONTHS' | 'LAST_9_MONTHS' | 'LAST_12_MONTHS' | 'YEAR_TO_DATE' | 'LAST_YEAR' | 'LAST_3_YEARS' | 'LAST_5_YEARS' — Time period to be exported. It can be either a relative window or a fixed window. If you choose to export a fixed window, the `period_options` property must be set.
    - `period_options` object — Time frame to be exported if `period_type` is set to "FIXED". The time period cannot be greater than 2 years.
      - `period_starting_at` string, date-time
      - `period_ending_at` string, date-time
    - `breakdowns` object[] — Labels used to breakdown the data. If you are unsure which breakdowns to use, you can fetch them using the `/breakdowns` endpoint.
      - `key` string
      - `values` string[]
    - `options` object
      - `export_aggregation` 'BREAKDOWN' | 'DATE' — Aggregation type.
      - `remove_zero_spend` boolean — Remove rows with zero spend.
      - `aggregate_data` boolean — Aggregate data, ignoring campaign, adset and ad levels.
      - `include_ids` boolean — Include campaign, adset and ad ids in exported data.
      - `include_kind_and_platform` boolean — Include campaign, adset and ad kind and platform in exported data.
    - `attribution_options` object, required
      - `attribution_models` string[] — Attribution models to use. Check in `/attribution-models` for available models.
      - `attribution_windows` string[]
      - `accounting_modes` string[]
    - `metrics` object[], required — Metrics to export. Check in `/metrics` for available metrics.
      - `id` string, required — Metric ID
      - `label` string — Metric label to be used as file header. If not provided, a default label will be used.
  - ExportToGCSBucket
    - `bucket_name` string, required — Name of the external bucket where to export your file.
    - `export_file_name` string — Name of the exported file, if not provided, default one will be used. Can include subdirectory paths (e.g., `folder/subfolder/file`).
    - `level` 'platform' | 'campaign' | 'adset' | 'ad' — Level of metrics to export.
    - `time_granularity` 'MONTHLY' | 'WEEKLY' | 'DAILY' | 'HOURLY' — Data time granularity.
    - `period_type` 'FIXED' | 'TODAY' | 'YESTERDAY' | 'YESTERDAY_AND_TODAY' | 'LAST_3_DAYS' | 'LAST_7_DAYS' | 'LAST_14_DAYS' | 'LAST_28_DAYS' | 'LAST_30_DAYS' | 'LAST_60_DAYS' | 'LAST_90_DAYS' | 'LAST_180_DAYS' | 'MONTH_TO_DATE' | 'LAST_MONTH' | 'THIS_WEEK' | 'LAST_WEEK' | 'THIS_WEEK_AND_LAST_WEEK' | 'LAST_3_WEEKS' | 'LAST_4_WEEKS' | 'LAST_7_WEEKS' | 'LAST_12_WEEKS' | 'LAST_14_WEEKS' | 'LAST_26_WEEKS' | 'LAST_28_WEEKS' | 'LAST_52_WEEKS' | 'THIS_MONTH' | 'THIS_MONTH_AND_LAST_MONTH' | 'LAST_3_MONTHS' | 'LAST_6_MONTHS' | 'LAST_9_MONTHS' | 'LAST_12_MONTHS' | 'YEAR_TO_DATE' | 'LAST_YEAR' | 'LAST_3_YEARS' | 'LAST_5_YEARS' — Time period to be exported. It can be either a relative window or a fixed window. If you choose to export a fixed window, the `period_options` property must be set.
    - `period_options` object — Time frame to be exported if `period_type` is set to "FIXED". The time period cannot be greater than 2 years.
      - `period_starting_at` string, date-time
      - `period_ending_at` string, date-time
    - `breakdowns` object[] — Labels used to breakdown the data. If you are unsure which breakdowns to use, you can fetch them using the `/breakdowns` endpoint.
      - `key` string
      - `values` string[]
    - `options` object
      - `export_aggregation` 'BREAKDOWN' | 'DATE' — Aggregation type.
      - `remove_zero_spend` boolean — Remove rows with zero spend.
      - `aggregate_data` boolean — Aggregate data, ignoring campaign, adset and ad levels.
      - `include_ids` boolean — Include campaign, adset and ad ids in exported data.
      - `include_kind_and_platform` boolean — Include campaign, adset and ad kind and platform in exported data.
    - `attribution_options` object, required
      - `attribution_models` string[] — Attribution models to use. Check in `/attribution-models` for available models.
      - `attribution_windows` string[]
      - `accounting_modes` string[]
    - `metrics` object[], required — Metrics to export. Check in `/metrics` for available metrics.
      - `id` string, required — Metric ID
      - `label` string — Metric label to be used as file header. If not provided, a default label will be used.
  - ExportToS3Bucket
    - `aws_role` string, required — AWS role ARN with access to the S3 bucket.
    - `region` string, required — Region of the S3 bucket.
    - `export_file_name` string — Name of the exported file, if not provided, default one will be used. Can include subdirectory paths (e.g., `folder/subfolder/file`).
    - `level` 'platform' | 'campaign' | 'adset' | 'ad' — Level of metrics to export.
    - `time_granularity` 'MONTHLY' | 'WEEKLY' | 'DAILY' | 'HOURLY' — Data time granularity.
    - `period_type` 'FIXED' | 'TODAY' | 'YESTERDAY' | 'YESTERDAY_AND_TODAY' | 'LAST_3_DAYS' | 'LAST_7_DAYS' | 'LAST_14_DAYS' | 'LAST_28_DAYS' | 'LAST_30_DAYS' | 'LAST_60_DAYS' | 'LAST_90_DAYS' | 'LAST_180_DAYS' | 'MONTH_TO_DATE' | 'LAST_MONTH' | 'THIS_WEEK' | 'LAST_WEEK' | 'THIS_WEEK_AND_LAST_WEEK' | 'LAST_3_WEEKS' | 'LAST_4_WEEKS' | 'LAST_7_WEEKS' | 'LAST_12_WEEKS' | 'LAST_14_WEEKS' | 'LAST_26_WEEKS' | 'LAST_28_WEEKS' | 'LAST_52_WEEKS' | 'THIS_MONTH' | 'THIS_MONTH_AND_LAST_MONTH' | 'LAST_3_MONTHS' | 'LAST_6_MONTHS' | 'LAST_9_MONTHS' | 'LAST_12_MONTHS' | 'YEAR_TO_DATE' | 'LAST_YEAR' | 'LAST_3_YEARS' | 'LAST_5_YEARS' — Time period to be exported. It can be either a relative window or a fixed window. If you choose to export a fixed window, the `period_options` property must be set.
    - `period_options` object — Time frame to be exported if `period_type` is set to "FIXED". The time period cannot be greater than 2 years.
      - `period_starting_at` string, date-time
      - `period_ending_at` string, date-time
    - `breakdowns` object[] — Labels used to breakdown the data. If you are unsure which breakdowns to use, you can fetch them using the `/breakdowns` endpoint.
      - `key` string
      - `values` string[]
    - `options` object
      - `export_aggregation` 'BREAKDOWN' | 'DATE' — Aggregation type.
      - `remove_zero_spend` boolean — Remove rows with zero spend.
      - `aggregate_data` boolean — Aggregate data, ignoring campaign, adset and ad levels.
      - `include_ids` boolean — Include campaign, adset and ad ids in exported data.
      - `include_kind_and_platform` boolean — Include campaign, adset and ad kind and platform in exported data.
    - `attribution_options` object, required
      - `attribution_models` string[] — Attribution models to use. Check in `/attribution-models` for available models.
      - `attribution_windows` string[]
      - `accounting_modes` string[]
    - `metrics` object[], required — Metrics to export. Check in `/metrics` for available metrics.
      - `id` string, required — Metric ID
      - `label` string — Metric label to be used as file header. If not provided, a default label will be used.

## Response `201`

Data Export created successfully

- object
  - `id` string, uuid

## Other responses

- `401` — Unauthorized
- `422` — Invalid Body Params
- `429` — Too many requests
- `500` — Internal server error

---

[API](https://skmtc.net/northbeam/apis/api-spend-v1.md) · [All operations](https://skmtc.net/northbeam/apis/api-spend-v1/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/northbeam/api-spend-v1/versions/ce42b431eeeb/schema)
