Zum Hauptinhalt springen
POST
/
public
/
v1
/
campaign-service
/
campaigns
/
sponsored-brand
Create a sponsored brand campaign.
curl --request POST \
  --url https://api.topsort.com/public/v1/campaign-service/campaigns/sponsored-brand \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "slotId": "<string>",
  "schedule": [
    {
      "startDate": "2023-11-07T05:31:56Z",
      "endDate": "2023-11-07T05:31:56Z"
    }
  ],
  "content": {},
  "bids": [
    {
      "target": {
        "id": "<string>"
      },
      "triggers": [
        {
          "type": "<string>",
          "value": {
            "fromProduct": "<string>"
          }
        }
      ],
      "formatProperties": {
        "imageAssets": [
          {
            "height": 123,
            "width": 123,
            "contentType": "<string>",
            "contentLength": 123,
            "url": "<string>"
          }
        ]
      },
      "amount": "<unknown>",
      "location": "Santiago"
    }
  ],
  "budget": {
    "amount": 123
  },
  "isActive": true,
  "status": "approved",
  "externalCampaignId": "<string>",
  "isAutoTrigger": false,
  "slotIds": [
    "<string>"
  ],
  "walletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "targetRoas": 15.25,
  "chargeType": "CPC",
  "autobiddingObjective": "clicks"
}
'
import requests

url = "https://api.topsort.com/public/v1/campaign-service/campaigns/sponsored-brand"

payload = {
    "name": "<string>",
    "slotId": "<string>",
    "schedule": [
        {
            "startDate": "2023-11-07T05:31:56Z",
            "endDate": "2023-11-07T05:31:56Z"
        }
    ],
    "content": {},
    "bids": [
        {
            "target": { "id": "<string>" },
            "triggers": [
                {
                    "type": "<string>",
                    "value": { "fromProduct": "<string>" }
                }
            ],
            "formatProperties": { "imageAssets": [
                    {
                        "height": 123,
                        "width": 123,
                        "contentType": "<string>",
                        "contentLength": 123,
                        "url": "<string>"
                    }
                ] },
            "amount": "<unknown>",
            "location": "Santiago"
        }
    ],
    "budget": { "amount": 123 },
    "isActive": True,
    "status": "approved",
    "externalCampaignId": "<string>",
    "isAutoTrigger": False,
    "slotIds": ["<string>"],
    "walletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "targetRoas": 15.25,
    "chargeType": "CPC",
    "autobiddingObjective": "clicks"
}
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({
    name: '<string>',
    slotId: '<string>',
    schedule: [{startDate: '2023-11-07T05:31:56Z', endDate: '2023-11-07T05:31:56Z'}],
    content: {},
    bids: [
      {
        target: {id: '<string>'},
        triggers: [{type: '<string>', value: {fromProduct: '<string>'}}],
        formatProperties: {
          imageAssets: [
            {
              height: 123,
              width: 123,
              contentType: '<string>',
              contentLength: 123,
              url: '<string>'
            }
          ]
        },
        amount: '<unknown>',
        location: 'Santiago'
      }
    ],
    budget: {amount: 123},
    isActive: true,
    status: 'approved',
    externalCampaignId: '<string>',
    isAutoTrigger: false,
    slotIds: ['<string>'],
    walletId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
    targetRoas: 15.25,
    chargeType: 'CPC',
    autobiddingObjective: 'clicks'
  })
};

