Skip to main content
POST
/
networks
/
trafficcontrols
Create Traffic Control
curl --request POST \
  --url https://api.eflow.team/v1/networks/trafficcontrols \
  --header 'Content-Type: application/json' \
  --header 'X-Eflow-Api-Key: <api-key>' \
  --data '
{
  "name": "Block Bad Sources",
  "status": "active",
  "control_type": "blacklist",
  "targeting_action": "block",
  "comparison_method": "exact_match",
  "is_apply_all_affiliates": false,
  "is_apply_all_offers": false,
  "variables": [
    "source_id",
    "sub3"
  ],
  "network_offer_ids": [
    5
  ],
  "network_affiliate_ids": [
    7,
    14,
    21
  ],
  "network_advertiser_ids": [],
  "values": [
    "bad_source_1",
    "bad_source_2"
  ]
}
'
import requests

url = "https://api.eflow.team/v1/networks/trafficcontrols"

payload = {
    "name": "Block Bad Sources",
    "status": "active",
    "control_type": "blacklist",
    "targeting_action": "block",
    "comparison_method": "exact_match",
    "is_apply_all_affiliates": False,
    "is_apply_all_offers": False,
    "variables": ["source_id", "sub3"],
    "network_offer_ids": [5],
    "network_affiliate_ids": [7, 14, 21],
    "network_advertiser_ids": [],
    "values": ["bad_source_1", "bad_source_2"]
}
headers = {
    "X-Eflow-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-Eflow-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    name: 'Block Bad Sources',
    status: 'active',
    control_type: 'blacklist',
    targeting_action: 'block',
    comparison_method: 'exact_match',
    is_apply_all_affiliates: false,
    is_apply_all_offers: false,
    variables: ['source_id', 'sub3'],
    network_offer_ids: [5],
    network_affiliate_ids: [7, 14, 21],
    network_advertiser_ids: [],
    values: ['bad_source_1', 'bad_source_2']
  })
};

