curl --request POST \
--url "https://api.nixflex.com/v1/sms" \
--header "Authorization: Bearer $NIXFLEX_API_KEY" \
--header "Content-Type: application/json" \
--data "{\"agent_id\":\"$NXF_AGENT_ID\",\"from_number\":\"$NXF_PHONE_NUMBER\",\"to\":\"$NXF_TO_NUMBER\",\"message\":\"Your requested update\"}"
import Nixflex from 'nixflex';
const baseUrl = 'https://api.nixflex.com';
const client = new Nixflex({apiKey:process.env.NIXFLEX_API_KEY,baseUrl,maxRetries:0});
const result = await client.sms.send({agent_id:process.env.NXF_AGENT_ID,from_number:process.env.NXF_PHONE_NUMBER,to:process.env.NXF_TO_NUMBER,message:"Your requested update"});
// Handle result privately; do not log secrets or call content.
import os, json
from pathlib import Path
from nixflex import Nixflex
base_url = "https://api.nixflex.com"
with Nixflex(os.environ["NIXFLEX_API_KEY"], base_url=base_url,max_retries=0) as client:
result = client.sms.send(agent_id=os.environ["NXF_AGENT_ID"],from_number=os.environ["NXF_PHONE_NUMBER"],to=os.environ["NXF_TO_NUMBER"],message="Your requested update")
# AsyncNixflex supports the same calls with await (and async with).
nixflex sms send --agent "$NXF_AGENT_ID" --from "$NXF_PHONE_NUMBER" --to "$NXF_TO_NUMBER" --message "Your requested update" --base-url https://api.nixflex.com --json
{
"status": "sent",
"to": "+12025550101",
"from": "+12025550100"
}
SMS
Send an SMS
Send one SMS through Nixflex using an explicit, owned sender assigned to the agent. Distinguish acceptance from delivery and handle uncertain results.
POST
/
sms
curl --request POST \
--url "https://api.nixflex.com/v1/sms" \
--header "Authorization: Bearer $NIXFLEX_API_KEY" \
--header "Content-Type: application/json" \
--data "{\"agent_id\":\"$NXF_AGENT_ID\",\"from_number\":\"$NXF_PHONE_NUMBER\",\"to\":\"$NXF_TO_NUMBER\",\"message\":\"Your requested update\"}"
import Nixflex from 'nixflex';
const baseUrl = 'https://api.nixflex.com';
const client = new Nixflex({apiKey:process.env.NIXFLEX_API_KEY,baseUrl,maxRetries:0});
const result = await client.sms.send({agent_id:process.env.NXF_AGENT_ID,from_number:process.env.NXF_PHONE_NUMBER,to:process.env.NXF_TO_NUMBER,message:"Your requested update"});
// Handle result privately; do not log secrets or call content.
import os, json
from pathlib import Path
from nixflex import Nixflex
base_url = "https://api.nixflex.com"
with Nixflex(os.environ["NIXFLEX_API_KEY"], base_url=base_url,max_retries=0) as client:
result = client.sms.send(agent_id=os.environ["NXF_AGENT_ID"],from_number=os.environ["NXF_PHONE_NUMBER"],to=os.environ["NXF_TO_NUMBER"],message="Your requested update")
# AsyncNixflex supports the same calls with await (and async with).
nixflex sms send --agent "$NXF_AGENT_ID" --from "$NXF_PHONE_NUMBER" --to "$NXF_TO_NUMBER" --message "Your requested update" --base-url https://api.nixflex.com --json
{
"status": "sent",
"to": "+12025550101",
"from": "+12025550100"
}
FIXED · call In-call texting requires incall_sms_enabled on the agent, an SMS-capable business number and valid carrier credentials. An API-imported Twilio or Telnyx number sends in-call texts like any other number when these hold. Inbound sends from the dialled number to its caller. Outbound sends from the originating number to the person called. Respect opt-outs on both paths. Never substitute another tenant’s sender.
NOT OFFERED → do this instead · number SMS does not automatically inherit the inbound phone profile. Put this business’s SMS instructions in sms_prompt and configure automatic replies for its number.
YOU CAN CHANGE · number Choose sms_reply_enabled and sms_prompt for this number. Keep business-specific details separate when numbers share an agent.
SCOPE · message A single text, an automatic conversation reply and a call-triggered text are separate sends. A single text appears in that number’s SMS thread and does not pause automatic replies. Keep each message’s sender, receipt and consent together.
Read the compact AI rules
Send one SMS using an explicit sender owned by the account and assigned to the requested agent. A 201 sent response means the send was accepted; it does not confirm delivery to the recipient.
The endpoint has no dry-run mode. Only send to an authorised recipient. Do not infer a sender from agent settings, and do not send API credentials to a browser. The response can gain receipt fields when that feature is enabled; older successful responses contain only status, to and from.
The sent text appears in that number’s SMS inbox thread and does not pause automatic replies. An accepted message can still return 201 if later local history persistence fails. A receipt-path failure can include outcome, work_id, message_id and safe_to_retry both alongside the error and inside details. Do not infer not-sent from a generic 500 response. Contact-hours refusals use error.code outside_hours or needs_timezone (409), or contact_policy_unavailable (503). Details include outcome:not_sent, sent:false and charged:false. Advisory messages can instead start “Outside calling hours” or “Weekend where they are” and contain the next local window. refused_before_dispatch is a dispatch outcome marker, not an HTTP status or a replacement error.code. An unknown outcome can still mean something was sent.
Compatibility change: suppressed single SMS now returns HTTP 409, error.type=conflict, error.code=do_not_contact. It previously returned HTTP 400 invalid_request. The message was not sent. Stop; never automatically retry a known opt-out. SMS campaigns keep per-recipient hold_reason:do_not_contact instead of returning a blanket 409.
Method: POST ·
Success: 201 ·
Scope: Owning account
The important part
- This request can send a real text; there is no general replay guarantee.
- Carrier acceptance does not confirm that the recipient read or received the message.
Authentication
SendAuthorization: Bearer KEY_ID:KEY_SECRET using the owning account’s server-side credential. Send Content-Type: application/json.
Request fields
Send a JSON object.| Field | Type | Required | Default | Limits and meaning |
|---|---|---|---|---|
agent_id | string | Yes | None | Owned agent ID. Minimum 1 characters. |
from_number | string | Yes | None | Explicit owned, settled sender assigned to this agent. There is no agent-number fallback. Minimum 1 characters. |
to | string | Yes | None | Recipient number. This field is to, not to_number. Minimum 1 characters. |
message | string | Yes | None | Nonempty text. This route declares no fixed character cap; encoding, segmentation and connection limits still apply. Minimum 1 characters. |
context | object | No | Omitted | Optional JSON context saved with the accepted outbound message. |
context.reply_context | string or null | No | Omitted | Optional instructions for a later reply context. |
recipient_timezone | string | No | Omitted | Optional recipient IANA time zone for contact checks. |
recipient_country | string | No | Omitted | Optional two-letter recipient country code. |
Response fields
201 Created returns the shape below. Nullable fields can be unknown or unset; do not turn null into zero or false.
| Field | Type | Meaning |
|---|---|---|
status | string | Accepted send state; not a delivery receipt. |
to | string | Recipient. |
from | string | Sender. |
message_id | string or null | Optional accepted message identity when account receipts are enabled. |
work_id | string or null | Optional work receipt identity. |
persistence | string | Optional persistence state returned by the receipt path. |
safe_to_retry | boolean | False when supplied; do not resend an accepted message. |
Example request
Raw HTTP base URL:https://api.nixflex.com/v1. Node and Python SDK base URL: https://api.nixflex.com. The SDK adds /v1. Keep NIXFLEX_API_KEY in your private process environment. The shell examples use Bash syntax. SDK and CLI examples require Node/CLI 0.11.0 or later and Python 0.4.0 or later. Set NXF_AGENT_ID, NXF_PHONE_NUMBER, NXF_TO_NUMBER to the intended account-owned identifiers or approved recipient before running. Running a successful example contacts the recipient; use only an approved test destination.
curl --request POST \
--url "https://api.nixflex.com/v1/sms" \
--header "Authorization: Bearer $NIXFLEX_API_KEY" \
--header "Content-Type: application/json" \
--data "{\"agent_id\":\"$NXF_AGENT_ID\",\"from_number\":\"$NXF_PHONE_NUMBER\",\"to\":\"$NXF_TO_NUMBER\",\"message\":\"Your requested update\"}"
import Nixflex from 'nixflex';
const baseUrl = 'https://api.nixflex.com';
const client = new Nixflex({apiKey:process.env.NIXFLEX_API_KEY,baseUrl,maxRetries:0});
const result = await client.sms.send({agent_id:process.env.NXF_AGENT_ID,from_number:process.env.NXF_PHONE_NUMBER,to:process.env.NXF_TO_NUMBER,message:"Your requested update"});
// Handle result privately; do not log secrets or call content.
import os, json
from pathlib import Path
from nixflex import Nixflex
base_url = "https://api.nixflex.com"
with Nixflex(os.environ["NIXFLEX_API_KEY"], base_url=base_url,max_retries=0) as client:
result = client.sms.send(agent_id=os.environ["NXF_AGENT_ID"],from_number=os.environ["NXF_PHONE_NUMBER"],to=os.environ["NXF_TO_NUMBER"],message="Your requested update")
# AsyncNixflex supports the same calls with await (and async with).
nixflex sms send --agent "$NXF_AGENT_ID" --from "$NXF_PHONE_NUMBER" --to "$NXF_TO_NUMBER" --message "Your requested update" --base-url https://api.nixflex.com --json
Example response
Illustrative201 response. Identifiers and values are examples; some optional or compatibility fields are omitted.
{
"status": "sent",
"to": "+12025550101",
"from": "+12025550100"
}
Errors
Failures return anerror object with code, message, doc_url and optional details. Each code links to the shared error catalog. Read the message and details before deciding whether to resend.
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 400 | missing_field | An agent, recipient, message or sender is missing. | Provide all four required fields. |
| 400 | invalid_request | The sender, assignment, connection or recipient is not permitted. | Read the refusal; use the correct owned sender and respect suppression. |
| 404 | not_found | The agent could not be found for this account. | Use an owned agent ID. |
| 409 | auto_topup_unsupported | The current account funding configuration is not supported for this send. | Resolve the account configuration before sending. |
| 500 | sms_outcome_unknown | The send outcome was not confirmed. | Check the receipt/history before any deliberate new send; do not auto-retry. |
| 500 | server_error | The legacy send path failed or could not confirm a result. | Treat the result as uncertain until reconciled. |
| 409 | needs_timezone | Time zone unknown - add their time zone or country. Nothing was sent or charged for this attempt. | Supply a valid recipient_timezone or recipient_country and recheck policy. |
| 409 | invalid_recipient_timezone | The recipient time zone is invalid. | Use a valid IANA time zone. |
| 409 | invalid_recipient_country | The recipient country is invalid. | Use a valid two-letter country code. |
| 409 | outside_hours | This recipient is outside the permitted local contact hours. Nothing was sent or charged for this attempt. | Use the contact-hours advice and wait for an allowed window. Do not automatically resend. |
| 409 | not_due_local | The recipient is not due for contact in the current local window. | Follow the returned contact-hours guidance. |
| 409 | country_policy_review | The recipient country requires policy review. | Resolve that review before contacting the recipient. |
| 409 | holiday_data_unavailable | Holiday checks could not confirm an allowed window. | Wait for a confirmed policy result. |
| 409 | public_holiday | The recipient-local date is a restricted holiday. | Use the next permitted contact window. |
| 503 | contact_policy_unavailable | Contact hours could not be checked. Try again later. Nothing was sent or charged for this attempt. | Wait and recheck; resend only after confirming this attempt was not sent. |
| 503 | dispatch_safety_unavailable | Dispatch safety could not be confirmed. | Reconcile any existing receipt before deciding on a new request. |
| 409 | do_not_contact | The recipient is suppressed; the message was not sent. | Stop. Respect the opt-out; do not retry or remove it automatically. |
| 401 | unauthorized | The credential is missing or invalid. | Check the full account credential. |
| 429 | rate_limit_exceeded | The account request limit was reached. | Wait for Retry-After. Reconcile uncertain writes before resending. |
Retry and idempotency
Never automatically retry an SMS write. Preserve the accepted message/work IDs where available. If a timeout, connection failure or sms_outcome_unknown occurs, inspect receipts/history before deliberately sending again. An error’s retry hint does not override the no-automatic-write-retry rule.Related endpoints
Authorizations
Body
application/json
Response
Created