# Save NXF_REQUEST_ID durably before this first deliberate launch.
# Set NXF_TO_NUMBER to an approved recipient; this can place a real call.
curl --request POST \
--url 'https://api.nixflex.com/v1/calls/outbound' \
--header "Authorization: Bearer $NIXFLEX_API_KEY" \
--header 'Content-Type: application/json' \
--data "{\"agent_id\":\"$NXF_AGENT_ID\",\"to_number\":\"$NXF_TO_NUMBER\",\"prompt\":\"Confirm the requested appointment\",\"request_id\":\"$NXF_REQUEST_ID\"}"
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.calls.create({agent_id:process.env.NXF_AGENT_ID,from_number:process.env.NXF_PHONE_NUMBER,to_number:process.env.NXF_TO_NUMBER,prompt:"Confirm the requested appointment"});
// 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.calls.create(agent_id=os.environ["NXF_AGENT_ID"],from_number=os.environ["NXF_PHONE_NUMBER"],to_number=os.environ["NXF_TO_NUMBER"],prompt="Confirm the requested appointment")
# AsyncNixflex supports the same calls with await (and async with).
nixflex calls create --agent "$NXF_AGENT_ID" --from "$NXF_PHONE_NUMBER" --to "$NXF_TO_NUMBER" --prompt "Confirm the requested appointment" --base-url https://api.nixflex.com --json
{
"call_id": "call_example",
"request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
"status": "initiated",
"replayed": true
}
{
"call_id": "call_example",
"status": "initiated",
"to": "+12025550101",
"from": "+12025550100",
"request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082"
}
{
"call_id": "call_example",
"status": "initiated",
"to": "+12025550101",
"from": "+12025550100",
"request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
"request_status": "unconfirmed",
"safe_to_retry": false
}
Calls
Create an outbound call
Start an outbound call with an optional saved UUID. Reconcile replayed, pending and unknown requests without automatically placing another call.
POST
/
calls
/
outbound
# Save NXF_REQUEST_ID durably before this first deliberate launch.
# Set NXF_TO_NUMBER to an approved recipient; this can place a real call.
curl --request POST \
--url 'https://api.nixflex.com/v1/calls/outbound' \
--header "Authorization: Bearer $NIXFLEX_API_KEY" \
--header 'Content-Type: application/json' \
--data "{\"agent_id\":\"$NXF_AGENT_ID\",\"to_number\":\"$NXF_TO_NUMBER\",\"prompt\":\"Confirm the requested appointment\",\"request_id\":\"$NXF_REQUEST_ID\"}"
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.calls.create({agent_id:process.env.NXF_AGENT_ID,from_number:process.env.NXF_PHONE_NUMBER,to_number:process.env.NXF_TO_NUMBER,prompt:"Confirm the requested appointment"});
// 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.calls.create(agent_id=os.environ["NXF_AGENT_ID"],from_number=os.environ["NXF_PHONE_NUMBER"],to_number=os.environ["NXF_TO_NUMBER"],prompt="Confirm the requested appointment")
# AsyncNixflex supports the same calls with await (and async with).
nixflex calls create --agent "$NXF_AGENT_ID" --from "$NXF_PHONE_NUMBER" --to "$NXF_TO_NUMBER" --prompt "Confirm the requested appointment" --base-url https://api.nixflex.com --json
{
"call_id": "call_example",
"request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
"status": "initiated",
"replayed": true
}
{
"call_id": "call_example",
"status": "initiated",
"to": "+12025550101",
"from": "+12025550100",
"request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082"
}
{
"call_id": "call_example",
"status": "initiated",
"to": "+12025550101",
"from": "+12025550100",
"request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
"request_status": "unconfirmed",
"safe_to_retry": false
}
FIXED · call Pass the customer’s verified from_number. With require_from_number_for_shared_agent off (default), omission selects the oldest eligible number by created_at then id; a disabled number is not eligible. With it on, two or more settled attachments, even disabled ones, require an explicit sender (400 from_number_required). A sole eligible number works; none gives 400 agent_missing_phone_number. Pending imports do not count.
NOT OFFERED → do this instead · call Outbound developer instructions do not inherit the agent’s inbound system_prompt or the number’s custom_prompt. Include the business and purpose in prompt or the recipient’s prompt_override. Fixed call rules and enabled knowledge and tools can still apply.
YOU CAN CHANGE · call Send agent_id, from_number, to_number and a meaningful prompt. Choose dynamic_vars for this call.
SCOPE · call Track an outbound request using its receipt. Preserve the request ID across an uncertain response and check its status before another dial.
Read
Only send to a recipient you are authorised to contact. This endpoint has no dry-run option. The examples use an explicit recipient variable and can place a real call when run. Optional recipient location values do not override suppression, contact hours or capacity rules.
Use dynamic_vars for single-call substitutions; campaign recipient variables are a different field. There is no fallback to an agent-level phone_number. When from_number is omitted, selection uses the oldest eligible number by creation time then row ID. A number with outbound disabled is skipped. If no eligible number remains, the request gets 400 agent_missing_phone_number. If your organisation requires an explicit sender, two or more attached numbers, even disabled ones, need from_number (400 from_number_required). Selection does not bypass the final ownership and availability checks. 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.
Optional
HTTP 200 is the accepted replay shape:
A minimal UUID request body is shown below. The UUID is illustrative; never reuse a documentation UUID for live work.
Nixflex can refuse a call or recipient whose prompt placeholder has no value (409 missing_voice_details). This check is managed by Nixflex and may be off, so always validate rows yourself.
A 201 can also include
GET /v1/organisation/outbound-settings. Where available, the Owner or organisation API key can PATCH the same path with require_from_number_for_shared_agent. Campaigns need a reviewed sender. If it changes, choose and confirm again.
Read the compact AI rules
Start one outbound call from an account-owned number assigned to an active agent. A 201 response means the call was initiated; it does not confirm connection, conversation, completion or a successful outcome.
Method: POST ·
Success: 200 / 201 ·
Scope: Owning account
The important part
Supply at least ten trimmed characters of useful call purpose. Send - Call purpose. Send at least 10 characters after trimming. The agent and phone-number prompts do not supply a fallback purpose.
-
Per recipient. You choose variable names. Always send the customer’s
from_numberon a shared agent. Omitting it selects the oldest eligible number. - Save one UUID request_id before a deliberate call intent if you need launch reconciliation.
- A 201 means initiated. A same-ID 200 replay returns the existing call; pending or unknown must never trigger a new UUID automatically.
prompt_validation: "strict" to have a shorter nonblank purpose refused with 400 prompt_too_short before anything is dialled. Without it, a short purpose is still dialled and the agent is told to apologise and end the call.
The call purpose has no separate character limit. The whole JSON request must be under 100 KB (102,400 bytes); a larger request gets 413 payload_too_large. Keep call purposes short: a few hundred to a few thousand characters. The number’s SMS and website instruction limits apply to different fields.
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 active agent ID. Minimum 1 characters. |
to_number | string | Yes | None | Recipient in E.164 format. Minimum 1 characters. |
prompt | string | Yes | None | At least 10 characters after trimming for a usable call purpose. No separate maximum; the whole request must be under 100 KB. Without strict validation a shorter nonblank string passes the request check, but the agent is instructed to apologise and end the call. |
prompt_validation | string | No | Omitted | Only "strict". Refuses a nonblank purpose under 10 trimmed characters with 400 prompt_too_short before dialling, and a non-text prompt with 400 invalid_prompt. Any other value, including null or an empty string, gets 400 invalid_prompt_validation. Allowed: "strict". |
from_number | string | No | Omitted | Optional owned outbound-enabled number assigned to this agent. If omitted, the oldest eligible number is selected. Eligible means fully imported, assigned to this agent, outbound enabled and with a valid carrier set; a disabled number is never eligible. |
dynamic_vars | object | No | Omitted | Values for {{name}}-style placeholders in the call purpose. Choose custom names using ASCII letters, digits and underscores. The engine fills its built-in names, such as current_date. caller_name and business_name are not built in. |
campaign_id | string or null | No | null | Optional campaign association. Omitted or empty becomes null. |
recipient_timezone | string | No | Omitted | Optional recipient IANA time zone. Used for recipient-local contact checks, not the business clock. |
recipient_country | string | No | Omitted | Optional two-letter recipient country code. |
request_id | string | No | Omitted | Account-scoped UUID for one call intent. Save it before sending. Reusing it never starts a second call; changed input conflicts. Format: uuid. Pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$. |
request_id is a UUID saved before one deliberate call intent. Required prompt and the existing behavior without a request ID remain unchanged. A same-ID accepted replay returns HTTP 200 with the same call_id and replayed:true; it does not return to/from. Pending/unknown repeats return 409 and never dispatch again. A 201 with request_status:unconfirmed still preserves the known call ID and safe_to_retry:false. Read the saved UUID through outbound request status.
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 |
|---|---|---|
call_id | string | Accepted call identifier. Save it for reads and reconciliation. |
status | string | The call was initiated, not completed. |
to | string | Requested recipient. |
from | string | Selected originating number. |
work_id | string or null | Optional account work receipt ID. |
deletion_work_id | string | Optional dispatch/deletion safety receipt ID. |
persistence | string | Optional unconfirmed state if accepted work could not be fully saved. |
safe_to_retry | boolean | When supplied, false: do not repeat an accepted or uncertain call. |
request_id | string | Present when the call intent supplied a request UUID. Format: uuid. Pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$. |
request_status | string | The accepted call is known but the final request-journal acknowledgement is unconfirmed. Do not redial. |
call_id, request_id, status:"initiated" and replayed:true. Unlike the first 201 response, it does not require to or from.
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. Running the call example can place a real call. Set NIXFLEX_API_KEY, the owned agent and number, and an approved recipient before running. The cURL example also needs a durably saved NXF_REQUEST_ID. Keep the account credential private.
The cURL tab demonstrates the new request UUID. The SDK/CLI examples require Node/CLI 0.11.0 or later or Python 0.4.0 or later; the examples below omit request_id and retain the older launch behaviour. For UUID reconciliation, use the cURL request or the SDK preparation workflow. No example retries a write.
# Save NXF_REQUEST_ID durably before this first deliberate launch.
# Set NXF_TO_NUMBER to an approved recipient; this can place a real call.
curl --request POST \
--url 'https://api.nixflex.com/v1/calls/outbound' \
--header "Authorization: Bearer $NIXFLEX_API_KEY" \
--header 'Content-Type: application/json' \
--data "{\"agent_id\":\"$NXF_AGENT_ID\",\"to_number\":\"$NXF_TO_NUMBER\",\"prompt\":\"Confirm the requested appointment\",\"request_id\":\"$NXF_REQUEST_ID\"}"
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.calls.create({agent_id:process.env.NXF_AGENT_ID,from_number:process.env.NXF_PHONE_NUMBER,to_number:process.env.NXF_TO_NUMBER,prompt:"Confirm the requested appointment"});
// 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.calls.create(agent_id=os.environ["NXF_AGENT_ID"],from_number=os.environ["NXF_PHONE_NUMBER"],to_number=os.environ["NXF_TO_NUMBER"],prompt="Confirm the requested appointment")
# AsyncNixflex supports the same calls with await (and async with).
nixflex calls create --agent "$NXF_AGENT_ID" --from "$NXF_PHONE_NUMBER" --to "$NXF_TO_NUMBER" --prompt "Confirm the requested appointment" --base-url https://api.nixflex.com --json
Request shape
{
"agent_id": "agent_example",
"to_number": "+12025550101",
"prompt": "Confirm the requested appointment",
"request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082"
}
Example response
Illustrative accepted replay and first-launch responses. Save both identifiers privately.{
"call_id": "call_example",
"request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
"status": "initiated",
"replayed": true
}
{
"call_id": "call_example",
"status": "initiated",
"to": "+12025550101",
"from": "+12025550100",
"request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082"
}
{
"call_id": "call_example",
"status": "initiated",
"to": "+12025550101",
"from": "+12025550100",
"request_id": "9f9aa2b2-4b77-4fa1-9071-9cf6747a9082",
"request_status": "unconfirmed",
"safe_to_retry": false
}
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 | agent_id, to_number or a nonblank prompt is missing. | Supply the required fields before attempting a call. |
| 400 | invalid_phone_format | The recipient is not valid E.164. | Correct the recipient number. |
| 400 | agent_missing_phone_number | No eligible outbound number is assigned to the agent. | Connect and enable an owned outbound number. |
| 400 | from_number_not_found | The requested origin is not an eligible number of this agent. | Use an owned, assigned and settled origin. |
| 400 | from_number_required | Your organisation requires an explicit sender and this agent has two or more attached numbers. | Send the customer’s from_number. |
| 400 | invalid_prompt_validation | prompt_validation was sent with a value other than “strict”. | Send “strict” or omit the field. |
| 400 | invalid_prompt | With strict validation, prompt is not text. | Send the call purpose as a string. |
| 400 | prompt_too_short | With strict validation, the nonblank purpose is under 10 characters after trimming. Nothing was dialled. | Describe the call purpose in at least 10 characters. |
| 413 | payload_too_large | The whole JSON request is over 100 KB. | Shorten the call purpose or variables and send a smaller request. |
| 404 | not_found | The agent is not available to this account. | Use an owned agent ID. |
| 409 | agent_inactive | The agent is disabled. | Choose or enable the intended agent before sending. |
| 409 | number_pending | The number is being imported or removed. | Wait for the number operation to settle. |
| 409 | number_disabled | Outbound work is disabled for the number. | Check the intended outbound setting; do not reroute automatically. |
| 409 | number_context_changed | The number assignment changed while the call waited. | Read the current assignment before a new request. |
| 409 | number_provider_invalid | The number connection is not valid. | Repair the existing connection through the dashboard. |
| 409 | do_not_contact | The recipient is suppressed. | Respect the suppression; do not fabricate consent. |
| 409 | missing_voice_details | A call-purpose placeholder has no value. This check is managed by Nixflex and may be off. | Supply the named dynamic_vars values. Always validate your values yourself. |
| 409 | unsupported_voice_placeholder | A placeholder name uses unsupported spaces or punctuation. | Use {{name}} with a supported identifier. |
| 403 | account_disabled | The account cannot start calls. | Resolve account access. |
| 503 | agent_lookup_unavailable | The agent lookup failed. | Retry only after checking that no call was accepted. |
| 503 | number_lookup_unavailable | Number ownership or availability could not be confirmed. | Check current state before another send. |
| 502 | carrier_error | The connection service refused the call. | Read the refusal and correct the cause; do not blindly redial. |
| 504 | carrier_outcome_unknown | The service did not confirm whether a call was placed. | Check call history and receipts; never automatically redial. |
| 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. |
| 400 | invalid_request_id | The supplied request_id is not a supported UUID. | Create and save one valid UUID for the deliberate call intent before its first submission. |
| 409 | request_id_conflict | This account already used the UUID with different call details. | Reconcile the existing request. Do not change its payload or automatically allocate a replacement ID. |
| 409 | outbound_request_pending | The same call request is still pending. | Read the same request ID and call history. Wait; do not submit a new call. |
| 409 | outbound_request_unknown | The saved request has an uncertain outcome. | Retain its UUID and check call history. Never automatically redial with a new ID. |
| 503 | outbound_request_unknown | The call result or its final journal update could not be confirmed. | Treat the outcome as unknown and preserve request_id. Check its status before another deliberate intent. |
| 503 | outbound_request_unavailable | The request journal could not be checked. | For a launch, retain unknown and safe_to_retry:false: an earlier attempt may have dialled. Retry the status read, not a new launch. |
| 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
Save one UUID before the first request for an intended call. Persist it with the request payload so a process restart cannot accidentally create a new intent. Supply it as the JSON fieldrequest_id, not an Idempotency-Key header.
| Result | What it proves | Next action |
|---|---|---|
| 201 initiated | A call was accepted; completion is still unknown. | Save call_id and request_id; read the call. |
| 200 replayed:true | This UUID already has an accepted call. | Use the same call_id; no second dispatch occurred. |
| 409 outbound_request_pending / outbound_request_unknown | The existing intent cannot be launched again. | Keep the UUID and read request status. |
| 409 request_id_conflict | The same UUID was used with changed input. | Reconcile the original payload; do not automatically replace the UUID. |
| 503 with details.safe_to_retry:false | The journal or launch outcome is uncertain. | Keep the UUID and use bounded status reads. |
request_status:"unconfirmed" and safe_to_retry:false: the call ID is known even though the final journal acknowledgement was lost. Never redial it. A new UUID is a new explicit call intent. Requests without request_id retain their existing behaviour and have no launch replay protection.
Read outbound request status. A 404 or an empty history page does not confirm that an uncertain call was never placed.
Related endpoints
Authorizations
Body
application/json
Optional. Only "strict": a nonblank purpose under 10 trimmed characters gets 400 prompt_too_short and a non-text prompt gets 400 invalid_prompt, before dialling. Any other value, including null or an empty string, gets 400 invalid_prompt_validation.
Available options:
strict Response
The same accepted request was replayed. No second dispatch; the response omits original to/from fields.