Audience
Create an audience
Creates an audience and its segment record in your organisation, with you as the creator. The audience starts disabled. key defaults to ci_audience.
POST
/
v1
/
audience
Create an audience
curl --request POST \
--url https://api.tagdeliver.com/v1/audience \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "Car buyers",
"description": "Readers of new car reviews",
"name": "car_buyers",
"targets": {
"contextual_category": [
"vehicles"
],
"organisation": [
3
]
}
}
'import requests
url = "https://api.tagdeliver.com/v1/audience"
payload = {
"title": "Car buyers",
"description": "Readers of new car reviews",
"name": "car_buyers",
"targets": {
"contextual_category": ["vehicles"],
"organisation": [3]
}
}
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({
title: 'Car buyers',
description: 'Readers of new car reviews',
name: 'car_buyers',
targets: {contextual_category: ['vehicles'], organisation: [3]}
})
};
fetch('https://api.tagdeliver.com/v1/audience', 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.tagdeliver.com/v1/audience",
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([
'title' => 'Car buyers',
'description' => 'Readers of new car reviews',
'name' => 'car_buyers',
'targets' => [
'contextual_category' => [
'vehicles'
],
'organisation' => [
3
]
]
]),
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.tagdeliver.com/v1/audience"
payload := strings.NewReader("{\n \"title\": \"Car buyers\",\n \"description\": \"Readers of new car reviews\",\n \"name\": \"car_buyers\",\n \"targets\": {\n \"contextual_category\": [\n \"vehicles\"\n ],\n \"organisation\": [\n 3\n ]\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.tagdeliver.com/v1/audience")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Car buyers\",\n \"description\": \"Readers of new car reviews\",\n \"name\": \"car_buyers\",\n \"targets\": {\n \"contextual_category\": [\n \"vehicles\"\n ],\n \"organisation\": [\n 3\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tagdeliver.com/v1/audience")
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 \"title\": \"Car buyers\",\n \"description\": \"Readers of new car reviews\",\n \"name\": \"car_buyers\",\n \"targets\": {\n \"contextual_category\": [\n \"vehicles\"\n ],\n \"organisation\": [\n 3\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"results": {
"id": 12,
"segment_id": 340,
"name": "car_buyers",
"key": "ci_audience",
"enabled": false,
"backfill_enabled": false,
"title": "Car buyers",
"description": "Readers of new car reviews",
"organisation": 3,
"creator": 55,
"creator_name": "Alex Example",
"targets": {
"contextual_category": [
"vehicles"
],
"organisation": [
3
]
}
},
"success": true
}{
"success": false,
"message": "Form errors found: date_range: The data should match one item from enum"
}{
"success": false,
"message": "Token not found."
}{
"success": false,
"message": "User forbidden"
}{
"status": 500,
"message": "An error occurred [4f2k], please try again shortly or contact your account manager for further assistance."
}Authorizations
Body
application/json
Was this page helpful?
⌘I
Create an audience
curl --request POST \
--url https://api.tagdeliver.com/v1/audience \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "Car buyers",
"description": "Readers of new car reviews",
"name": "car_buyers",
"targets": {
"contextual_category": [
"vehicles"
],
"organisation": [
3
]
}
}
'import requests
url = "https://api.tagdeliver.com/v1/audience"
payload = {
"title": "Car buyers",
"description": "Readers of new car reviews",
"name": "car_buyers",
"targets": {
"contextual_category": ["vehicles"],
"organisation": [3]
}
}
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({
title: 'Car buyers',
description: 'Readers of new car reviews',
name: 'car_buyers',
targets: {contextual_category: ['vehicles'], organisation: [3]}
})
};
fetch('https://api.tagdeliver.com/v1/audience', 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.tagdeliver.com/v1/audience",
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([
'title' => 'Car buyers',
'description' => 'Readers of new car reviews',
'name' => 'car_buyers',
'targets' => [
'contextual_category' => [
'vehicles'
],
'organisation' => [
3
]
]
]),
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.tagdeliver.com/v1/audience"
payload := strings.NewReader("{\n \"title\": \"Car buyers\",\n \"description\": \"Readers of new car reviews\",\n \"name\": \"car_buyers\",\n \"targets\": {\n \"contextual_category\": [\n \"vehicles\"\n ],\n \"organisation\": [\n 3\n ]\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.tagdeliver.com/v1/audience")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Car buyers\",\n \"description\": \"Readers of new car reviews\",\n \"name\": \"car_buyers\",\n \"targets\": {\n \"contextual_category\": [\n \"vehicles\"\n ],\n \"organisation\": [\n 3\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tagdeliver.com/v1/audience")
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 \"title\": \"Car buyers\",\n \"description\": \"Readers of new car reviews\",\n \"name\": \"car_buyers\",\n \"targets\": {\n \"contextual_category\": [\n \"vehicles\"\n ],\n \"organisation\": [\n 3\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"results": {
"id": 12,
"segment_id": 340,
"name": "car_buyers",
"key": "ci_audience",
"enabled": false,
"backfill_enabled": false,
"title": "Car buyers",
"description": "Readers of new car reviews",
"organisation": 3,
"creator": 55,
"creator_name": "Alex Example",
"targets": {
"contextual_category": [
"vehicles"
],
"organisation": [
3
]
}
},
"success": true
}{
"success": false,
"message": "Form errors found: date_range: The data should match one item from enum"
}{
"success": false,
"message": "Token not found."
}{
"success": false,
"message": "User forbidden"
}{
"status": 500,
"message": "An error occurred [4f2k], please try again shortly or contact your account manager for further assistance."
}