Send SMS
curl --request POST \
--url https://api.nixflex.com/v1/smsimport requests
url = "https://api.nixflex.com/v1/sms"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.nixflex.com/v1/sms', 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",
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"
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")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixflex.com/v1/sms")
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
Send SMS
POST /v1/sms
POST
/
v1
/
sms
Send SMS
curl --request POST \
--url https://api.nixflex.com/v1/smsimport requests
url = "https://api.nixflex.com/v1/sms"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.nixflex.com/v1/sms', 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",
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"
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")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixflex.com/v1/sms")
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_bodySends a single SMS from one of your imported numbers. Works on Twilio and Telnyx. Useful for one-off messages, status updates, or reminders that do not need a phone call.
Status updates come asynchronously via your carrier’s status callbacks. Telnyx does not report delivery status yet, so a message sent from a Telnyx number stays at
This endpoint uses
to for the recipient. The outbound-call endpoint (POST /v1/calls/outbound) uses to_number instead. They are different field names for the same idea - sending to_number here will fail with a missing-field error. Double-check when copying between the two.Request
curl -X POST https://api.nixflex.com/v1/sms \
-H "Authorization: Bearer KEY_ID:KEY_SECRET" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agent_125207e452f8714a",
"to": "+447386172392",
"from_number": "+447446466847",
"message": "Reminder: your appointment is tomorrow at 2pm. Reply YES to confirm."
}'
Body parameters
| Field | Type | Required | Notes |
|---|---|---|---|
agent_id | string | Yes | Agent that owns this SMS - its system_prompt handles any replies |
to | string | Yes | Recipient in E.164 (this endpoint uses to, not to_number) |
message | string | Yes | Message text. 600 chars recommended for reliable carrier delivery. Carrier hard caps are typically 1600. See SMS length guide. |
from_number | string | No | Which of your imported numbers to send from, on either carrier. If omitted, the agent’s own number is used. Required only if the agent has no number of its own. |
context | object | No | Optional reply context. Pass { "reply_context": "..." } to give the agent extra background for handling replies to this specific message. |
Response
201 Created:
{
"status": "sent",
"to": "+447386172392",
"from": "+447446466847"
}
sent. Final status (delivered, failed, undelivered) reflects in the message record within ~30 seconds.
Reply behaviour
If the recipient replies, the agent automatically answers using itssystem_prompt. There is no separate reply-handling system.
For per-message context, pass a context object with reply_context - the agent uses it when answering replies to that message. Otherwise, put any standing context the agent needs directly in its system_prompt before sending. See Send SMS concept page for details.
Errors
| HTTP | Error message | Cause |
|---|---|---|
| 400 | Required: agent_id, to, message | One of the required fields is missing |
| 404 | Agent not found | agent_id does not exist or is not yours |
| 400 | from_number required - this agent has no number of its own, so specify which imported number to send from | No from_number passed and the agent has no number |
| 400 | (credentials error) | The chosen number has no carrier credentials stored |
| 500 | Failed to send SMS via Twilio | Twilio rejected the send |