Skip to main content
POST
/
user
/
campaign
Create campaign
curl --request POST \
  --url https://app.autocalls.ai/api/user/campaign \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "assistant_id": 123,
  "timezone": "<string>",
  "max_calls_in_parallel": 123,
  "allowed_hours_start_time": "<string>",
  "allowed_hours_end_time": "<string>",
  "allowed_days": [
    {}
  ],
  "max_retries": 123,
  "retry_interval": 123,
  "retry_on_voicemail": true,
  "retry_on_goal_incomplete": true,
  "goal_completion_variable": "<string>",
  "mark_complete_when_no_leads": true,
  "phone_number_ids": [
    {}
  ]
}
'
import requests

url = "https://app.autocalls.ai/api/user/campaign"

payload = {
"name": "<string>",
"assistant_id": 123,
"timezone": "<string>",
"max_calls_in_parallel": 123,
"allowed_hours_start_time": "<string>",
"allowed_hours_end_time": "<string>",
"allowed_days": [{}],
"max_retries": 123,
"retry_interval": 123,
"retry_on_voicemail": True,
"retry_on_goal_incomplete": True,
"goal_completion_variable": "<string>",
"mark_complete_when_no_leads": True,
"phone_number_ids": [{}]
}
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({
name: '<string>',
assistant_id: 123,
timezone: '<string>',
max_calls_in_parallel: 123,
allowed_hours_start_time: '<string>',
allowed_hours_end_time: '<string>',
allowed_days: [{}],
max_retries: 123,
retry_interval: 123,
retry_on_voicemail: true,
retry_on_goal_incomplete: true,
goal_completion_variable: '<string>',
mark_complete_when_no_leads: true,
phone_number_ids: [{}]
})
};

fetch('https://app.autocalls.ai/api/user/campaign', 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://app.autocalls.ai/api/user/campaign",
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' => '<string>',
'assistant_id' => 123,
'timezone' => '<string>',
'max_calls_in_parallel' => 123,
'allowed_hours_start_time' => '<string>',
'allowed_hours_end_time' => '<string>',
'allowed_days' => [
[

]
],
'max_retries' => 123,
'retry_interval' => 123,
'retry_on_voicemail' => true,
'retry_on_goal_incomplete' => true,
'goal_completion_variable' => '<string>',
'mark_complete_when_no_leads' => true,
'phone_number_ids' => [
[

]
]
]),
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://app.autocalls.ai/api/user/campaign"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"assistant_id\": 123,\n \"timezone\": \"<string>\",\n \"max_calls_in_parallel\": 123,\n \"allowed_hours_start_time\": \"<string>\",\n \"allowed_hours_end_time\": \"<string>\",\n \"allowed_days\": [\n {}\n ],\n \"max_retries\": 123,\n \"retry_interval\": 123,\n \"retry_on_voicemail\": true,\n \"retry_on_goal_incomplete\": true,\n \"goal_completion_variable\": \"<string>\",\n \"mark_complete_when_no_leads\": true,\n \"phone_number_ids\": [\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://app.autocalls.ai/api/user/campaign")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"assistant_id\": 123,\n \"timezone\": \"<string>\",\n \"max_calls_in_parallel\": 123,\n \"allowed_hours_start_time\": \"<string>\",\n \"allowed_hours_end_time\": \"<string>\",\n \"allowed_days\": [\n {}\n ],\n \"max_retries\": 123,\n \"retry_interval\": 123,\n \"retry_on_voicemail\": true,\n \"retry_on_goal_incomplete\": true,\n \"goal_completion_variable\": \"<string>\",\n \"mark_complete_when_no_leads\": true,\n \"phone_number_ids\": [\n {}\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://app.autocalls.ai/api/user/campaign")

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 \"name\": \"<string>\",\n \"assistant_id\": 123,\n \"timezone\": \"<string>\",\n \"max_calls_in_parallel\": 123,\n \"allowed_hours_start_time\": \"<string>\",\n \"allowed_hours_end_time\": \"<string>\",\n \"allowed_days\": [\n {}\n ],\n \"max_retries\": 123,\n \"retry_interval\": 123,\n \"retry_on_voicemail\": true,\n \"retry_on_goal_incomplete\": true,\n \"goal_completion_variable\": \"<string>\",\n \"mark_complete_when_no_leads\": true,\n \"phone_number_ids\": [\n {}\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "message": "Campaign created successfully",
  "data": {
    "id": 1,
    "name": "Product Demo Campaign",
    "status": "draft",
    "max_calls_in_parallel": 3,
    "mark_complete_when_no_leads": true,
    "allowed_hours_start_time": "09:00:00",
    "allowed_hours_end_time": "17:00:00",
    "allowed_days": [
      "monday",
      "tuesday",
      "wednesday",
      "thursday",
      "friday"
    ],
    "max_retries": 3,
    "retry_interval": 60,
    "created_at": "2026-02-23T10:00:00.000000Z",
    "updated_at": "2026-02-23T10:00:00.000000Z"
  }
}
{
  "message": "You have reached the maximum number of campaigns allowed by your plan."
}
{
  "message": "Assistant not found or not an outbound assistant."
}
{
  "message": "The given data was invalid.",
  "errors": {
    "name": [
      "The name field is required."
    ],
    "assistant_id": [
      "The assistant id field is required."
    ]
  }
}
This endpoint allows you to create a new outbound calling campaign with the specified configuration.

