curl --request POST \
--url https://api.topsort.com/public/v1/export-service/exports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"dataset": "monitoring_metrics",
"dimensions": [
"day_local",
"vendor_id",
"campaign_id"
],
"metrics": [
"impressions",
"clicks",
"ad_spend",
"roas"
],
"granularity": "day_local",
"startDate": "2026-09-01",
"endDate": "2026-09-07",
"vendorIds": [
"vendor_123",
"vendor_456"
],
"entityTypes": [
"product",
"halo-product"
]
}
'import requests
url = "https://api.topsort.com/public/v1/export-service/exports"
payload = {
"dataset": "monitoring_metrics",
"dimensions": ["day_local", "vendor_id", "campaign_id"],
"metrics": ["impressions", "clicks", "ad_spend", "roas"],
"granularity": "day_local",
"startDate": "2026-09-01",
"endDate": "2026-09-07",
"vendorIds": ["vendor_123", "vendor_456"],
"entityTypes": ["product", "halo-product"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
dataset: 'monitoring_metrics',
dimensions: ['day_local', 'vendor_id', 'campaign_id'],
metrics: ['impressions', 'clicks', 'ad_spend', 'roas'],
granularity: 'day_local',
startDate: '2026-09-01',
endDate: '2026-09-07',
vendorIds: ['vendor_123', 'vendor_456'],
entityTypes: ['product', 'halo-product']
})
};
fetch('https://api.topsort.com/public/v1/export-service/exports', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.topsort.com/public/v1/export-service/exports",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'dataset' => 'monitoring_metrics',
'dimensions' => [
'day_local',
'vendor_id',
'campaign_id'
],
'metrics' => [
'impressions',
'clicks',
'ad_spend',
'roas'
],
'granularity' => 'day_local',
'startDate' => '2026-09-01',
'endDate' => '2026-09-07',
'vendorIds' => [
'vendor_123',
'vendor_456'
],
'entityTypes' => [
'product',
'halo-product'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.topsort.com/public/v1/export-service/exports"
payload := strings.NewReader("{\n \"dataset\": \"monitoring_metrics\",\n \"dimensions\": [\n \"day_local\",\n \"vendor_id\",\n \"campaign_id\"\n ],\n \"metrics\": [\n \"impressions\",\n \"clicks\",\n \"ad_spend\",\n \"roas\"\n ],\n \"granularity\": \"day_local\",\n \"startDate\": \"2026-09-01\",\n \"endDate\": \"2026-09-07\",\n \"vendorIds\": [\n \"vendor_123\",\n \"vendor_456\"\n ],\n \"entityTypes\": [\n \"product\",\n \"halo-product\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.topsort.com/public/v1/export-service/exports")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"dataset\": \"monitoring_metrics\",\n \"dimensions\": [\n \"day_local\",\n \"vendor_id\",\n \"campaign_id\"\n ],\n \"metrics\": [\n \"impressions\",\n \"clicks\",\n \"ad_spend\",\n \"roas\"\n ],\n \"granularity\": \"day_local\",\n \"startDate\": \"2026-09-01\",\n \"endDate\": \"2026-09-07\",\n \"vendorIds\": [\n \"vendor_123\",\n \"vendor_456\"\n ],\n \"entityTypes\": [\n \"product\",\n \"halo-product\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/public/v1/export-service/exports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"dataset\": \"monitoring_metrics\",\n \"dimensions\": [\n \"day_local\",\n \"vendor_id\",\n \"campaign_id\"\n ],\n \"metrics\": [\n \"impressions\",\n \"clicks\",\n \"ad_spend\",\n \"roas\"\n ],\n \"granularity\": \"day_local\",\n \"startDate\": \"2026-09-01\",\n \"endDate\": \"2026-09-07\",\n \"vendorIds\": [\n \"vendor_123\",\n \"vendor_456\"\n ],\n \"entityTypes\": [\n \"product\",\n \"halo-product\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"exportId": "218ad339-00cd-4e11-aeaa-8d96694908a0",
"status": "pending",
"dataset": "monitoring_metrics",
"createdAt": "2026-09-08T14:03:12Z"
}{
"error": {
"code": "internal_error",
"message": "An unexpected error occurred.",
"details": []
}
}{
"error": {
"code": "internal_error",
"message": "An unexpected error occurred.",
"details": []
}
}Create a data export
Request an export of the dimensions and metrics you choose.
The file is generated in the background. Save exportId and check the
export until it is completed or failed. Each accepted export counts
toward your daily quota.
vendorIds is a filter, not access control: send it to export only those
vendors, or leave it out to export every vendor. entityTypes narrows the
export the same way.
curl --request POST \
--url https://api.topsort.com/public/v1/export-service/exports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"dataset": "monitoring_metrics",
"dimensions": [
"day_local",
"vendor_id",
"campaign_id"
],
"metrics": [
"impressions",
"clicks",
"ad_spend",
"roas"
],
"granularity": "day_local",
"startDate": "2026-09-01",
"endDate": "2026-09-07",
"vendorIds": [
"vendor_123",
"vendor_456"
],
"entityTypes": [
"product",
"halo-product"
]
}
'import requests
url = "https://api.topsort.com/public/v1/export-service/exports"
payload = {
"dataset": "monitoring_metrics",
"dimensions": ["day_local", "vendor_id", "campaign_id"],
"metrics": ["impressions", "clicks", "ad_spend", "roas"],
"granularity": "day_local",
"startDate": "2026-09-01",
"endDate": "2026-09-07",
"vendorIds": ["vendor_123", "vendor_456"],
"entityTypes": ["product", "halo-product"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
dataset: 'monitoring_metrics',
dimensions: ['day_local', 'vendor_id', 'campaign_id'],
metrics: ['impressions', 'clicks', 'ad_spend', 'roas'],
granularity: 'day_local',
startDate: '2026-09-01',
endDate: '2026-09-07',
vendorIds: ['vendor_123', 'vendor_456'],
entityTypes: ['product', 'halo-product']
})
};
fetch('https://api.topsort.com/public/v1/export-service/exports', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.topsort.com/public/v1/export-service/exports",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'dataset' => 'monitoring_metrics',
'dimensions' => [
'day_local',
'vendor_id',
'campaign_id'
],
'metrics' => [
'impressions',
'clicks',
'ad_spend',
'roas'
],
'granularity' => 'day_local',
'startDate' => '2026-09-01',
'endDate' => '2026-09-07',
'vendorIds' => [
'vendor_123',
'vendor_456'
],
'entityTypes' => [
'product',
'halo-product'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.topsort.com/public/v1/export-service/exports"
payload := strings.NewReader("{\n \"dataset\": \"monitoring_metrics\",\n \"dimensions\": [\n \"day_local\",\n \"vendor_id\",\n \"campaign_id\"\n ],\n \"metrics\": [\n \"impressions\",\n \"clicks\",\n \"ad_spend\",\n \"roas\"\n ],\n \"granularity\": \"day_local\",\n \"startDate\": \"2026-09-01\",\n \"endDate\": \"2026-09-07\",\n \"vendorIds\": [\n \"vendor_123\",\n \"vendor_456\"\n ],\n \"entityTypes\": [\n \"product\",\n \"halo-product\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.topsort.com/public/v1/export-service/exports")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"dataset\": \"monitoring_metrics\",\n \"dimensions\": [\n \"day_local\",\n \"vendor_id\",\n \"campaign_id\"\n ],\n \"metrics\": [\n \"impressions\",\n \"clicks\",\n \"ad_spend\",\n \"roas\"\n ],\n \"granularity\": \"day_local\",\n \"startDate\": \"2026-09-01\",\n \"endDate\": \"2026-09-07\",\n \"vendorIds\": [\n \"vendor_123\",\n \"vendor_456\"\n ],\n \"entityTypes\": [\n \"product\",\n \"halo-product\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/public/v1/export-service/exports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"dataset\": \"monitoring_metrics\",\n \"dimensions\": [\n \"day_local\",\n \"vendor_id\",\n \"campaign_id\"\n ],\n \"metrics\": [\n \"impressions\",\n \"clicks\",\n \"ad_spend\",\n \"roas\"\n ],\n \"granularity\": \"day_local\",\n \"startDate\": \"2026-09-01\",\n \"endDate\": \"2026-09-07\",\n \"vendorIds\": [\n \"vendor_123\",\n \"vendor_456\"\n ],\n \"entityTypes\": [\n \"product\",\n \"halo-product\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"exportId": "218ad339-00cd-4e11-aeaa-8d96694908a0",
"status": "pending",
"dataset": "monitoring_metrics",
"createdAt": "2026-09-08T14:03:12Z"
}{
"error": {
"code": "internal_error",
"message": "An unexpected error occurred.",
"details": []
}
}{
"error": {
"code": "internal_error",
"message": "An unexpected error occurred.",
"details": []
}
}Autorisierungen
Body
The data you want to export.
Dimensions to group the rows by; each one becomes a column in the file. Send each value once. Columns appear in the order you send them: dimensions first, then metrics.
1 - 26 elementsDimensions you can group an export by; each one becomes a column in the file.
vendor_id, campaign_id, entity_type, entity_id, day_local, device_type, page_id, page_type, page_value, placement_page, auction_device, auction_location, auction_page_type, auction_page_id, auction_page_value, auction_search_query, auction_category, currency_code, vendor_name, campaign_name, external_campaign_id, status, campaign_type, ad_format, charge_type, is_active ["day_local", "vendor_id", "campaign_id"]
Metrics to include in each row; each one becomes a column in the file. Send each value once.
1 - 19 elementsMetrics you can include in an export; each one becomes a column in the file.
impressions, clicks, charged_clicks, charged_impressions, charged_attributed_purchases, quantity, purchase_count, ad_spent_clicks, ad_spent_impressions, ad_spent_exclusive_campaign, ad_spent_attributed_purchases, ad_spend, total_purchase_amount, ctr, conversion_rate, cpc, cpm, roas, acos ["impressions", "clicks", "ad_spend", "roas"]
How the rows are grouped in time, one of the dataset's granularities. day_local gives one row per local day and adds day_local as the first column if dimensions leaves it out. total gives one row of totals for the whole window per combination of the other dimensions, so dimensions cannot include day_local.
day_local, total "day_local"
"total"
The entity_type values to export. It only narrows the export: leave it out or empty to export every entity type.
4Entity types you can filter an export by, as they appear in the entity_type column.
halo-product, product, url, vendor ["product", "halo-product"]
Antwort
Your export was accepted and is pending. Check it with the returned exportId until it is completed or failed.
The export you requested, which runs in the background.
War diese Seite hilfreich?