Create a new campaign
curl --request POST \
--url https://your-instance.example.com/api/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Q2 Lead Gen",
"message": "Hi {{firstName}}, are you still interested?",
"newContacts": [
{
"firstName": "Jamie",
"phoneNumber": "+14155550133"
}
],
"selectedExistingContacts": [
{
"_id": "665f1a0c0e0a4b001a2c9f01",
"firstName": "Sam",
"lastName": "Patel",
"phoneNumber": "+14165550100"
},
{
"_id": "665f1a0c0e0a4b001a2c9f02",
"firstName": "Alex",
"lastName": "Morgan",
"phoneNumber": "+14165550101"
}
],
"scheduleDate": "2026-05-20T15:00:00.000Z",
"isAutopilot": false,
"type": "sms"
}
'import requests
url = "https://your-instance.example.com/api/campaigns"
payload = {
"name": "Q2 Lead Gen",
"message": "Hi {{firstName}}, are you still interested?",
"newContacts": [
{
"firstName": "Jamie",
"phoneNumber": "+14155550133"
}
],
"selectedExistingContacts": [
{
"_id": "665f1a0c0e0a4b001a2c9f01",
"firstName": "Sam",
"lastName": "Patel",
"phoneNumber": "+14165550100"
},
{
"_id": "665f1a0c0e0a4b001a2c9f02",
"firstName": "Alex",
"lastName": "Morgan",
"phoneNumber": "+14165550101"
}
],
"scheduleDate": "2026-05-20T15:00:00.000Z",
"isAutopilot": False,
"type": "sms"
}
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: 'Q2 Lead Gen',
message: 'Hi {{firstName}}, are you still interested?',
newContacts: [{firstName: 'Jamie', phoneNumber: '+14155550133'}],
selectedExistingContacts: [
{
_id: '665f1a0c0e0a4b001a2c9f01',
firstName: 'Sam',
lastName: 'Patel',
phoneNumber: '+14165550100'
},
{
_id: '665f1a0c0e0a4b001a2c9f02',
firstName: 'Alex',
lastName: 'Morgan',
phoneNumber: '+14165550101'
}
],
scheduleDate: '2026-05-20T15:00:00.000Z',
isAutopilot: false,
type: 'sms'
})
};
fetch('https://your-instance.example.com/api/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://your-instance.example.com/api/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' => 'Q2 Lead Gen',
'message' => 'Hi {{firstName}}, are you still interested?',
'newContacts' => [
[
'firstName' => 'Jamie',
'phoneNumber' => '+14155550133'
]
],
'selectedExistingContacts' => [
[
'_id' => '665f1a0c0e0a4b001a2c9f01',
'firstName' => 'Sam',
'lastName' => 'Patel',
'phoneNumber' => '+14165550100'
],
[
'_id' => '665f1a0c0e0a4b001a2c9f02',
'firstName' => 'Alex',
'lastName' => 'Morgan',
'phoneNumber' => '+14165550101'
]
],
'scheduleDate' => '2026-05-20T15:00:00.000Z',
'isAutopilot' => false,
'type' => 'sms'
]),
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://your-instance.example.com/api/campaigns"
payload := strings.NewReader("{\n \"name\": \"Q2 Lead Gen\",\n \"message\": \"Hi {{firstName}}, are you still interested?\",\n \"newContacts\": [\n {\n \"firstName\": \"Jamie\",\n \"phoneNumber\": \"+14155550133\"\n }\n ],\n \"selectedExistingContacts\": [\n {\n \"_id\": \"665f1a0c0e0a4b001a2c9f01\",\n \"firstName\": \"Sam\",\n \"lastName\": \"Patel\",\n \"phoneNumber\": \"+14165550100\"\n },\n {\n \"_id\": \"665f1a0c0e0a4b001a2c9f02\",\n \"firstName\": \"Alex\",\n \"lastName\": \"Morgan\",\n \"phoneNumber\": \"+14165550101\"\n }\n ],\n \"scheduleDate\": \"2026-05-20T15:00:00.000Z\",\n \"isAutopilot\": false,\n \"type\": \"sms\"\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://your-instance.example.com/api/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Q2 Lead Gen\",\n \"message\": \"Hi {{firstName}}, are you still interested?\",\n \"newContacts\": [\n {\n \"firstName\": \"Jamie\",\n \"phoneNumber\": \"+14155550133\"\n }\n ],\n \"selectedExistingContacts\": [\n {\n \"_id\": \"665f1a0c0e0a4b001a2c9f01\",\n \"firstName\": \"Sam\",\n \"lastName\": \"Patel\",\n \"phoneNumber\": \"+14165550100\"\n },\n {\n \"_id\": \"665f1a0c0e0a4b001a2c9f02\",\n \"firstName\": \"Alex\",\n \"lastName\": \"Morgan\",\n \"phoneNumber\": \"+14165550101\"\n }\n ],\n \"scheduleDate\": \"2026-05-20T15:00:00.000Z\",\n \"isAutopilot\": false,\n \"type\": \"sms\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/campaigns")
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\": \"Q2 Lead Gen\",\n \"message\": \"Hi {{firstName}}, are you still interested?\",\n \"newContacts\": [\n {\n \"firstName\": \"Jamie\",\n \"phoneNumber\": \"+14155550133\"\n }\n ],\n \"selectedExistingContacts\": [\n {\n \"_id\": \"665f1a0c0e0a4b001a2c9f01\",\n \"firstName\": \"Sam\",\n \"lastName\": \"Patel\",\n \"phoneNumber\": \"+14165550100\"\n },\n {\n \"_id\": \"665f1a0c0e0a4b001a2c9f02\",\n \"firstName\": \"Alex\",\n \"lastName\": \"Morgan\",\n \"phoneNumber\": \"+14165550101\"\n }\n ],\n \"scheduleDate\": \"2026-05-20T15:00:00.000Z\",\n \"isAutopilot\": false,\n \"type\": \"sms\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Campaign created",
"data": {
"_id": "665f1a0c0e0a4b001a2c9f10",
"name": "Q2 Lead Gen",
"status": "scheduled",
"scheduleDate": "2026-05-20T15:00:00.000Z"
}
}{
"success": false,
"message": "Validation error",
"error": "name is required"
}{
"success": false,
"message": "Validation error",
"error": "name is required"
}Campaigns
Create a new campaign
Creates a new SMS campaign for the authenticated user organization. Accepts new and existing contacts, optional segmentation and assignment configs, and either schedules the campaign for a future date or sends immediately.
POST
/
api
/
campaigns
Create a new campaign
curl --request POST \
--url https://your-instance.example.com/api/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Q2 Lead Gen",
"message": "Hi {{firstName}}, are you still interested?",
"newContacts": [
{
"firstName": "Jamie",
"phoneNumber": "+14155550133"
}
],
"selectedExistingContacts": [
{
"_id": "665f1a0c0e0a4b001a2c9f01",
"firstName": "Sam",
"lastName": "Patel",
"phoneNumber": "+14165550100"
},
{
"_id": "665f1a0c0e0a4b001a2c9f02",
"firstName": "Alex",
"lastName": "Morgan",
"phoneNumber": "+14165550101"
}
],
"scheduleDate": "2026-05-20T15:00:00.000Z",
"isAutopilot": false,
"type": "sms"
}
'import requests
url = "https://your-instance.example.com/api/campaigns"
payload = {
"name": "Q2 Lead Gen",
"message": "Hi {{firstName}}, are you still interested?",
"newContacts": [
{
"firstName": "Jamie",
"phoneNumber": "+14155550133"
}
],
"selectedExistingContacts": [
{
"_id": "665f1a0c0e0a4b001a2c9f01",
"firstName": "Sam",
"lastName": "Patel",
"phoneNumber": "+14165550100"
},
{
"_id": "665f1a0c0e0a4b001a2c9f02",
"firstName": "Alex",
"lastName": "Morgan",
"phoneNumber": "+14165550101"
}
],
"scheduleDate": "2026-05-20T15:00:00.000Z",
"isAutopilot": False,
"type": "sms"
}
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: 'Q2 Lead Gen',
message: 'Hi {{firstName}}, are you still interested?',
newContacts: [{firstName: 'Jamie', phoneNumber: '+14155550133'}],
selectedExistingContacts: [
{
_id: '665f1a0c0e0a4b001a2c9f01',
firstName: 'Sam',
lastName: 'Patel',
phoneNumber: '+14165550100'
},
{
_id: '665f1a0c0e0a4b001a2c9f02',
firstName: 'Alex',
lastName: 'Morgan',
phoneNumber: '+14165550101'
}
],
scheduleDate: '2026-05-20T15:00:00.000Z',
isAutopilot: false,
type: 'sms'
})
};
fetch('https://your-instance.example.com/api/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://your-instance.example.com/api/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' => 'Q2 Lead Gen',
'message' => 'Hi {{firstName}}, are you still interested?',
'newContacts' => [
[
'firstName' => 'Jamie',
'phoneNumber' => '+14155550133'
]
],
'selectedExistingContacts' => [
[
'_id' => '665f1a0c0e0a4b001a2c9f01',
'firstName' => 'Sam',
'lastName' => 'Patel',
'phoneNumber' => '+14165550100'
],
[
'_id' => '665f1a0c0e0a4b001a2c9f02',
'firstName' => 'Alex',
'lastName' => 'Morgan',
'phoneNumber' => '+14165550101'
]
],
'scheduleDate' => '2026-05-20T15:00:00.000Z',
'isAutopilot' => false,
'type' => 'sms'
]),
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://your-instance.example.com/api/campaigns"
payload := strings.NewReader("{\n \"name\": \"Q2 Lead Gen\",\n \"message\": \"Hi {{firstName}}, are you still interested?\",\n \"newContacts\": [\n {\n \"firstName\": \"Jamie\",\n \"phoneNumber\": \"+14155550133\"\n }\n ],\n \"selectedExistingContacts\": [\n {\n \"_id\": \"665f1a0c0e0a4b001a2c9f01\",\n \"firstName\": \"Sam\",\n \"lastName\": \"Patel\",\n \"phoneNumber\": \"+14165550100\"\n },\n {\n \"_id\": \"665f1a0c0e0a4b001a2c9f02\",\n \"firstName\": \"Alex\",\n \"lastName\": \"Morgan\",\n \"phoneNumber\": \"+14165550101\"\n }\n ],\n \"scheduleDate\": \"2026-05-20T15:00:00.000Z\",\n \"isAutopilot\": false,\n \"type\": \"sms\"\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://your-instance.example.com/api/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Q2 Lead Gen\",\n \"message\": \"Hi {{firstName}}, are you still interested?\",\n \"newContacts\": [\n {\n \"firstName\": \"Jamie\",\n \"phoneNumber\": \"+14155550133\"\n }\n ],\n \"selectedExistingContacts\": [\n {\n \"_id\": \"665f1a0c0e0a4b001a2c9f01\",\n \"firstName\": \"Sam\",\n \"lastName\": \"Patel\",\n \"phoneNumber\": \"+14165550100\"\n },\n {\n \"_id\": \"665f1a0c0e0a4b001a2c9f02\",\n \"firstName\": \"Alex\",\n \"lastName\": \"Morgan\",\n \"phoneNumber\": \"+14165550101\"\n }\n ],\n \"scheduleDate\": \"2026-05-20T15:00:00.000Z\",\n \"isAutopilot\": false,\n \"type\": \"sms\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/campaigns")
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\": \"Q2 Lead Gen\",\n \"message\": \"Hi {{firstName}}, are you still interested?\",\n \"newContacts\": [\n {\n \"firstName\": \"Jamie\",\n \"phoneNumber\": \"+14155550133\"\n }\n ],\n \"selectedExistingContacts\": [\n {\n \"_id\": \"665f1a0c0e0a4b001a2c9f01\",\n \"firstName\": \"Sam\",\n \"lastName\": \"Patel\",\n \"phoneNumber\": \"+14165550100\"\n },\n {\n \"_id\": \"665f1a0c0e0a4b001a2c9f02\",\n \"firstName\": \"Alex\",\n \"lastName\": \"Morgan\",\n \"phoneNumber\": \"+14165550101\"\n }\n ],\n \"scheduleDate\": \"2026-05-20T15:00:00.000Z\",\n \"isAutopilot\": false,\n \"type\": \"sms\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Campaign created",
"data": {
"_id": "665f1a0c0e0a4b001a2c9f10",
"name": "Q2 Lead Gen",
"status": "scheduled",
"scheduleDate": "2026-05-20T15:00:00.000Z"
}
}{
"success": false,
"message": "Validation error",
"error": "name is required"
}{
"success": false,
"message": "Validation error",
"error": "name is required"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
Campaign created
Show child attributes
Show child attributes
Example:
{
"_id": "665f1a0c0e0a4b001a2c9f10",
"organizationId": "64ee9a8b1e7f2a0011223344",
"name": "Q2 Lead Gen",
"message": "Hi {{firstName}}, are you still interested in a quote?",
"userIds": ["64ee9a8b1e7f2a0011223399"],
"scheduleDate": "2026-05-20T15:00:00.000Z",
"process": "64eea1110000000000000001",
"contactStatus": "New Lead",
"isAutopilot": false,
"type": "sms",
"status": "scheduled",
"createdBy": {
"_id": "64ee9a8b1e7f2a0011223399",
"fullName": "Alex Rep"
},
"failedUserIds": [],
"failedDetails": [],
"stats": {
"total": 250,
"sent": 0,
"failed": 0,
"successRate": "0%"
},
"createdAt": "2026-05-18T12:34:56.000Z",
"updatedAt": "2026-05-18T12:34:56.000Z"
}
⌘I