Skip to main content
POST
/
v1
/
sms
Send SMS
curl --request POST \
  --url https://api.nixflex.com/v1/sms
Sends a single SMS via your Twilio number. Useful for one-off messages, status updates, or reminders that do not need a phone call.

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

FieldTypeRequiredNotes
agent_idstringYesAgent that owns this SMS — its system_prompt handles any replies
tostringYesRecipient in E.164
from_numberstringYesYour imported Twilio number
messagestringYesMessage text. 600 chars recommended for reliable carrier delivery. Twilio hard cap is 1600. See SMS length guide.

Response

201 Created:
{
  "status": "sent",
  "to": "+447386172392",
  "from": "+447446466847"
}
Status updates come asynchronously via Twilio status callbacks. Final status (delivered, failed, undelivered) reflects in the message record within ~30 seconds.

Reply behaviour

If the recipient replies, the agent automatically answers using its system_prompt. There is no separate reply-handling system or context field. Best practice: if recipients might reply to your SMS, include the relevant context (what you sent, what you expect them to ask) in the agent system_prompt before sending. See Send SMS concept page for details.

Errors

CodeCause
from_number_not_ownedfrom_number is not in your account
message_too_longMessage over 1600 chars
sms_not_supported_in_regionUS number without A2P 10DLC
recipient_unsubscribedRecipient previously sent STOP