If you have any doubts on how to use the endpoints, refer to the API Reference for guidance.
Fetching attribution models
To fetch your attribution models, you can use one of the following snippets:You can find request examples in other languages in the API Reference
<api_key>, and <client_id> with the appropriate values for your account.
Once you send the GET request to the Data Export API using the shell snippet provided earlier, you will receive a JSON response containing the available attribution models for your account. The response will appear as follows:
Fetching metrics
To fetch your metrics, you can use this snippet:<api_key>, and <client_id> with the appropriate values for your account.
After executing the request, you will receive a JSON response that contains the available metrics. If you have connected any platform with their own metrics, such as TikTok, Meta (Facebook), or Google, they will also be listed in the response.
The response will look like the following:
JSON
The JSON response above is for demonstration purposes only and therefore does not include all possible metrics.
Fetching breakdown labels
To fetch your breakdowns, use the following shell snippet:<api_key> and <client_id> with your own account’s values.
It’s worth noting that breakdown labels can be useful for grouping your data by different platforms, allowing you to analyze your data by platform and identify trends or areas for improvement.
The response will be in JSON format and will include all the available breakdown labels for platforms in your account. Here is an example of the JSON response:
When creating a data export, you have the option to choose not to use any breakdown label. In this case, the exported data will not be grouped by any platform or other criteria, and will not include any breakdowns.
Creating a data export
To create a data export, you can use the following request example:metrics and attribution_options are required to create an export. The other fields are either optional or have default values.
For more information on payload options please refer to the API Reference for assistance.Here is a brief explanation of some of the key parameters in the request body:
level: Specifies the level of granularity for the export. In this case, the export is at the ad level.time_granularity: Specifies the time granularity for the export, in this case, it’s set to daily.period_type: Specifies the period for which the data should be exported. In this case, the period is set to yesterday.breakdowns: Specifies the breakdowns to apply to the exported data. In this case, the data will be grouped by the values in the “Category (Northbeam)” breakdown. You must use the labels fetched from the/breakdownsendpoint.metrics: Specifies the metrics to include in the exported data. You must use the metrics available from the/metricsendpoint. Note that thelabelparameter undermetricsis optional and can be used to specify a custom label for the metric in the exported data. If a label is not provided, the default label for the metric will be used.attribution_options: Specifies the attribution models, attribution windows, and accounting modes to apply to the exported data. The attribution models must be the ones from the/attribution-modelsendpoint.options: Specifies additional options, such as whether to aggregate data, whether to remove zero spend rows, and how to aggregate data.
Fetching the result
The create response returns anid (shown above). Poll the shared results endpoint with it until status is SUCCESS, then download the file from the result link — this endpoint works the same for every report type. See Fetching your export results in the Data Exports overview.