curl --request PUT \
--url https://my.cloudtalk.io/api/campaigns/add.json \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"Button": [
{
"title": "<string>",
"color": "<string>",
"description": "<string>"
}
],
"status": "<string>",
"has_schedule_date": true,
"schedule_start_date": "2023-12-25",
"schedule_start_time": "<string>",
"answer_wait_time": 123,
"after_call_dialing_auto": true,
"after_call_time": 123,
"is_recording": true,
"call_number_id": 123,
"call_script_id": 123,
"survey_id": 123,
"is_predictive": 123,
"calls_percentage": 123,
"attempts": 123,
"attempts_interval": 123,
"ContactsTag": [
{
"id": 123
}
],
"Agent": [
{
"id": 123
}
],
"Group": [
{
"id": 123
}
]
}
'import requests
url = "https://my.cloudtalk.io/api/campaigns/add.json"
payload = {
"name": "<string>",
"Button": [
{
"title": "<string>",
"color": "<string>",
"description": "<string>"
}
],
"status": "<string>",
"has_schedule_date": True,
"schedule_start_date": "2023-12-25",
"schedule_start_time": "<string>",
"answer_wait_time": 123,
"after_call_dialing_auto": True,
"after_call_time": 123,
"is_recording": True,
"call_number_id": 123,
"call_script_id": 123,
"survey_id": 123,
"is_predictive": 123,
"calls_percentage": 123,
"attempts": 123,
"attempts_interval": 123,
"ContactsTag": [{ "id": 123 }],
"Agent": [{ "id": 123 }],
"Group": [{ "id": 123 }]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
Button: [{title: '<string>', color: '<string>', description: '<string>'}],
status: '<string>',
has_schedule_date: true,
schedule_start_date: '2023-12-25',
schedule_start_time: '<string>',
answer_wait_time: 123,
after_call_dialing_auto: true,
after_call_time: 123,
is_recording: true,
call_number_id: 123,
call_script_id: 123,
survey_id: 123,
is_predictive: 123,
calls_percentage: 123,
attempts: 123,
attempts_interval: 123,
ContactsTag: [{id: 123}],
Agent: [{id: 123}],
Group: [{id: 123}]
})
};
fetch('https://my.cloudtalk.io/api/campaigns/add.json', 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://my.cloudtalk.io/api/campaigns/add.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'Button' => [
[
'title' => '<string>',
'color' => '<string>',
'description' => '<string>'
]
],
'status' => '<string>',
'has_schedule_date' => true,
'schedule_start_date' => '2023-12-25',
'schedule_start_time' => '<string>',
'answer_wait_time' => 123,
'after_call_dialing_auto' => true,
'after_call_time' => 123,
'is_recording' => true,
'call_number_id' => 123,
'call_script_id' => 123,
'survey_id' => 123,
'is_predictive' => 123,
'calls_percentage' => 123,
'attempts' => 123,
'attempts_interval' => 123,
'ContactsTag' => [
[
'id' => 123
]
],
'Agent' => [
[
'id' => 123
]
],
'Group' => [
[
'id' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://my.cloudtalk.io/api/campaigns/add.json"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"Button\": [\n {\n \"title\": \"<string>\",\n \"color\": \"<string>\",\n \"description\": \"<string>\"\n }\n ],\n \"status\": \"<string>\",\n \"has_schedule_date\": true,\n \"schedule_start_date\": \"2023-12-25\",\n \"schedule_start_time\": \"<string>\",\n \"answer_wait_time\": 123,\n \"after_call_dialing_auto\": true,\n \"after_call_time\": 123,\n \"is_recording\": true,\n \"call_number_id\": 123,\n \"call_script_id\": 123,\n \"survey_id\": 123,\n \"is_predictive\": 123,\n \"calls_percentage\": 123,\n \"attempts\": 123,\n \"attempts_interval\": 123,\n \"ContactsTag\": [\n {\n \"id\": 123\n }\n ],\n \"Agent\": [\n {\n \"id\": 123\n }\n ],\n \"Group\": [\n {\n \"id\": 123\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.put("https://my.cloudtalk.io/api/campaigns/add.json")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"Button\": [\n {\n \"title\": \"<string>\",\n \"color\": \"<string>\",\n \"description\": \"<string>\"\n }\n ],\n \"status\": \"<string>\",\n \"has_schedule_date\": true,\n \"schedule_start_date\": \"2023-12-25\",\n \"schedule_start_time\": \"<string>\",\n \"answer_wait_time\": 123,\n \"after_call_dialing_auto\": true,\n \"after_call_time\": 123,\n \"is_recording\": true,\n \"call_number_id\": 123,\n \"call_script_id\": 123,\n \"survey_id\": 123,\n \"is_predictive\": 123,\n \"calls_percentage\": 123,\n \"attempts\": 123,\n \"attempts_interval\": 123,\n \"ContactsTag\": [\n {\n \"id\": 123\n }\n ],\n \"Agent\": [\n {\n \"id\": 123\n }\n ],\n \"Group\": [\n {\n \"id\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://my.cloudtalk.io/api/campaigns/add.json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"Button\": [\n {\n \"title\": \"<string>\",\n \"color\": \"<string>\",\n \"description\": \"<string>\"\n }\n ],\n \"status\": \"<string>\",\n \"has_schedule_date\": true,\n \"schedule_start_date\": \"2023-12-25\",\n \"schedule_start_time\": \"<string>\",\n \"answer_wait_time\": 123,\n \"after_call_dialing_auto\": true,\n \"after_call_time\": 123,\n \"is_recording\": true,\n \"call_number_id\": 123,\n \"call_script_id\": 123,\n \"survey_id\": 123,\n \"is_predictive\": 123,\n \"calls_percentage\": 123,\n \"attempts\": 123,\n \"attempts_interval\": 123,\n \"ContactsTag\": [\n {\n \"id\": 123\n }\n ],\n \"Agent\": [\n {\n \"id\": 123\n }\n ],\n \"Group\": [\n {\n \"id\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"responseData": {
"status": 201,
"data": {
"id": "12345"
}
}
}{
"responseData": {
"status": 406,
"message": "Invalid input data.",
"data": {
"name": [
"Please supply a valid campaign name."
]
}
}
}{
"responseData": {
"status": 500,
"message": "Something went wrong."
}
}Add campaign
Creates a campaign. name and the Button array are required; everything else is optional and configures scheduling (has_schedule_date, schedule_start_date, schedule_start_time), dialing behaviour (answer_wait_time, after_call_dialing_auto, after_call_time, attempts, attempts_interval), predictive mode (is_predictive, calls_percentage), call recording, and which contacts, agents and groups the campaign covers. Returns 201.
Note the core API creates with PUT, not POST.
curl --request PUT \
--url https://my.cloudtalk.io/api/campaigns/add.json \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"Button": [
{
"title": "<string>",
"color": "<string>",
"description": "<string>"
}
],
"status": "<string>",
"has_schedule_date": true,
"schedule_start_date": "2023-12-25",
"schedule_start_time": "<string>",
"answer_wait_time": 123,
"after_call_dialing_auto": true,
"after_call_time": 123,
"is_recording": true,
"call_number_id": 123,
"call_script_id": 123,
"survey_id": 123,
"is_predictive": 123,
"calls_percentage": 123,
"attempts": 123,
"attempts_interval": 123,
"ContactsTag": [
{
"id": 123
}
],
"Agent": [
{
"id": 123
}
],
"Group": [
{
"id": 123
}
]
}
'import requests
url = "https://my.cloudtalk.io/api/campaigns/add.json"
payload = {
"name": "<string>",
"Button": [
{
"title": "<string>",
"color": "<string>",
"description": "<string>"
}
],
"status": "<string>",
"has_schedule_date": True,
"schedule_start_date": "2023-12-25",
"schedule_start_time": "<string>",
"answer_wait_time": 123,
"after_call_dialing_auto": True,
"after_call_time": 123,
"is_recording": True,
"call_number_id": 123,
"call_script_id": 123,
"survey_id": 123,
"is_predictive": 123,
"calls_percentage": 123,
"attempts": 123,
"attempts_interval": 123,
"ContactsTag": [{ "id": 123 }],
"Agent": [{ "id": 123 }],
"Group": [{ "id": 123 }]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
Button: [{title: '<string>', color: '<string>', description: '<string>'}],
status: '<string>',
has_schedule_date: true,
schedule_start_date: '2023-12-25',
schedule_start_time: '<string>',
answer_wait_time: 123,
after_call_dialing_auto: true,
after_call_time: 123,
is_recording: true,
call_number_id: 123,
call_script_id: 123,
survey_id: 123,
is_predictive: 123,
calls_percentage: 123,
attempts: 123,
attempts_interval: 123,
ContactsTag: [{id: 123}],
Agent: [{id: 123}],
Group: [{id: 123}]
})
};
fetch('https://my.cloudtalk.io/api/campaigns/add.json', 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://my.cloudtalk.io/api/campaigns/add.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'Button' => [
[
'title' => '<string>',
'color' => '<string>',
'description' => '<string>'
]
],
'status' => '<string>',
'has_schedule_date' => true,
'schedule_start_date' => '2023-12-25',
'schedule_start_time' => '<string>',
'answer_wait_time' => 123,
'after_call_dialing_auto' => true,
'after_call_time' => 123,
'is_recording' => true,
'call_number_id' => 123,
'call_script_id' => 123,
'survey_id' => 123,
'is_predictive' => 123,
'calls_percentage' => 123,
'attempts' => 123,
'attempts_interval' => 123,
'ContactsTag' => [
[
'id' => 123
]
],
'Agent' => [
[
'id' => 123
]
],
'Group' => [
[
'id' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://my.cloudtalk.io/api/campaigns/add.json"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"Button\": [\n {\n \"title\": \"<string>\",\n \"color\": \"<string>\",\n \"description\": \"<string>\"\n }\n ],\n \"status\": \"<string>\",\n \"has_schedule_date\": true,\n \"schedule_start_date\": \"2023-12-25\",\n \"schedule_start_time\": \"<string>\",\n \"answer_wait_time\": 123,\n \"after_call_dialing_auto\": true,\n \"after_call_time\": 123,\n \"is_recording\": true,\n \"call_number_id\": 123,\n \"call_script_id\": 123,\n \"survey_id\": 123,\n \"is_predictive\": 123,\n \"calls_percentage\": 123,\n \"attempts\": 123,\n \"attempts_interval\": 123,\n \"ContactsTag\": [\n {\n \"id\": 123\n }\n ],\n \"Agent\": [\n {\n \"id\": 123\n }\n ],\n \"Group\": [\n {\n \"id\": 123\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.put("https://my.cloudtalk.io/api/campaigns/add.json")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"Button\": [\n {\n \"title\": \"<string>\",\n \"color\": \"<string>\",\n \"description\": \"<string>\"\n }\n ],\n \"status\": \"<string>\",\n \"has_schedule_date\": true,\n \"schedule_start_date\": \"2023-12-25\",\n \"schedule_start_time\": \"<string>\",\n \"answer_wait_time\": 123,\n \"after_call_dialing_auto\": true,\n \"after_call_time\": 123,\n \"is_recording\": true,\n \"call_number_id\": 123,\n \"call_script_id\": 123,\n \"survey_id\": 123,\n \"is_predictive\": 123,\n \"calls_percentage\": 123,\n \"attempts\": 123,\n \"attempts_interval\": 123,\n \"ContactsTag\": [\n {\n \"id\": 123\n }\n ],\n \"Agent\": [\n {\n \"id\": 123\n }\n ],\n \"Group\": [\n {\n \"id\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://my.cloudtalk.io/api/campaigns/add.json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"Button\": [\n {\n \"title\": \"<string>\",\n \"color\": \"<string>\",\n \"description\": \"<string>\"\n }\n ],\n \"status\": \"<string>\",\n \"has_schedule_date\": true,\n \"schedule_start_date\": \"2023-12-25\",\n \"schedule_start_time\": \"<string>\",\n \"answer_wait_time\": 123,\n \"after_call_dialing_auto\": true,\n \"after_call_time\": 123,\n \"is_recording\": true,\n \"call_number_id\": 123,\n \"call_script_id\": 123,\n \"survey_id\": 123,\n \"is_predictive\": 123,\n \"calls_percentage\": 123,\n \"attempts\": 123,\n \"attempts_interval\": 123,\n \"ContactsTag\": [\n {\n \"id\": 123\n }\n ],\n \"Agent\": [\n {\n \"id\": 123\n }\n ],\n \"Group\": [\n {\n \"id\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"responseData": {
"status": 201,
"data": {
"id": "12345"
}
}
}{
"responseData": {
"status": 406,
"message": "Invalid input data.",
"data": {
"name": [
"Please supply a valid campaign name."
]
}
}
}{
"responseData": {
"status": 500,
"message": "Something went wrong."
}
}Authorizations
HTTP Basic Authentication. Use your API Access Key ID as the username and your API Access Key Secret as the password. Generate keys in the CloudTalk Dashboard under Account -> Settings -> API Keys (https://dashboard.cloudtalk.io/menu/account/settings/API-keys).
Body
Campaign name
Show child attributes
Show child attributes
Campaign status (active/inactive)
Is campaign scheduled?
Campaign start date
Campaign start time
Maximum number of seconds we will wait for the call to be answered.
Automatically dial next contact after a call ends true/false
After call time (in seconds)
Calls recording true/false
Outbound caller id
Call script ID
Survey ID
Is predictive dialer campaign 0/1
Agents utilization
Attempts per contact
Hours between attempts
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
No error
Show child attributes
Show child attributes