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"
}
'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"
}
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'
})
};
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'
]),
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}")
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}")
.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}"
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.
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"
}
'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"
}
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'
})
};
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'
]),
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}")
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}")
.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}"
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": []
}
}Autorisations
A valid API key generated in Topsort's UI. Use the TSE API key if calling auctions or events API, otherwise use the TSC API key.
Corps
The data you want to export.
The dataset to export. The datasets endpoint lists the ones you can request.
monitoring_metrics "monitoring_metrics"
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 - 27 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, external_vendor_id, 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. It must be one of the dataset's granularities; today only day_local is supported, one row per local day.
day_local "day_local"
First local day to export (YYYY-MM-DD, inclusive). It can be at most 120 days before today in UTC.
"2026-09-01"
Last local day to export (YYYY-MM-DD, inclusive). It must be on or after startDate, and the window can cover up to 31 days counting both.
"2026-09-07"
Réponse
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.
ID of your export. Use it to check the export's status.
"218ad339-00cd-4e11-aeaa-8d96694908a0"
Always pending: your export starts in the background.
pending, running, completed, failed "pending"
The dataset being exported.
monitoring_metrics "monitoring_metrics"
When you requested the export.
"2026-09-08T14:03:12Z"
Cette page vous a-t-elle été utile ?