curl --request POST \
--url https://api.topsort.com/public/v1/offsite-ads/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"dsps": [
"google_ads",
"meta"
],
"name": "<string>",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"budget": 1000,
"targetRoas": 3,
"locationIds": [
"123456"
],
"productIds": [
"prod1",
"prod2",
"prod3",
"prod4",
"prod5"
],
"audienceIds": [
"123456"
]
}
'import requests
url = "https://api.topsort.com/public/v1/offsite-ads/campaigns"
payload = {
"dsps": ["google_ads", "meta"],
"name": "<string>",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"budget": 1000,
"targetRoas": 3,
"locationIds": ["123456"],
"productIds": ["prod1", "prod2", "prod3", "prod4", "prod5"],
"audienceIds": ["123456"]
}
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({
dsps: ['google_ads', 'meta'],
name: '<string>',
startDate: '2023-11-07T05:31:56Z',
endDate: '2023-11-07T05:31:56Z',
budget: 1000,
targetRoas: 3,
locationIds: ['123456'],
productIds: ['prod1', 'prod2', 'prod3', 'prod4', 'prod5'],
audienceIds: ['123456']
})
};
fetch('https://api.topsort.com/public/v1/offsite-ads/campaigns', 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/offsite-ads/campaigns",
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([
'dsps' => [
'google_ads',
'meta'
],
'name' => '<string>',
'startDate' => '2023-11-07T05:31:56Z',
'endDate' => '2023-11-07T05:31:56Z',
'budget' => 1000,
'targetRoas' => 3,
'locationIds' => [
'123456'
],
'productIds' => [
'prod1',
'prod2',
'prod3',
'prod4',
'prod5'
],
'audienceIds' => [
'123456'
]
]),
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/offsite-ads/campaigns"
payload := strings.NewReader("{\n \"dsps\": [\n \"google_ads\",\n \"meta\"\n ],\n \"name\": \"<string>\",\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"budget\": 1000,\n \"targetRoas\": 3,\n \"locationIds\": [\n \"123456\"\n ],\n \"productIds\": [\n \"prod1\",\n \"prod2\",\n \"prod3\",\n \"prod4\",\n \"prod5\"\n ],\n \"audienceIds\": [\n \"123456\"\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/offsite-ads/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"dsps\": [\n \"google_ads\",\n \"meta\"\n ],\n \"name\": \"<string>\",\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"budget\": 1000,\n \"targetRoas\": 3,\n \"locationIds\": [\n \"123456\"\n ],\n \"productIds\": [\n \"prod1\",\n \"prod2\",\n \"prod3\",\n \"prod4\",\n \"prod5\"\n ],\n \"audienceIds\": [\n \"123456\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/public/v1/offsite-ads/campaigns")
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 \"dsps\": [\n \"google_ads\",\n \"meta\"\n ],\n \"name\": \"<string>\",\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"budget\": 1000,\n \"targetRoas\": 3,\n \"locationIds\": [\n \"123456\"\n ],\n \"productIds\": [\n \"prod1\",\n \"prod2\",\n \"prod3\",\n \"prod4\",\n \"prod5\"\n ],\n \"audienceIds\": [\n \"123456\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Create Campaign
Create a new offsite campaign.
curl --request POST \
--url https://api.topsort.com/public/v1/offsite-ads/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"dsps": [
"google_ads",
"meta"
],
"name": "<string>",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"budget": 1000,
"targetRoas": 3,
"locationIds": [
"123456"
],
"productIds": [
"prod1",
"prod2",
"prod3",
"prod4",
"prod5"
],
"audienceIds": [
"123456"
]
}
'import requests
url = "https://api.topsort.com/public/v1/offsite-ads/campaigns"
payload = {
"dsps": ["google_ads", "meta"],
"name": "<string>",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"budget": 1000,
"targetRoas": 3,
"locationIds": ["123456"],
"productIds": ["prod1", "prod2", "prod3", "prod4", "prod5"],
"audienceIds": ["123456"]
}
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({
dsps: ['google_ads', 'meta'],
name: '<string>',
startDate: '2023-11-07T05:31:56Z',
endDate: '2023-11-07T05:31:56Z',
budget: 1000,
targetRoas: 3,
locationIds: ['123456'],
productIds: ['prod1', 'prod2', 'prod3', 'prod4', 'prod5'],
audienceIds: ['123456']
})
};
fetch('https://api.topsort.com/public/v1/offsite-ads/campaigns', 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/offsite-ads/campaigns",
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([
'dsps' => [
'google_ads',
'meta'
],
'name' => '<string>',
'startDate' => '2023-11-07T05:31:56Z',
'endDate' => '2023-11-07T05:31:56Z',
'budget' => 1000,
'targetRoas' => 3,
'locationIds' => [
'123456'
],
'productIds' => [
'prod1',
'prod2',
'prod3',
'prod4',
'prod5'
],
'audienceIds' => [
'123456'
]
]),
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/offsite-ads/campaigns"
payload := strings.NewReader("{\n \"dsps\": [\n \"google_ads\",\n \"meta\"\n ],\n \"name\": \"<string>\",\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"budget\": 1000,\n \"targetRoas\": 3,\n \"locationIds\": [\n \"123456\"\n ],\n \"productIds\": [\n \"prod1\",\n \"prod2\",\n \"prod3\",\n \"prod4\",\n \"prod5\"\n ],\n \"audienceIds\": [\n \"123456\"\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/offsite-ads/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"dsps\": [\n \"google_ads\",\n \"meta\"\n ],\n \"name\": \"<string>\",\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"budget\": 1000,\n \"targetRoas\": 3,\n \"locationIds\": [\n \"123456\"\n ],\n \"productIds\": [\n \"prod1\",\n \"prod2\",\n \"prod3\",\n \"prod4\",\n \"prod5\"\n ],\n \"audienceIds\": [\n \"123456\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/public/v1/offsite-ads/campaigns")
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 \"dsps\": [\n \"google_ads\",\n \"meta\"\n ],\n \"name\": \"<string>\",\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"budget\": 1000,\n \"targetRoas\": 3,\n \"locationIds\": [\n \"123456\"\n ],\n \"productIds\": [\n \"prod1\",\n \"prod2\",\n \"prod3\",\n \"prod4\",\n \"prod5\"\n ],\n \"audienceIds\": [\n \"123456\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
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.
Query Parameters
The ID of the vendor to create the campaign for.
Body
The DSPs to create the campaign for.
1google_ads, meta ["google_ads", "meta"]
The name of the campaign
35^[^;"'<>\#\|,\
\
\\]*[^;"'<>\#\|,\
\
\\\s][^;"'<>\#\|,\
\
\\]*$The start date of the campaign
The end date of the campaign
The daily budget in minor units of currency according to ISO 4217.
1000
Target ROAS of the campaign. Acceptable values are between 1.0 and 20.0. Topsort maps this value to the closest equivalent bidding configuration supported by each DSP.
1 <= x <= 203
The DSP-native location IDs to target. Retrieve available IDs via GET /offsite-ads/marketplace/geolocations and use the values from dspLocationIds for the target DSP. Reference: Google Ads geo targets (https://developers.google.com/google-ads/api/data/geotargets), Meta region IDs (https://developers.facebook.com/docs/marketing-api/audiences/reference/targeting-search#regions).
1["123456"]
The product ids to target. These are the product ids from the catalog. If not provided, all products will be targeted.
5["prod1", "prod2", "prod3", "prod4", "prod5"]
The audience ids to target. These are the audience ids from each DSP platform. Currently, only one audience is supported. If not provided, no audience will be targeted.
1["123456"]
Response
Successful Response
The unique identifier for the queued job.
Was this page helpful?