Request body

name
string
required
The name of the campaign. Maximum 255 characters.
assistant_id
integer
required
The ID of the assistant to use for the campaign. Must be an outbound-capable assistant.
timezone
string
Timezone identifier for the campaign (e.g., America/New_York, Europe/London). Defaults to your account timezone.
max_calls_in_parallel
integer
default:"3"
Maximum number of simultaneous calls. Minimum: 1. Maximum depends on your plan’s parallel calls limit (up to 10).
allowed_hours_start_time
string
default:"00:00"
Start of the allowed calling window in H:i format (e.g., 09:00).
allowed_hours_end_time
string
default:"23:59"
End of the allowed calling window in H:i format (e.g., 17:00).
allowed_days
array
default:"all 7 days"
Array of weekday names when calls are allowed. Valid values: monday, tuesday, wednesday, thursday, friday, saturday, sunday.
max_retries
integer
default:"3"
Maximum number of retry attempts for failed calls. Range: 1-5.
retry_interval
integer
default:"60"
Interval in minutes between retry attempts. Range: 10-4320 (up to 3 days).
retry_on_voicemail
boolean
Whether to retry calls that reached voicemail.
retry_on_goal_incomplete
boolean
Whether to retry calls where the goal was not completed.
goal_completion_variable
string
Name of a boolean variable from your assistant’s post-call schema to track goal completion. Maximum 255 characters.
mark_complete_when_no_leads
boolean
default:"true"
Whether to automatically mark the campaign as complete when there are no remaining leads to call.
phone_number_ids
array
Array of phone number IDs to use for the campaign. Each ID must be a distinct integer.

Response

message
string
Success message confirming the campaign was created
data
object
The created campaign data

Error Responses

403 Forbidden
404 Not Found
422 Validation Error
{
  "message": "Campaign created successfully",
  "data": {
    "id": 1,
    "name": "Product Demo Campaign",
    "status": "draft",
    "max_calls_in_parallel": 3,
    "mark_complete_when_no_leads": true,
    "allowed_hours_start_time": "09:00:00",
    "allowed_hours_end_time": "17:00:00",
    "allowed_days": [
      "monday",
      "tuesday",
      "wednesday",
      "thursday",
      "friday"
    ],
    "max_retries": 3,
    "retry_interval": 60,
    "created_at": "2026-02-23T10:00:00.000000Z",
    "updated_at": "2026-02-23T10:00:00.000000Z"
  }
}
{
  "message": "You have reached the maximum number of campaigns allowed by your plan."
}
{
  "message": "Assistant not found or not an outbound assistant."
}
{
  "message": "The given data was invalid.",
  "errors": {
    "name": [
      "The name field is required."
    ],
    "assistant_id": [
      "The assistant id field is required."
    ]
  }
}