Create campaign
curl --request POST \
--url https://{domain}/api/v2/network/campaigns \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Sample Campaign",
"affiliate_id": 1,
"offer_id": 1,
"commission_plan_id": 1,
"landing_page_id": 1,
"traffic_source_id": 1,
"creative_id": null
}
'import requests
url = "https://{domain}/api/v2/network/campaigns"
payload = {
"name": "Sample Campaign",
"affiliate_id": 1,
"offer_id": 1,
"commission_plan_id": 1,
"landing_page_id": 1,
"traffic_source_id": 1,
"creative_id": None
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Sample Campaign',
affiliate_id: 1,
offer_id: 1,
commission_plan_id: 1,
landing_page_id: 1,
traffic_source_id: 1,
creative_id: null
})
};
fetch('https://{domain}/api/v2/network/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://{domain}/api/v2/network/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([
'name' => 'Sample Campaign',
'affiliate_id' => 1,
'offer_id' => 1,
'commission_plan_id' => 1,
'landing_page_id' => 1,
'traffic_source_id' => 1,
'creative_id' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://{domain}/api/v2/network/campaigns"
payload := strings.NewReader("{\n \"name\": \"Sample Campaign\",\n \"affiliate_id\": 1,\n \"offer_id\": 1,\n \"commission_plan_id\": 1,\n \"landing_page_id\": 1,\n \"traffic_source_id\": 1,\n \"creative_id\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://{domain}/api/v2/network/campaigns")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Sample Campaign\",\n \"affiliate_id\": 1,\n \"offer_id\": 1,\n \"commission_plan_id\": 1,\n \"landing_page_id\": 1,\n \"traffic_source_id\": 1,\n \"creative_id\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{domain}/api/v2/network/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Sample Campaign\",\n \"affiliate_id\": 1,\n \"offer_id\": 1,\n \"commission_plan_id\": 1,\n \"landing_page_id\": 1,\n \"traffic_source_id\": 1,\n \"creative_id\": null\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"code": 201,
"name": "Created",
"message": "Campaign created",
"info": {
"campaign": {
"id": 123,
"hash": "<string>",
"name": "<string>",
"status": "active",
"created": 123,
"date_added": 123,
"date_updated": 123,
"offer": {
"id": 123,
"title": "<string>",
"image": "<string>"
},
"affiliate": {
"id": 123,
"title": "<string>"
},
"advertiser": {
"id": 123,
"title": "<string>"
},
"commission_plan": {
"id": 123,
"title": "<string>"
},
"traffic_source": {
"id": 123,
"title": "<string>"
},
"traffic_approach": {
"id": 123,
"title": "<string>"
},
"landing_page": {
"id": 123,
"title": "<string>",
"offer_id": 123
},
"creative": {
"id": 123,
"title": "<string>"
}
}
}
}{
"status": "error",
"code": 422,
"name": "Unprocessable entity",
"message": "<string>",
"info": {
"errors": {}
}
}Campaigns
Create campaign
Creates a new campaign for the specified affiliate. The hash is generated server-side and cannot be set by the caller. If status is omitted the campaign is created as active. commission_plan_id is required on Brand and Marketplace platforms; optional on Network platforms.
POST
/
api
/
v2
/
network
/
campaigns
Create campaign
curl --request POST \
--url https://{domain}/api/v2/network/campaigns \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Sample Campaign",
"affiliate_id": 1,
"offer_id": 1,
"commission_plan_id": 1,
"landing_page_id": 1,
"traffic_source_id": 1,
"creative_id": null
}
'import requests
url = "https://{domain}/api/v2/network/campaigns"
payload = {
"name": "Sample Campaign",
"affiliate_id": 1,
"offer_id": 1,
"commission_plan_id": 1,
"landing_page_id": 1,
"traffic_source_id": 1,
"creative_id": None
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Sample Campaign',
affiliate_id: 1,
offer_id: 1,
commission_plan_id: 1,
landing_page_id: 1,
traffic_source_id: 1,
creative_id: null
})
};
fetch('https://{domain}/api/v2/network/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://{domain}/api/v2/network/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([
'name' => 'Sample Campaign',
'affiliate_id' => 1,
'offer_id' => 1,
'commission_plan_id' => 1,
'landing_page_id' => 1,
'traffic_source_id' => 1,
'creative_id' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://{domain}/api/v2/network/campaigns"
payload := strings.NewReader("{\n \"name\": \"Sample Campaign\",\n \"affiliate_id\": 1,\n \"offer_id\": 1,\n \"commission_plan_id\": 1,\n \"landing_page_id\": 1,\n \"traffic_source_id\": 1,\n \"creative_id\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://{domain}/api/v2/network/campaigns")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Sample Campaign\",\n \"affiliate_id\": 1,\n \"offer_id\": 1,\n \"commission_plan_id\": 1,\n \"landing_page_id\": 1,\n \"traffic_source_id\": 1,\n \"creative_id\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{domain}/api/v2/network/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Sample Campaign\",\n \"affiliate_id\": 1,\n \"offer_id\": 1,\n \"commission_plan_id\": 1,\n \"landing_page_id\": 1,\n \"traffic_source_id\": 1,\n \"creative_id\": null\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"code": 201,
"name": "Created",
"message": "Campaign created",
"info": {
"campaign": {
"id": 123,
"hash": "<string>",
"name": "<string>",
"status": "active",
"created": 123,
"date_added": 123,
"date_updated": 123,
"offer": {
"id": 123,
"title": "<string>",
"image": "<string>"
},
"affiliate": {
"id": 123,
"title": "<string>"
},
"advertiser": {
"id": 123,
"title": "<string>"
},
"commission_plan": {
"id": 123,
"title": "<string>"
},
"traffic_source": {
"id": 123,
"title": "<string>"
},
"traffic_approach": {
"id": 123,
"title": "<string>"
},
"landing_page": {
"id": 123,
"title": "<string>",
"offer_id": 123
},
"creative": {
"id": 123,
"title": "<string>"
}
}
}
}{
"status": "error",
"code": 422,
"name": "Unprocessable entity",
"message": "<string>",
"info": {
"errors": {}
}
}Authorizations
ApiKeyHeaderAuthApiKeyAuth
Body
application/json
Was this page helpful?