fetch('https://api.topsort.com/public/v1/campaign-service/campaigns/sponsored-brand', 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/campaign-service/campaigns/sponsored-brand",
  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([
    'name' => '<string>',
    'slotId' => '<string>',
    'schedule' => [
        [
                'startDate' => '2023-11-07T05:31:56Z',
                'endDate' => '2023-11-07T05:31:56Z'
        ]
    ],
    'content' => [
        
    ],
    'bids' => [
        [
                'target' => [
                                'id' => '<string>'
                ],
                'triggers' => [
                                [
                                                                'type' => '<string>',
                                                                'value' => [
                                                                                                                                'fromProduct' => '<string>'
                                                                ]
                                ]
                ],
                'formatProperties' => [
                                'imageAssets' => [
                                                                [
                                                                                                                                'height' => 123,
                                                                                                                                'width' => 123,
                                                                                                                                'contentType' => '<string>',
                                                                                                                                'contentLength' => 123,
                                                                                                                                'url' => '<string>'
                                                                ]
                                ]
                ],
                'amount' => '<unknown>',
                'location' => 'Santiago'
        ]
    ],
    'budget' => [
        'amount' => 123
    ],
    'isActive' => true,
    'status' => 'approved',
    'externalCampaignId' => '<string>',
    'isAutoTrigger' => false,
    'slotIds' => [
        '<string>'
    ],
    'walletId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
    'targetRoas' => 15.25,
    'chargeType' => 'CPC',
    'autobiddingObjective' => 'clicks'
  ]),
  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/campaign-service/campaigns/sponsored-brand"

	payload := strings.NewReader("{\n  \"name\": \"<string>\",\n  \"slotId\": \"<string>\",\n  \"schedule\": [\n    {\n      \"startDate\": \"2023-11-07T05:31:56Z\",\n      \"endDate\": \"2023-11-07T05:31:56Z\"\n    }\n  ],\n  \"content\": {},\n  \"bids\": [\n    {\n      \"target\": {\n        \"id\": \"<string>\"\n      },\n      \"triggers\": [\n        {\n          \"type\": \"<string>\",\n          \"value\": {\n            \"fromProduct\": \"<string>\"\n          }\n        }\n      ],\n      \"formatProperties\": {\n        \"imageAssets\": [\n          {\n            \"height\": 123,\n            \"width\": 123,\n            \"contentType\": \"<string>\",\n            \"contentLength\": 123,\n            \"url\": \"<string>\"\n          }\n        ]\n      },\n      \"amount\": \"<unknown>\",\n      \"location\": \"Santiago\"\n    }\n  ],\n  \"budget\": {\n    \"amount\": 123\n  },\n  \"isActive\": true,\n  \"status\": \"approved\",\n  \"externalCampaignId\": \"<string>\",\n  \"isAutoTrigger\": false,\n  \"slotIds\": [\n    \"<string>\"\n  ],\n  \"walletId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n  \"targetRoas\": 15.25,\n  \"chargeType\": \"CPC\",\n  \"autobiddingObjective\": \"clicks\"\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/campaign-service/campaigns/sponsored-brand")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"<string>\",\n  \"slotId\": \"<string>\",\n  \"schedule\": [\n    {\n      \"startDate\": \"2023-11-07T05:31:56Z\",\n      \"endDate\": \"2023-11-07T05:31:56Z\"\n    }\n  ],\n  \"content\": {},\n  \"bids\": [\n    {\n      \"target\": {\n        \"id\": \"<string>\"\n      },\n      \"triggers\": [\n        {\n          \"type\": \"<string>\",\n          \"value\": {\n            \"fromProduct\": \"<string>\"\n          }\n        }\n      ],\n      \"formatProperties\": {\n        \"imageAssets\": [\n          {\n            \"height\": 123,\n            \"width\": 123,\n            \"contentType\": \"<string>\",\n            \"contentLength\": 123,\n            \"url\": \"<string>\"\n          }\n        ]\n      },\n      \"amount\": \"<unknown>\",\n      \"location\": \"Santiago\"\n    }\n  ],\n  \"budget\": {\n    \"amount\": 123\n  },\n  \"isActive\": true,\n  \"status\": \"approved\",\n  \"externalCampaignId\": \"<string>\",\n  \"isAutoTrigger\": false,\n  \"slotIds\": [\n    \"<string>\"\n  ],\n  \"walletId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n  \"targetRoas\": 15.25,\n  \"chargeType\": \"CPC\",\n  \"autobiddingObjective\": \"clicks\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.topsort.com/public/v1/campaign-service/campaigns/sponsored-brand")

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  \"name\": \"<string>\",\n  \"slotId\": \"<string>\",\n  \"schedule\": [\n    {\n      \"startDate\": \"2023-11-07T05:31:56Z\",\n      \"endDate\": \"2023-11-07T05:31:56Z\"\n    }\n  ],\n  \"content\": {},\n  \"bids\": [\n    {\n      \"target\": {\n        \"id\": \"<string>\"\n      },\n      \"triggers\": [\n        {\n          \"type\": \"<string>\",\n          \"value\": {\n            \"fromProduct\": \"<string>\"\n          }\n        }\n      ],\n      \"formatProperties\": {\n        \"imageAssets\": [\n          {\n            \"height\": 123,\n            \"width\": 123,\n            \"contentType\": \"<string>\",\n            \"contentLength\": 123,\n            \"url\": \"<string>\"\n          }\n        ]\n      },\n      \"amount\": \"<unknown>\",\n      \"location\": \"Santiago\"\n    }\n  ],\n  \"budget\": {\n    \"amount\": 123\n  },\n  \"isActive\": true,\n  \"status\": \"approved\",\n  \"externalCampaignId\": \"<string>\",\n  \"isAutoTrigger\": false,\n  \"slotIds\": [\n    \"<string>\"\n  ],\n  \"walletId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n  \"targetRoas\": 15.25,\n  \"chargeType\": \"CPC\",\n  \"autobiddingObjective\": \"clicks\"\n}"

