Create SMS campaign
curl --request POST \
--url https://api.nixflex.com/v1/sms/campaignsimport requests
url = "https://api.nixflex.com/v1/sms/campaigns"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.nixflex.com/v1/sms/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://api.nixflex.com/v1/sms/campaigns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nixflex.com/v1/sms/campaigns"
req, _ := http.NewRequest("POST", url, nil)
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.nixflex.com/v1/sms/campaigns")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixflex.com/v1/sms/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodySMS
Create SMS campaign
POST /v1/sms/campaigns
POST
/
v1
/
sms
/
campaigns
Create SMS campaign
curl --request POST \
--url https://api.nixflex.com/v1/sms/campaignsimport requests
url = "https://api.nixflex.com/v1/sms/campaigns"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.nixflex.com/v1/sms/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://api.nixflex.com/v1/sms/campaigns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nixflex.com/v1/sms/campaigns"
req, _ := http.NewRequest("POST", url, nil)
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.nixflex.com/v1/sms/campaigns")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixflex.com/v1/sms/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyCreates an SMS campaign. Optionally launches it immediately.
When
Campaigns are one-time broadcasts. Replies are handled by the agent using its
system_prompt — include any campaign context in the agent’s prompt before launching.Request
curl -X POST https://api.nixflex.com/v1/sms/campaigns \
-H "Authorization: Bearer KEY_ID:KEY_SECRET" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agent_125207e452f8714a",
"from_number": "+447446466847",
"name": "March promotion",
"message_template": "Hi {{first_name}}, 20% off cleanings this month at Acme Dental. Reply YES to book.",
"recipients": [
{ "phone": "+447111000001", "variables": { "first_name": "Sarah" } },
{ "phone": "+447111000002", "variables": { "first_name": "James" } }
],
"schedule_type": "now"
}'
Body parameters
| Field | Type | Required | Notes |
|---|---|---|---|
agent_id | string | Yes | Agent associated with the campaign |
from_number | string | Yes | Any number you have imported, on either carrier - Twilio or Telnyx. The campaign uses that number’s own credentials to send, so it must be a number on your account. |
name | string | Yes | Display name in dashboard |
message_template | string | Yes | Message text. Supports {{variable}} placeholders |
recipients | array | Yes | Up to 10,000. Each item: { phone, variables } |
schedule_type | enum | Yes | now or schedule |
scheduled_at | ISO date | If schedule | When to launch |
Recipient object
| Field | Type | Required | Notes |
|---|---|---|---|
phone | string | Yes | E.164 format, e.g. +447111000001 |
variables | object | No | Key-value pairs to fill {{placeholders}} in the template |
Placeholders
Use{{variable_name}} in message_template. Each recipient’s variables object fills them.
Template: Hi {{first_name}}, see you on {{day}}.
Recipient: { "phone": "+44...", "variables": { "first_name": "Sarah", "day": "Tuesday" } }
Sent SMS: Hi Sarah, see you on Tuesday.
Missing variables render as empty strings (no crash).
Response
201 Created:
{
"campaign_id": "smsc_a1b2c3d4",
"agent_id": "agent_125207e452f8714a",
"name": "March promotion",
"status": "running",
"total_count": 2,
"delivered_count": 0,
"failed_count": 0,
"pending_count": 2,
"source": "api",
"created_at": "2026-05-17T03:45:12Z"
}
schedule_type is now, returns status: running and sends immediately. With schedule, returns status: scheduled — launch later with Launch SMS campaign.
Errors
See Errors. Common:agent_not_owned, from_number_not_owned, too_many_recipients, invalid_schedule.