Example API Usage
Here are examples of how to create a campaign using the Addressable.tv API in different programming languages:import requests
import json
url = "https://api.addressable.tv/client/campaigns"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"name": "Summer 2025 Brand Campaign",
"nickname": "SUM25",
"advertiserName": "Acme Corporation",
"clientCampaignId": "CAMP-2025-001",
"networkExclusions": ["ESPN+", "Fox Sports"]
}
response = requests.post(url, headers=headers, json=payload)
data = response.json()
print(data)
const url = 'https://api.addressable.tv/client/campaigns';
const headers = {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
};
const payload = {
name: 'Summer 2025 Brand Campaign',
nickname: 'SUM25',
advertiserName: 'Acme Corporation',
clientCampaignId: 'CAMP-2025-001',
networkExclusions: ['ESPN+', 'Fox Sports'],
};
fetch(url, {
method: 'POST',
headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error(error));
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class CreateCampaign {
public static void main(String[] args) {
String payload = """
{
"name": "Summer 2025 Brand Campaign",
"nickname": "SUM25",
"advertiserName": "Acme Corporation",
"clientCampaignId": "CAMP-2025-001",
"networkExclusions": ["ESPN+", "Fox Sports"]
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.addressable.tv/client/campaigns"))
.header("x-api-key", "YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(System.out::println)
.join();
}
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.addressable.tv/client/campaigns"
payload := map[string]interface{}{
"name": "Summer 2025 Brand Campaign",
"nickname": "SUM25",
"advertiserName": "Acme Corporation",
"clientCampaignId": "CAMP-2025-001",
"networkExclusions": []string{"ESPN+", "Fox Sports"},
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Add("x-api-key", "YOUR_API_KEY")
req.Header.Add("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var client = new HttpClient();
var payload = @"{
""name"": ""Summer 2025 Brand Campaign"",
""nickname"": ""SUM25"",
""advertiserName"": ""Acme Corporation"",
""clientCampaignId"": ""CAMP-2025-001"",
""networkExclusions"": [""ESPN+"", ""Fox Sports""]
}";
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.addressable.tv/client/campaigns"),
Content = new StringContent(payload, Encoding.UTF8, "application/json")
};
request.Headers.Add("x-api-key", "YOUR_API_KEY");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
var data = await response.Content.ReadAsStringAsync();
Console.WriteLine(data);
}
}
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
int main()
{
CURL *curl;
CURLcode res;
std::string readBuffer;
const char* payload = R"({
"name": "Summer 2025 Brand Campaign",
"nickname": "SUM25",
"advertiserName": "Acme Corporation",
"clientCampaignId": "CAMP-2025-001",
"networkExclusions": ["ESPN+", "Fox Sports"]
})";
curl = curl_easy_init();
if(curl) {
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.addressable.tv/client/campaigns");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl);
if(res != CURLE_OK)
std::cout << "curl_easy_perform() failed: " << curl_easy_strerror(res) << std::endl;
curl_easy_cleanup(curl);
curl_slist_free_all(headers);
}
std::cout << readBuffer << std::endl;
return 0;
}
Request Schema
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Campaign name |
nickname | string | No | Short campaign identifier |
advertiserName | string | Yes | Advertiser name (will fuzzy-match to existing or create new) |
clientCampaignId | string | Yes | Your internal campaign identifier |
clientAgency | string | No | Agency of Record (AOR) for this campaign |
networkExclusions | string[] | No | List of networks to exclude from activations |
Response Schema
The API returns the created campaign object with additional system-generated fields.Example Response
{
"id": 1234,
"name": "Summer 2025 Brand Campaign",
"nickName": "SUM25",
"status": "NEEDS_APPROVAL",
"clientCampaignId": "CAMP-2025-001",
"clientAgency": "",
"excludedNetworks": ["ESPN+", "Fox Sports"],
"createdAt": "2025-01-15T10:30:00.000Z",
"invalidNetworkExclusions": ["Fox Sports"]
}
Response Fields
| Field | Type | Description |
|---|---|---|
id | number | The unique campaign ID. Save this - you’ll need it when creating orders. |
name | string | Campaign name |
nickName | string | Short campaign identifier |
status | string | Campaign status (see status values below) |
clientCampaignId | string | Your internal campaign identifier |
clientAgency | string | Agency of Record (AOR) for this campaign |
excludedNetworks | string[] | List of networks excluded from activations |
createdAt | string (ISO 8601) | Timestamp when the campaign was created |
invalidNetworkExclusions | string[] | Networks in your exclusion list that don’t match known networks |
Status Values
| Status | Description |
|---|---|
NEEDS_APPROVAL | Newly created, awaiting review |
PENDING | Approved, waiting to start |
ACTIVE | Currently running |
PAUSED | Temporarily paused |
COMPLETE | Finished delivering |
CANCELLED | Cancelled before completion |
Error Responses
Example Error Response
{
"statusCode": 400,
"message": ["name is required", "advertiserName is required"],
"error": "Bad Request"
}
Common Errors
| Error | Cause |
|---|---|
name is required | Missing required name field |
advertiserName is required | Missing required advertiserName field |
clientCampaignId is required | Missing required clientCampaignId field |
Notes
- Initial status is always
NEEDS_APPROVAL- your account team will review and activate - Review
invalidNetworkExclusionsin the response to ensure your network exclusions are recognized - Save the returned
id- you’ll need it when creating orders

