> ## Documentation Index
> Fetch the complete documentation index at: https://docs.northbeam.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Sales Attribution export

<div className="nb-api-tables nb-field-table">
  ## Headers

  | Header | Description |
  | :- | :- |
  | `Authorization` <span className="nb-req">required</span> | Your Northbeam API key |
  | `Data-Client-ID` <span className="nb-req">required</span> | Your Northbeam client ID |
  | `Content-Type` <span className="nb-req">required</span> | `application/json` |

  ## Body

  Send **one** of the following 3 shapes.

  ### Export to Northbeam documents

  <div className="nb-table-wrap"><table className="nb-main-table"><thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>export\_file\_name</code></td><td>string</td><td>Name of the exported file, if not provided, default one will be used.<br />Minimum string length: <code>3</code><br />Pattern: <code>^\[A-Za-z0-9\_-]+\$</code></td></tr><tr><td><code>level</code></td><td>string</td><td>Level of metrics to export.<br />Available options: <code>"platform"</code>, <code>"campaign"</code>, <code>"adset"</code>, <code>"ad"</code><br />Default: <code>"platform"</code></td></tr><tr><td><code>time\_granularity</code></td><td>string</td><td>Data time granularity.<br />Available options: <code>"MONTHLY"</code>, <code>"WEEKLY"</code>, <code>"DAILY"</code>, <code>"HOURLY"</code><br />Default: <code>"DAILY"</code></td></tr><tr><td><code>period\_type</code></td><td>string</td><td>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 <code>period\_options</code> property must be set.<br />Available options: <code>"FIXED"</code>, <code>"TODAY"</code>, <code>"YESTERDAY"</code>, <code>"YESTERDAY\_AND\_TODAY"</code>, <code>"LAST\_3\_DAYS"</code>, <code>"LAST\_7\_DAYS"</code>, <code>"LAST\_14\_DAYS"</code>, <code>"LAST\_28\_DAYS"</code>, <code>"LAST\_30\_DAYS"</code>, <code>"LAST\_60\_DAYS"</code>, <code>"LAST\_90\_DAYS"</code>, <code>"LAST\_180\_DAYS"</code>, <code>"MONTH\_TO\_DATE"</code>, <code>"LAST\_MONTH"</code>, <code>"THIS\_WEEK"</code>, <code>"LAST\_WEEK"</code>, <code>"THIS\_WEEK\_AND\_LAST\_WEEK"</code>, <code>"LAST\_3\_WEEKS"</code>, <code>"LAST\_4\_WEEKS"</code>, <code>"LAST\_7\_WEEKS"</code>, <code>"LAST\_12\_WEEKS"</code>, <code>"LAST\_14\_WEEKS"</code>, <code>"LAST\_26\_WEEKS"</code>, <code>"LAST\_28\_WEEKS"</code>, <code>"LAST\_52\_WEEKS"</code>, <code>"THIS\_MONTH"</code>, <code>"THIS\_MONTH\_AND\_LAST\_MONTH"</code>, <code>"LAST\_3\_MONTHS"</code>, <code>"LAST\_6\_MONTHS"</code>, <code>"LAST\_9\_MONTHS"</code>, <code>"LAST\_12\_MONTHS"</code>, <code>"YEAR\_TO\_DATE"</code>, <code>"LAST\_YEAR"</code>, <code>"LAST\_3\_YEARS"</code>, <code>"LAST\_5\_YEARS"</code><br />Default: <code>"LAST\_7\_DAYS"</code></td></tr><tr className="nb-has-children"><td><code>period\_options</code></td><td>object</td><td>Time frame to be exported if <code>period\_type</code> is set to "FIXED". The time period cannot be greater than 2 years.</td></tr><tr className="nb-children-row"><td /><td /><td colSpan={1}><div className="nb-toggle nb-children"><label><input type="checkbox" /><span>Show child attributes</span></label><div className="nb-toggle-body"><div className="nb-child-table"><div className="nb-ct-head"><div>Field</div><div>Type</div><div>Description</div></div><div className="nb-ct-row"><div><code>period\_starting\_at</code></div><div>string (date-time)</div><div /></div><div className="nb-ct-row"><div><code>period\_ending\_at</code></div><div>string (date-time)</div><div /></div></div></div></div></td></tr><tr className="nb-has-children"><td><code>breakdowns</code></td><td>object\[]</td><td>Labels used to breakdown the data. If you are unsure which breakdowns to use, you can fetch them using the <code>/breakdowns</code> endpoint.</td></tr><tr className="nb-children-row"><td /><td /><td colSpan={1}><div className="nb-toggle nb-children"><label><input type="checkbox" /><span>Show child attributes</span></label><div className="nb-toggle-body"><div className="nb-child-table"><div className="nb-ct-head"><div>Field</div><div>Type</div><div>Description</div></div><div className="nb-ct-row"><div><code>key</code></div><div>string</div><div /></div><div className="nb-ct-row"><div><code>values</code></div><div>string\[]</div><div /></div></div></div></div></td></tr><tr className="nb-has-children"><td><code>options</code></td><td>object</td><td /></tr><tr className="nb-children-row"><td /><td /><td colSpan={1}><div className="nb-toggle nb-children"><label><input type="checkbox" /><span>Show child attributes</span></label><div className="nb-toggle-body"><div className="nb-child-table"><div className="nb-ct-head"><div>Field</div><div>Type</div><div>Description</div></div><div className="nb-ct-row"><div><code>export\_aggregation</code></div><div>string</div><div>Aggregation type.<br />Available options: <code>"BREAKDOWN"</code>, <code>"DATE"</code><br />Default: <code>"BREAKDOWN"</code></div></div><div className="nb-ct-row"><div><code>remove\_zero\_spend</code></div><div>boolean</div><div>Remove rows with zero spend.<br />Default: <code>false</code></div></div><div className="nb-ct-row"><div><code>aggregate\_data</code></div><div>boolean</div><div>Aggregate data, ignoring campaign, adset and ad levels.<br />Default: <code>false</code></div></div><div className="nb-ct-row"><div><code>include\_ids</code></div><div>boolean</div><div>Include campaign, adset and ad ids in exported data.<br />Default: <code>false</code></div></div><div className="nb-ct-row"><div><code>include\_kind\_and\_platform</code></div><div>boolean</div><div>Include campaign, adset and ad kind and platform in exported data.<br />Default: <code>false</code></div></div></div></div></div></td></tr><tr className="nb-has-children"><td><code>attribution\_options</code> <span className="nb-req">required</span></td><td>object</td><td /></tr><tr className="nb-children-row"><td /><td /><td colSpan={1}><div className="nb-toggle nb-children"><label><input type="checkbox" /><span>Show child attributes</span></label><div className="nb-toggle-body"><div className="nb-child-table"><div className="nb-ct-head"><div>Field</div><div>Type</div><div>Description</div></div><div className="nb-ct-row"><div><code>attribution\_models</code></div><div>string\[]</div><div>Attribution models to use. Check in <code>/attribution-models</code> for available models.<br />Required range: <code>x >= 1</code></div></div><div className="nb-ct-row"><div><code>attribution\_windows</code></div><div>string\[]</div><div>Required range: <code>x >= 1</code></div></div><div className="nb-ct-row"><div><code>accounting\_modes</code></div><div>string\[]</div><div>Required range: <code>x >= 1</code></div></div></div></div></div></td></tr><tr className="nb-has-children"><td><code>metrics</code> <span className="nb-req">required</span></td><td>object\[]</td><td>Metrics to export. Check in <code>/metrics</code> for available metrics.<br />Required range: <code>x >= 1</code></td></tr><tr className="nb-children-row"><td /><td /><td colSpan={1}><div className="nb-toggle nb-children"><label><input type="checkbox" /><span>Show child attributes</span></label><div className="nb-toggle-body"><div className="nb-child-table"><div className="nb-ct-head"><div>Field</div><div>Type</div><div>Description</div></div><div className="nb-ct-row"><div><code>id</code> <span className="nb-req">required</span></div><div>string</div><div>Metric ID</div></div><div className="nb-ct-row"><div><code>label</code></div><div>string</div><div>Metric label to be used as file header. If not provided, a default label will be used.<br />Pattern: <code>^\[a-zA-Z]\[a-zA-Z0-9\_]+\[a-zA-Z0-9]\$</code></div></div></div></div></div></td></tr></tbody></table></div>

  ### Export to GCS bucket

  <div className="nb-table-wrap"><table className="nb-main-table"><thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>bucket\_name</code> <span className="nb-req">required</span></td><td>string</td><td>Name of the external bucket where to export your file.</td></tr><tr><td><code>export\_file\_name</code></td><td>string</td><td>Name of the exported file, if not provided, default one will be used. Can include subdirectory paths (e.g., <code>folder/subfolder/file</code>).<br />Minimum string length: <code>3</code><br />Pattern: <code>^(?!/)(?!.\*//)\[A-Za-z0-9\_/-]+(?\<!/)\$</code></td></tr><tr><td><code>level</code></td><td>string</td><td>Level of metrics to export.<br />Available options: <code>"platform"</code>, <code>"campaign"</code>, <code>"adset"</code>, <code>"ad"</code><br />Default: <code>"platform"</code></td></tr><tr><td><code>time\_granularity</code></td><td>string</td><td>Data time granularity.<br />Available options: <code>"MONTHLY"</code>, <code>"WEEKLY"</code>, <code>"DAILY"</code>, <code>"HOURLY"</code><br />Default: <code>"DAILY"</code></td></tr><tr><td><code>period\_type</code></td><td>string</td><td>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 <code>period\_options</code> property must be set.<br />Available options: <code>"FIXED"</code>, <code>"TODAY"</code>, <code>"YESTERDAY"</code>, <code>"YESTERDAY\_AND\_TODAY"</code>, <code>"LAST\_3\_DAYS"</code>, <code>"LAST\_7\_DAYS"</code>, <code>"LAST\_14\_DAYS"</code>, <code>"LAST\_28\_DAYS"</code>, <code>"LAST\_30\_DAYS"</code>, <code>"LAST\_60\_DAYS"</code>, <code>"LAST\_90\_DAYS"</code>, <code>"LAST\_180\_DAYS"</code>, <code>"MONTH\_TO\_DATE"</code>, <code>"LAST\_MONTH"</code>, <code>"THIS\_WEEK"</code>, <code>"LAST\_WEEK"</code>, <code>"THIS\_WEEK\_AND\_LAST\_WEEK"</code>, <code>"LAST\_3\_WEEKS"</code>, <code>"LAST\_4\_WEEKS"</code>, <code>"LAST\_7\_WEEKS"</code>, <code>"LAST\_12\_WEEKS"</code>, <code>"LAST\_14\_WEEKS"</code>, <code>"LAST\_26\_WEEKS"</code>, <code>"LAST\_28\_WEEKS"</code>, <code>"LAST\_52\_WEEKS"</code>, <code>"THIS\_MONTH"</code>, <code>"THIS\_MONTH\_AND\_LAST\_MONTH"</code>, <code>"LAST\_3\_MONTHS"</code>, <code>"LAST\_6\_MONTHS"</code>, <code>"LAST\_9\_MONTHS"</code>, <code>"LAST\_12\_MONTHS"</code>, <code>"YEAR\_TO\_DATE"</code>, <code>"LAST\_YEAR"</code>, <code>"LAST\_3\_YEARS"</code>, <code>"LAST\_5\_YEARS"</code><br />Default: <code>"LAST\_7\_DAYS"</code></td></tr><tr className="nb-has-children"><td><code>period\_options</code></td><td>object</td><td>Time frame to be exported if <code>period\_type</code> is set to "FIXED". The time period cannot be greater than 2 years.</td></tr><tr className="nb-children-row"><td /><td /><td colSpan={1}><div className="nb-toggle nb-children"><label><input type="checkbox" /><span>Show child attributes</span></label><div className="nb-toggle-body"><div className="nb-child-table"><div className="nb-ct-head"><div>Field</div><div>Type</div><div>Description</div></div><div className="nb-ct-row"><div><code>period\_starting\_at</code></div><div>string (date-time)</div><div /></div><div className="nb-ct-row"><div><code>period\_ending\_at</code></div><div>string (date-time)</div><div /></div></div></div></div></td></tr><tr className="nb-has-children"><td><code>breakdowns</code></td><td>object\[]</td><td>Labels used to breakdown the data. If you are unsure which breakdowns to use, you can fetch them using the <code>/breakdowns</code> endpoint.</td></tr><tr className="nb-children-row"><td /><td /><td colSpan={1}><div className="nb-toggle nb-children"><label><input type="checkbox" /><span>Show child attributes</span></label><div className="nb-toggle-body"><div className="nb-child-table"><div className="nb-ct-head"><div>Field</div><div>Type</div><div>Description</div></div><div className="nb-ct-row"><div><code>key</code></div><div>string</div><div /></div><div className="nb-ct-row"><div><code>values</code></div><div>string\[]</div><div /></div></div></div></div></td></tr><tr className="nb-has-children"><td><code>options</code></td><td>object</td><td /></tr><tr className="nb-children-row"><td /><td /><td colSpan={1}><div className="nb-toggle nb-children"><label><input type="checkbox" /><span>Show child attributes</span></label><div className="nb-toggle-body"><div className="nb-child-table"><div className="nb-ct-head"><div>Field</div><div>Type</div><div>Description</div></div><div className="nb-ct-row"><div><code>export\_aggregation</code></div><div>string</div><div>Aggregation type.<br />Available options: <code>"BREAKDOWN"</code>, <code>"DATE"</code><br />Default: <code>"BREAKDOWN"</code></div></div><div className="nb-ct-row"><div><code>remove\_zero\_spend</code></div><div>boolean</div><div>Remove rows with zero spend.<br />Default: <code>false</code></div></div><div className="nb-ct-row"><div><code>aggregate\_data</code></div><div>boolean</div><div>Aggregate data, ignoring campaign, adset and ad levels.<br />Default: <code>false</code></div></div><div className="nb-ct-row"><div><code>include\_ids</code></div><div>boolean</div><div>Include campaign, adset and ad ids in exported data.<br />Default: <code>false</code></div></div><div className="nb-ct-row"><div><code>include\_kind\_and\_platform</code></div><div>boolean</div><div>Include campaign, adset and ad kind and platform in exported data.<br />Default: <code>false</code></div></div></div></div></div></td></tr><tr className="nb-has-children"><td><code>attribution\_options</code> <span className="nb-req">required</span></td><td>object</td><td /></tr><tr className="nb-children-row"><td /><td /><td colSpan={1}><div className="nb-toggle nb-children"><label><input type="checkbox" /><span>Show child attributes</span></label><div className="nb-toggle-body"><div className="nb-child-table"><div className="nb-ct-head"><div>Field</div><div>Type</div><div>Description</div></div><div className="nb-ct-row"><div><code>attribution\_models</code></div><div>string\[]</div><div>Attribution models to use. Check in <code>/attribution-models</code> for available models.<br />Required range: <code>x >= 1</code></div></div><div className="nb-ct-row"><div><code>attribution\_windows</code></div><div>string\[]</div><div>Required range: <code>x >= 1</code></div></div><div className="nb-ct-row"><div><code>accounting\_modes</code></div><div>string\[]</div><div>Required range: <code>x >= 1</code></div></div></div></div></div></td></tr><tr className="nb-has-children"><td><code>metrics</code> <span className="nb-req">required</span></td><td>object\[]</td><td>Metrics to export. Check in <code>/metrics</code> for available metrics.<br />Required range: <code>x >= 1</code></td></tr><tr className="nb-children-row"><td /><td /><td colSpan={1}><div className="nb-toggle nb-children"><label><input type="checkbox" /><span>Show child attributes</span></label><div className="nb-toggle-body"><div className="nb-child-table"><div className="nb-ct-head"><div>Field</div><div>Type</div><div>Description</div></div><div className="nb-ct-row"><div><code>id</code> <span className="nb-req">required</span></div><div>string</div><div>Metric ID</div></div><div className="nb-ct-row"><div><code>label</code></div><div>string</div><div>Metric label to be used as file header. If not provided, a default label will be used.<br />Pattern: <code>^\[a-zA-Z]\[a-zA-Z0-9\_]+\[a-zA-Z0-9]\$</code></div></div></div></div></div></td></tr></tbody></table></div>

  ### Export to S3 bucket

  <div className="nb-table-wrap"><table className="nb-main-table"><thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>aws\_role</code> <span className="nb-req">required</span></td><td>string</td><td>AWS role ARN with access to the S3 bucket.</td></tr><tr><td><code>region</code> <span className="nb-req">required</span></td><td>string</td><td>Region of the S3 bucket.</td></tr><tr><td><code>export\_file\_name</code></td><td>string</td><td>Name of the exported file, if not provided, default one will be used. Can include subdirectory paths (e.g., <code>folder/subfolder/file</code>).<br />Minimum string length: <code>3</code><br />Pattern: <code>^(?!/)(?!.\*//)\[A-Za-z0-9\_/-]+(?\<!/)\$</code></td></tr><tr><td><code>level</code></td><td>string</td><td>Level of metrics to export.<br />Available options: <code>"platform"</code>, <code>"campaign"</code>, <code>"adset"</code>, <code>"ad"</code><br />Default: <code>"platform"</code></td></tr><tr><td><code>time\_granularity</code></td><td>string</td><td>Data time granularity.<br />Available options: <code>"MONTHLY"</code>, <code>"WEEKLY"</code>, <code>"DAILY"</code>, <code>"HOURLY"</code><br />Default: <code>"DAILY"</code></td></tr><tr><td><code>period\_type</code></td><td>string</td><td>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 <code>period\_options</code> property must be set.<br />Available options: <code>"FIXED"</code>, <code>"TODAY"</code>, <code>"YESTERDAY"</code>, <code>"YESTERDAY\_AND\_TODAY"</code>, <code>"LAST\_3\_DAYS"</code>, <code>"LAST\_7\_DAYS"</code>, <code>"LAST\_14\_DAYS"</code>, <code>"LAST\_28\_DAYS"</code>, <code>"LAST\_30\_DAYS"</code>, <code>"LAST\_60\_DAYS"</code>, <code>"LAST\_90\_DAYS"</code>, <code>"LAST\_180\_DAYS"</code>, <code>"MONTH\_TO\_DATE"</code>, <code>"LAST\_MONTH"</code>, <code>"THIS\_WEEK"</code>, <code>"LAST\_WEEK"</code>, <code>"THIS\_WEEK\_AND\_LAST\_WEEK"</code>, <code>"LAST\_3\_WEEKS"</code>, <code>"LAST\_4\_WEEKS"</code>, <code>"LAST\_7\_WEEKS"</code>, <code>"LAST\_12\_WEEKS"</code>, <code>"LAST\_14\_WEEKS"</code>, <code>"LAST\_26\_WEEKS"</code>, <code>"LAST\_28\_WEEKS"</code>, <code>"LAST\_52\_WEEKS"</code>, <code>"THIS\_MONTH"</code>, <code>"THIS\_MONTH\_AND\_LAST\_MONTH"</code>, <code>"LAST\_3\_MONTHS"</code>, <code>"LAST\_6\_MONTHS"</code>, <code>"LAST\_9\_MONTHS"</code>, <code>"LAST\_12\_MONTHS"</code>, <code>"YEAR\_TO\_DATE"</code>, <code>"LAST\_YEAR"</code>, <code>"LAST\_3\_YEARS"</code>, <code>"LAST\_5\_YEARS"</code><br />Default: <code>"LAST\_7\_DAYS"</code></td></tr><tr className="nb-has-children"><td><code>period\_options</code></td><td>object</td><td>Time frame to be exported if <code>period\_type</code> is set to "FIXED". The time period cannot be greater than 2 years.</td></tr><tr className="nb-children-row"><td /><td /><td colSpan={1}><div className="nb-toggle nb-children"><label><input type="checkbox" /><span>Show child attributes</span></label><div className="nb-toggle-body"><div className="nb-child-table"><div className="nb-ct-head"><div>Field</div><div>Type</div><div>Description</div></div><div className="nb-ct-row"><div><code>period\_starting\_at</code></div><div>string (date-time)</div><div /></div><div className="nb-ct-row"><div><code>period\_ending\_at</code></div><div>string (date-time)</div><div /></div></div></div></div></td></tr><tr className="nb-has-children"><td><code>breakdowns</code></td><td>object\[]</td><td>Labels used to breakdown the data. If you are unsure which breakdowns to use, you can fetch them using the <code>/breakdowns</code> endpoint.</td></tr><tr className="nb-children-row"><td /><td /><td colSpan={1}><div className="nb-toggle nb-children"><label><input type="checkbox" /><span>Show child attributes</span></label><div className="nb-toggle-body"><div className="nb-child-table"><div className="nb-ct-head"><div>Field</div><div>Type</div><div>Description</div></div><div className="nb-ct-row"><div><code>key</code></div><div>string</div><div /></div><div className="nb-ct-row"><div><code>values</code></div><div>string\[]</div><div /></div></div></div></div></td></tr><tr className="nb-has-children"><td><code>options</code></td><td>object</td><td /></tr><tr className="nb-children-row"><td /><td /><td colSpan={1}><div className="nb-toggle nb-children"><label><input type="checkbox" /><span>Show child attributes</span></label><div className="nb-toggle-body"><div className="nb-child-table"><div className="nb-ct-head"><div>Field</div><div>Type</div><div>Description</div></div><div className="nb-ct-row"><div><code>export\_aggregation</code></div><div>string</div><div>Aggregation type.<br />Available options: <code>"BREAKDOWN"</code>, <code>"DATE"</code><br />Default: <code>"BREAKDOWN"</code></div></div><div className="nb-ct-row"><div><code>remove\_zero\_spend</code></div><div>boolean</div><div>Remove rows with zero spend.<br />Default: <code>false</code></div></div><div className="nb-ct-row"><div><code>aggregate\_data</code></div><div>boolean</div><div>Aggregate data, ignoring campaign, adset and ad levels.<br />Default: <code>false</code></div></div><div className="nb-ct-row"><div><code>include\_ids</code></div><div>boolean</div><div>Include campaign, adset and ad ids in exported data.<br />Default: <code>false</code></div></div><div className="nb-ct-row"><div><code>include\_kind\_and\_platform</code></div><div>boolean</div><div>Include campaign, adset and ad kind and platform in exported data.<br />Default: <code>false</code></div></div></div></div></div></td></tr><tr className="nb-has-children"><td><code>attribution\_options</code> <span className="nb-req">required</span></td><td>object</td><td /></tr><tr className="nb-children-row"><td /><td /><td colSpan={1}><div className="nb-toggle nb-children"><label><input type="checkbox" /><span>Show child attributes</span></label><div className="nb-toggle-body"><div className="nb-child-table"><div className="nb-ct-head"><div>Field</div><div>Type</div><div>Description</div></div><div className="nb-ct-row"><div><code>attribution\_models</code></div><div>string\[]</div><div>Attribution models to use. Check in <code>/attribution-models</code> for available models.<br />Required range: <code>x >= 1</code></div></div><div className="nb-ct-row"><div><code>attribution\_windows</code></div><div>string\[]</div><div>Required range: <code>x >= 1</code></div></div><div className="nb-ct-row"><div><code>accounting\_modes</code></div><div>string\[]</div><div>Required range: <code>x >= 1</code></div></div></div></div></div></td></tr><tr className="nb-has-children"><td><code>metrics</code> <span className="nb-req">required</span></td><td>object\[]</td><td>Metrics to export. Check in <code>/metrics</code> for available metrics.<br />Required range: <code>x >= 1</code></td></tr><tr className="nb-children-row"><td /><td /><td colSpan={1}><div className="nb-toggle nb-children"><label><input type="checkbox" /><span>Show child attributes</span></label><div className="nb-toggle-body"><div className="nb-child-table"><div className="nb-ct-head"><div>Field</div><div>Type</div><div>Description</div></div><div className="nb-ct-row"><div><code>id</code> <span className="nb-req">required</span></div><div>string</div><div>Metric ID</div></div><div className="nb-ct-row"><div><code>label</code></div><div>string</div><div>Metric label to be used as file header. If not provided, a default label will be used.<br />Pattern: <code>^\[a-zA-Z]\[a-zA-Z0-9\_]+\[a-zA-Z0-9]\$</code></div></div></div></div></div></td></tr></tbody></table></div>

  ## Responses

  | Status | Description |
  | :- | :- |
  | `201` | Data Export created successfully |
  | `401` | Unauthorized |
  | `422` | Invalid Body Params |
  | `429` | Too many requests |
  | `500` | Internal server error |

  ### `201` response body

  <div className="nb-table-wrap"><table className="nb-main-table"><thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code> <span className="nb-req">required</span></td><td>string (uuid)</td><td /></tr></tbody></table></div>
</div>


## OpenAPI

````yaml openapi/data-export-v1.json POST /data-export
openapi: 3.0.0
info:
  title: API - DATA EXPORT - V1
  version: '1'
  description: API for exporting data from Northbeam
  termsOfService: https://www.northbeam.io/terms
servers:
  - url: https://api.northbeam.io/v1/exports
security:
  - api_key: []
    client_id: []
tags:
  - name: Sales Attribution
    description: >-
      Export performance metrics by attribution model, window, and accounting
      mode. Use the helper endpoints to discover the models, metrics, and
      breakdowns available to your account before creating the export.
  - name: Orders
    description: >-
      Export your orders (one row per order) with product information to your
      own GCS or S3 bucket.
  - name: Results
    description: Poll for and download a completed export. Shared by every report type.
paths:
  /data-export:
    post:
      tags:
        - Sales Attribution
      summary: Create a Sales Attribution export (attributed performance metrics)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDataExport'
      responses:
        '201':
          description: Data Export created successfully
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                properties:
                  id:
                    type: string
                    format: uuid
        '401':
          description: Unauthorized
        '422':
          description: Invalid Body Params
        '429':
          description: Too many requests
        '500':
          description: Internal server error
components:
  schemas:
    CreateDataExport:
      oneOf:
        - $ref: '#/components/schemas/Export_To_Northbeam_Documents'
        - $ref: '#/components/schemas/Export_To_GCS_Bucket'
        - $ref: '#/components/schemas/Export_To_S3_Bucket'
    Export_To_Northbeam_Documents:
      allOf:
        - type: object
          properties:
            export_file_name:
              description: >-
                Name of the exported file, if not provided, default one will be
                used.
              type: string
              minLength: 3
              pattern: ^[A-Za-z0-9_-]+$
        - $ref: '#/components/schemas/Export_Request_Base'
    Export_To_GCS_Bucket:
      allOf:
        - type: object
          required:
            - bucket_name
          properties:
            bucket_name:
              description: Name of the external bucket where to export your file.
              type: string
            export_file_name:
              description: >-
                Name of the exported file, if not provided, default one will be
                used. Can include subdirectory paths (e.g.,
                `folder/subfolder/file`).
              type: string
              minLength: 3
              pattern: ^(?!/)(?!.*//)[A-Za-z0-9_/-]+(?<!/)$
        - $ref: '#/components/schemas/Export_Request_Base'
    Export_To_S3_Bucket:
      allOf:
        - type: object
          required:
            - aws_role
            - region
          properties:
            aws_role:
              description: AWS role ARN with access to the S3 bucket.
              type: string
            region:
              description: Region of the S3 bucket.
              type: string
            export_file_name:
              description: >-
                Name of the exported file, if not provided, default one will be
                used. Can include subdirectory paths (e.g.,
                `folder/subfolder/file`).
              type: string
              minLength: 3
              pattern: ^(?!/)(?!.*//)[A-Za-z0-9_/-]+(?<!/)$
        - $ref: '#/components/schemas/Export_Request_Base'
    Export_Request_Base:
      type: object
      properties:
        level:
          description: Level of metrics to export.
          type: string
          enum:
            - platform
            - campaign
            - adset
            - ad
          default: platform
        time_granularity:
          description: Data time granularity.
          type: string
          enum:
            - MONTHLY
            - WEEKLY
            - DAILY
            - HOURLY
          default: DAILY
        period_type:
          description: >-
            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.
          type: string
          enum:
            - 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
          default: LAST_7_DAYS
        period_options:
          description: >-
            Time frame to be exported if `period_type` is set to "FIXED". The
            time period cannot be greater than 2 years.
          type: object
          properties:
            period_starting_at:
              type: string
              format: date-time
            period_ending_at:
              type: string
              format: date-time
        breakdowns:
          description: >-
            Labels used to breakdown the data. If you are unsure which
            breakdowns to use, you can fetch them using the `/breakdowns`
            endpoint.
          type: array
          items:
            type: object
            properties:
              key:
                type: string
              values:
                type: array
                items:
                  type: string
        options:
          type: object
          properties:
            export_aggregation:
              description: Aggregation type.
              type: string
              enum:
                - BREAKDOWN
                - DATE
              default: BREAKDOWN
            remove_zero_spend:
              description: Remove rows with zero spend.
              type: boolean
              default: false
            aggregate_data:
              description: Aggregate data, ignoring campaign, adset and ad levels.
              type: boolean
              default: false
            include_ids:
              description: Include campaign, adset and ad ids in exported data.
              type: boolean
              default: false
            include_kind_and_platform:
              description: >-
                Include campaign, adset and ad kind and platform in exported
                data.
              type: boolean
              default: false
        attribution_options:
          type: object
          properties:
            attribution_models:
              description: >-
                Attribution models to use. Check in `/attribution-models` for
                available models.
              type: array
              minimum: 1
              items:
                type: string
            attribution_windows:
              type: array
              minimum: 1
              items:
                type: string
                enum:
                  - '1'
                  - '3'
                  - '7'
                  - '14'
                  - '30'
                  - '60'
                  - '90'
            accounting_modes:
              type: array
              minimum: 1
              items:
                type: string
                enum:
                  - cash
                  - accrual
        metrics:
          description: Metrics to export. Check in `/metrics` for available metrics.
          type: array
          minimum: 1
          items:
            type: object
            properties:
              id:
                description: Metric ID
                type: string
              label:
                description: >-
                  Metric label to be used as file header. If not provided, a
                  default label will be used.
                type: string
                pattern: ^[a-zA-Z][a-zA-Z0-9\_]+[a-zA-Z0-9]$
            required:
              - id
      required:
        - attribution_options
        - metrics
  securitySchemes:
    api_key:
      type: apiKey
      name: Authorization
      in: header
    client_id:
      type: apiKey
      name: Data-Client-ID
      in: header

````