fetch('https://api.eflow.team/v1/networks/trafficcontrols', 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.eflow.team/v1/networks/trafficcontrols",
  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' => 'Block Bad Sources',
    'status' => 'active',
    'control_type' => 'blacklist',
    'targeting_action' => 'block',
    'comparison_method' => 'exact_match',
    'is_apply_all_affiliates' => false,
    'is_apply_all_offers' => false,
    'variables' => [
        'source_id',
        'sub3'
    ],
    'network_offer_ids' => [
        5
    ],
    'network_affiliate_ids' => [
        7,
        14,
        21
    ],
    'network_advertiser_ids' => [
        
    ],
    'values' => [
        'bad_source_1',
        'bad_source_2'
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "X-Eflow-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://api.eflow.team/v1/networks/trafficcontrols"

	payload := strings.NewReader("{\n  \"name\": \"Block Bad Sources\",\n  \"status\": \"active\",\n  \"control_type\": \"blacklist\",\n  \"targeting_action\": \"block\",\n  \"comparison_method\": \"exact_match\",\n  \"is_apply_all_affiliates\": false,\n  \"is_apply_all_offers\": false,\n  \"variables\": [\n    \"source_id\",\n    \"sub3\"\n  ],\n  \"network_offer_ids\": [\n    5\n  ],\n  \"network_affiliate_ids\": [\n    7,\n    14,\n    21\n  ],\n  \"network_advertiser_ids\": [],\n  \"values\": [\n    \"bad_source_1\",\n    \"bad_source_2\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-Eflow-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://api.eflow.team/v1/networks/trafficcontrols")
  .header("X-Eflow-Api-Key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Block Bad Sources\",\n  \"status\": \"active\",\n  \"control_type\": \"blacklist\",\n  \"targeting_action\": \"block\",\n  \"comparison_method\": \"exact_match\",\n  \"is_apply_all_affiliates\": false,\n  \"is_apply_all_offers\": false,\n  \"variables\": [\n    \"source_id\",\n    \"sub3\"\n  ],\n  \"network_offer_ids\": [\n    5\n  ],\n  \"network_affiliate_ids\": [\n    7,\n    14,\n    21\n  ],\n  \"network_advertiser_ids\": [],\n  \"values\": [\n    \"bad_source_1\",\n    \"bad_source_2\"\n  ]\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.eflow.team/v1/networks/trafficcontrols")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Eflow-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Block Bad Sources\",\n  \"status\": \"active\",\n  \"control_type\": \"blacklist\",\n  \"targeting_action\": \"block\",\n  \"comparison_method\": \"exact_match\",\n  \"is_apply_all_affiliates\": false,\n  \"is_apply_all_offers\": false,\n  \"variables\": [\n    \"source_id\",\n    \"sub3\"\n  ],\n  \"network_offer_ids\": [\n    5\n  ],\n  \"network_affiliate_ids\": [\n    7,\n    14,\n    21\n  ],\n  \"network_advertiser_ids\": [],\n  \"values\": [\n    \"bad_source_1\",\n    \"bad_source_2\"\n  ]\n}"

response = http.request(request)
puts response.read_body
{
  "network_traffic_control_id": 1,
  "network_id": 1,
  "name": "Block Bad Sources",
  "status": "active",
  "is_apply_all_affiliates": true,
  "is_apply_all_offers": true,
  "control_type": "blacklist",
  "targeting_action": "block",
  "date_valid_from": "",
  "date_valid_to": "",
  "comparison_method": "exact_match",
  "variables": [
    "source_id",
    "sub3"
  ],
  "time_created": 1774721611,
  "time_saved": 1774721611,
  "relationship": {
    "network_offer_ids": null,
    "network_affiliate_ids": null,
    "network_advertiser_ids": null,
    "values": [
      "bad_source_1",
      "bad_source_2"
    ]
  }
}
Create a new network-level traffic control rule. Traffic controls define rules for blocking or filtering traffic based on specified criteria and comparison methods.

Authorizations

X-Eflow-Api-Key
string
header
required

The Everflow API key generated from the Control Center > Security.

Body

application/json
name
string
required

Name of the traffic control.

status
enum<string>
required

Status of the traffic control.

Available options:
active,
inactive
control_type
enum<string>
required

Traffic controls can be either whitelist or blacklist.

Available options:
blacklist,
whitelist
targeting_action
enum<string>
required

The targeting action can be either block or fail_traffic.

Available options:
block,
fail_traffic
comparison_method
enum<string>
required

Defines how the variables will be compared.

Available options:
exact_match,
contains,
begins_with,
ends_with,
does_not_contain,
does_not_match,
is_empty
is_apply_all_affiliates
boolean
required

When this is false, the network_affiliate_ids array must be filled.

is_apply_all_offers
boolean
required

When this is false, the network_offer_ids or network_advertiser_ids array must be filled.

variables
enum<string>[]
required

The click variable that will be looked up and compared to the values supplied. Can be one or multiple values among: sub1, sub2, sub3, sub4, sub5, sub6, sub7, sub8, sub9, sub10, source_id, referrer, isp, ip, user_agent, country, tracking_domain.

Available options:
sub1,
sub2,
sub3,
sub4,
sub5,
sub6,
sub7,
sub8,
sub9,
sub10,
source_id,
referrer,
isp,
ip,
user_agent,
country,
tracking_domain
values
string[]
required

The values that the traffic control will filter. Limited to 3000 values when using exact_match and 100 values otherwise. Please note that when using a whitelist, all values besides the ones specified here will be blocked / sent to fail traffic.

network_offer_ids
integer[]

The offers IDs that will be affected by the traffic control (only relevant when is_apply_all_offers is set to false).

network_affiliate_ids
integer[]

The affiliate IDs that will be affected by the traffic control (only relevant when is_apply_all_affiliates is set to false).

network_advertiser_ids
integer[]

The advertiser IDs that will be affected by the traffic control (only relevant when is_apply_all_offers is set to false). All offers for the specified advertiser IDs will be affected.

date_valid_from
string

An optional start date after which the traffic control will be enforced. Use the YYYY-MM-DD format.

date_valid_to
string

An optional end date after which the traffic control will no longer be enforced. Use the YYYY-MM-DD format.

Response

200 - application/json
network_traffic_control_id
integer

Unique traffic control ID.

network_id
integer

Network ID.

name
string

Name of the traffic control.

status
enum<string>

Status of the traffic control.

Available options:
active,
inactive
control_type
enum<string>

Traffic controls can be either whitelist or blacklist.

Available options:
blacklist,
whitelist
targeting_action
enum<string>

The targeting action.

Available options:
block,
fail_traffic
is_apply_all_offers
boolean

Whether this control applies to all offers.

is_apply_all_affiliates
boolean

Whether this control applies to all affiliates.

comparison_method
enum<string>

Defines how the variables are compared.

Available options:
exact_match,
contains,
begins_with,
ends_with,
does_not_contain,
does_not_match,
is_empty
variables
enum<string>[]

The click variable that will be looked up and compared to the values supplied. Can be one or multiple values among: sub1, sub2, sub3, sub4, sub5, sub6, sub7, sub8, sub9, sub10, source_id, referrer, isp, ip, user_agent, country, tracking_domain. Note: variables and values are only populated by the Get by ID endpoint.

Available options:
sub1,
sub2,
sub3,
sub4,
sub5,
sub6,
sub7,
sub8,
sub9,
sub10,
source_id,
referrer,
isp,
ip,
user_agent,
country,
tracking_domain
relationship
object

Related entities associated with this traffic control.

date_valid_from
string

Start date for the control's validity period (YYYY-MM-DD).

date_valid_to
string

End date for the control's validity period (YYYY-MM-DD).

time_created
integer

Unix timestamp of creation.

Example:

1734455015

time_saved
integer

Unix timestamp of last update.

Example:

1734455015