response = http.request(request)
puts response.read_body
{
  "campaignId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "marketplaceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "vendorId": "<string>",
  "name": "<string>",
  "isActive": true,
  "isAutoTrigger": true,
  "slotId": "<string>",
  "schedule": [
    {
      "startDate": "2023-11-07T05:31:56Z",
      "endDate": "2023-11-07T05:31:56Z"
    }
  ],
  "content": {},
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "isAgency": true,
  "budget": {
    "amount": 123,
    "amountRemaining": 123,
    "amountCarryover": 123,
    "amountUsed": 123
  },
  "externalCampaignId": "<string>",
  "walletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "targetRoas": 15.25
}
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}

Autorisierungen

Authorization
string
header
erforderlich

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.

Abfrageparameter

vendor_id
string
erforderlich

The ID of the vendor.

Minimum string length: 1

Body

application/json

Request body for creating a public sponsored brand campaign.

name
string
erforderlich

The name of the campaign.

Minimum string length: 1
Beispiel:

"Bola-Bola Ad campaign"

slotId
string
erforderlich

The external slot ID where the sponsored brand campaign will be shown.

Minimum string length: 1
schedule
Schedule · object[]
erforderlich

The schedule for the campaign.

Required array length: 1 element
content
Content · object
erforderlich

Dynamic content validated against the slot's JSON template.

bids
PublicCreateSponsoredBrandBid · object[]
erforderlich

An array of bids for this campaign.

Required array length: 1 - 500 elements
bidType
enum<string>
erforderlich

The bidding type of the campaign.

Verfügbare Optionen:
manual,
autobidding
budget
BudgetCreate · object
erforderlich

The assigned budget for the campaign.

isActive
boolean
Standard:true

Whether the campaign should be activated upon creation.

status
enum<string>
Standard:approved

The initial review status of the sponsored brand campaign.

Verfügbare Optionen:
approved,
pending,
rejected
externalCampaignId
string | null

The external ID of the campaign in the marketplace.

isAutoTrigger
boolean
Standard:false

Whether the campaign is auto-triggered.

slotIds
string[] | null

Additional external slot IDs. If present, each ID replicates the whole bid set.

Maximum array length: 10
walletId
string<uuid> | null

The uuid of the wallet used with this campaign.

targetRoas
number | null

Indicates the vendor's target return on ad spend.

Erforderlicher Bereich: 0.5 <= x <= 30
targetRoasPreference
enum<string> | null

Target ROAS preference label.

Verfügbare Optionen:
aggressive,
conservative,
moderate,
custom
chargeType
enum<string>
Standard:CPC

How campaigns are charged.

Verfügbare Optionen:
CPM,
CPC,
CPA
autobiddingObjective
enum<string>
Standard:clicks

The objective of the campaign.

Verfügbare Optionen:
impressions,
clicks,
conversions,
revenue

Antwort

Successful Response

A regular sponsored brand campaign returned by the public API.

campaignId
string<uuid>
erforderlich

The ID of the campaign.

marketplaceId
string<uuid>
erforderlich

The ID of the marketplace.

vendorId
string
erforderlich

The external vendor ID.

name
string
erforderlich

The name of the campaign.

Minimum string length: 1
Beispiel:

"Bola-Bola Ad campaign"

isActive
boolean
erforderlich

Whether the campaign is active.

status
enum<string>
erforderlich

The approval status of the sponsored brand campaign.

Verfügbare Optionen:
approved,
pending,
rejected
isAutoTrigger
boolean
erforderlich

Whether the campaign is auto-triggered.

slotId
string
erforderlich

The external slot ID where the sponsored brand campaign is shown.

schedule
Schedule · object[]
erforderlich

The schedule for the campaign.

Required array length: 1 element
content
Content · object
erforderlich

Dynamic content validated against the slot's JSON template.

createdAt
string<date-time>
erforderlich

When this campaign was created.

updatedAt
string<date-time>
erforderlich

When this campaign was last updated.

bidType
enum<string>
erforderlich

The bidding type of the campaign.

Verfügbare Optionen:
manual,
autobidding
isAgency
boolean
erforderlich

Whether this campaign is promoted by an agency.

chargeType
enum<string>
erforderlich

How campaigns are charged.

Verfügbare Optionen:
CPM,
CPC,
CPA
budget
Budget · object
erforderlich

The assigned budget for the campaign.

externalCampaignId
string | null

The external ID of the campaign in the marketplace.

walletId
string<uuid> | null

The uuid of the wallet used with this campaign.

targetRoas
number | null

Indicates the vendor's target return on ad spend.

Erforderlicher Bereich: 0.5 <= x <= 30
targetRoasPreference
enum<string> | null

Target ROAS preference label.

Verfügbare Optionen:
aggressive,
conservative,
moderate,
custom
autobiddingObjective
enum<string> | null

The objective of the campaign.

Verfügbare Optionen:
impressions,
clicks,
conversions,
revenue