All voice endpoints sit under https://api.senderz.com/v1 and use the same Authorization: Bearer API key as the messaging endpoints. Every response carries a code field on errors so you can branch without parsing prose.
Voice numbers
POST /v1/voice/numbers
Buy a number and attach it to your voice connection. Returns 503 NOT_CONFIGURED if voice is not provisioned for your account, 404 NOT_AVAILABLE if no numbers in the requested area code, 502 TELNYX_ERROR if the carrier rejects the order.
curl -X POST https://api.senderz.com/v1/voice/numbers \
-H "Authorization: Bearer tf_live_YOUR_KEY" \
-d '{"country":"US","area_code":"619"}'
GET /v1/voice/numbers
Lists every active or released number scoped to your tenant. Foreign-tenant numbers never leak into this list.
PATCH /v1/voice/numbers/:id
Change the assigned persona. assigned_persona_id may be null to detach. The persona must belong to the same tenant or you get 404.
DELETE /v1/voice/numbers/:id
Best-effort releases the number on Telnyx and marks the row released. Idempotent — already-released ids return 200.
Calls
POST /v1/calls
Dial outbound. The AI opens with a brief intro and pursues the supplied script as the goal of the call. Returns 201 with { id, status: 'ringing', to }.
curl -X POST https://api.senderz.com/v1/calls \
-H "Authorization: Bearer tf_live_YOUR_KEY" \
-d '{
"from": "<voice_number_id>",
"to": "+14155551234",
"script": "Confirm Friday 2pm appointment for John Smith."
}'
Optional body fields:
| Field | Type | Default | Effect |
|-------|------|---------|--------|
| script | string (≤ 1000 chars) | — | The goal of the call. |
| skip_amd | boolean | false | Skip answering-machine detection. A scripted call starts speaking about 1–2 seconds after pickup instead of waiting for the machine check (~8 s). If voicemail answers, the script is left as a voicemail. With greeting_wait, script_i18n, opt_out or voice, detection still runs in the background without delaying a person: when a voicemail answers, the script stops, waits for the voicemail beep and is then played in full from its first sentence (or voicemail_script, when sent) (at the latest 30 seconds after pickup if no beep is heard), and the call ends right after the closing. This also applies when the voicemail is recognised only after the script has finished: if detection has not decided by the end of the script, the line stays open up to 5 more seconds for its verdict. If the voicemail greeting is still talking when the beep is reported, the script waits until it is quiet; if the greeting starts talking again over the script, the script stops and starts over from its first sentence once it is quiet (once per call). Either way the script starts no later than 30 seconds after pickup. See answered_by. Keep false for one-time codes: with detection on, the script is held until a person is confirmed and the call hangs up on a machine. |
| record | boolean | false with a script, true without | Record the call. An explicit value always wins. When omitted, announcement calls (with a script) are not recorded and conversational calls (no script) are. |
| greeting_wait | { min_ms, max_ms } | — (speak as soon as the line is ready) | Scripted calls only. Let the callee finish their greeting: the script starts when they pause, never before min_ms, at the latest at max_ms (milliseconds after the audio connection starts, 0–15000, min_ms ≤ max_ms). { "min_ms": 1500, "max_ms": 5000 } suits most calls. |
| script_i18n | { es } | — | Scripted calls only. A Spanish version of the script (≤ 1000 chars). If the greeting heard during greeting_wait is clearly Spanish ("¿Bueno?", "Buenas tardes", "Diga", "Aló"…), es is played; otherwise script is played. Needs greeting_wait — without it no greeting is heard and script is read. |
| opt_out | { keywords?, dtmf?, reply? } | — | Scripted calls only. The callee is listened to for the whole call. When they say a keyword (whole word or phrase, any case, accents ignored) or press the dtmf key, the script stops immediately, reply is played and the call hangs up as soon as the reply has finished. The reply is Spanish when the callee used a Spanish word ("alto", "basta", "no me llamen"); otherwise ("stop", or the key) it is in the language being played. Our own audio echoing back on the line (for example the callee's phone repeating "just say stop") is recognised and never opts anyone out; a callee who answers "stop" right after hearing it is opted out on the first try. The number is then on your voice do-not-call list: later calls to it return 409 OPTED_OUT. Needs keywords or dtmf. |
| voice | string | the default voice | Scripted calls only. The voice that reads the script and the opt_out replies — one id from GET /v1/voice/announcement-voices, e.g. telnyx:azure.en-US-AvaMultilingualNeural. Every voice reads English and Mexican Spanish as the same speaker. Sending only voice (with a script) also gives the call everything below: the exact script is played, the AI never speaks. |
| voicemail_script | string (≤ 1000 chars) | — (the voicemail gets script) | Scripted calls with skip_amd: true only. The message left when a voicemail answers: once the voicemail is recognised (answering-machine detection, or its beep), this text is played after the beep from its first sentence instead of script, in the same voice. A person who answers never hears it — they hear script. Like voice, sending it makes the call play exact pre-recorded audio (see below). Without skip_amd the call still hangs up on a voicemail, so the field has no effect. |
| voicemail_script_i18n | { es } | — | A Spanish version of voicemail_script (≤ 1000 chars), chosen by the same rule as script_i18n: played when the greeting or the voicemail greeting is clearly Spanish. Needs voicemail_script. Without it a Spanish voicemail gets voicemail_script as written. |
With script_i18n, a callee who asks for Spanish during the call ("no inglés", "español", "Spanish", "I don't speak English") or who is clearly speaking Spanish (for example a Spanish greeting that is still being transcribed when the script starts) hears the script again from the start in Spanish (once per call), and language_used becomes es.
When keywords is set, common ways of saying stop are honoured too, in addition to your list: "stop it", "please stop", "stop calling", "no more calls", "remove me", "basta", "no me llamen" and similar.
opt_out fields: keywords — { "en": [...], "es": [...] }, up to 20 per language, ≤ 50 chars each; dtmf — one key, 0–9, * or #; reply — { "en": "...", "es": "..." }, ≤ 300 chars each (omit to hang up without a reply).
curl -X POST https://api.senderz.com/v1/calls \
-H "Authorization: Bearer $SENDERZ_API_KEY" \
-d '{
"from": "<voice_number_id>",
"to": "+14155551234",
"script": "This is Little Stars Daycare with a reminder about Friday pickup.",
"skip_amd": true,
"greeting_wait": { "min_ms": 1500, "max_ms": 5000 },
"script_i18n": { "es": "Le llama Little Stars Daycare con un recordatorio sobre la recogida del viernes." },
"opt_out": {
"keywords": { "en": ["stop", "remove me"], "es": ["alto", "no me llame"] },
"dtmf": "9",
"reply": { "en": "Okay, you will not be called again. Goodbye.", "es": "Está bien, no le volveremos a llamar. Adiós." }
}
}'
How calls with these options sound. The script (script and script_i18n.es) and the opt_out replies are turned into audio once per call while the phone is ringing, with one natural text-to-speech voice for everything on the call — both languages and the replies (a native-sounding Mexican Spanish accent for es) — and played word for word. The voice is voice when you send it, otherwise the default one (see GET /v1/voice/announcement-voices); the closing sentence is rendered on its own and followed by a short silence, so the goodbye is never cut off. If the Spanish audio is not ready yet when a Spanish greeting is heard, the English script starts at once and the Spanish one replaces it from its first word as soon as it is ready, so the line is never silent. The AI only listens on these calls — it never speaks, so it cannot skip, shorten, translate or answer anything. After the last sentence the line stays open for about 3 seconds so a final "stop" is still heard, then the call ends. The rendered audio is kept only for the duration of the call.
Calls that send none of greeting_wait, script_i18n, opt_out, voice and voicemail_script (for example one-time-code calls) behave exactly as before: the AI voice reads the script.
Unknown top-level fields in the body are ignored, not rejected, so a client can send a field this API does not know yet without breaking the call.
Errors:
400 VALIDATION_ERROR— a field is malformed; theerrortext names it.404 NUMBER_NOT_OWNED— thefromvoice number is not yours or is released.409 OPTED_OUT— the destination opted out during an earlier call from your account (keyword or keypad). Nothing is dialed.451 OPT_OUT— the destination has opted out of messages for this tenant.429 RATE_LIMITED— more than 10 outbound calls in the current minute.429 BLOCKED_DESTINATION— five dial failures to this destination in the last hour triggered a 1-hour block.502 TELNYX_ERROR— carrier rejected the dial.
GET /v1/voice/announcement-voices
The voices voice on POST /v1/calls accepts. Read-only, the same for every account.
{
"data": [
{
"id": "telnyx:azure.en-US-AvaMultilingualNeural",
"label": "Ava — warm, friendly female voice (Telnyx TTS, Azure neural)",
"languages": ["en-US", "es-MX"],
"default": true,
"recommended": true
}
]
}
default marks the voice used when voice is omitted. recommended: false marks a voice listed only for comparison while it is being retired.
GET /v1/calls
Filters: direction=inbound|outbound, status, from_date, to_date (YYYY-MM-DD). Pagination via limit (max 100) and offset.
GET /v1/calls/:id
Full call detail including AI summary, lead score, and has_recording. The R2 key is intentionally omitted — use /recording to play back. Also returns:
| Field | Type | Meaning |
|-------|------|---------|
| transcript | array | Turns in order: { "role": "callee", "text": "STOP", "at": "2026-11-16T18:00:06.000Z" }. role is agent for the AI voice; the person is callee on outbound calls and caller on inbound ones. On opt_out calls the callee is transcribed until hangup. Written when the call ends — empty while it is in progress. |
| opted_out | boolean | The callee opted out during this call. |
| opted_out_via | string or null | speech (keyword) or dtmf (keypad); null when not opted out. |
| language_used | string or null | en, es or tr — the script language actually read, for calls that sent greeting_wait, script_i18n, opt_out, voice or voicemail_script. |
| answered_by | string | human, machine (a voicemail answered) or unknown (no answering-machine verdict, for example a call dialed without detection). |
GET /v1/calls/:id/events
Returns the call_events log for a single call, ordered ascending. Useful for debugging which intents fired in what order.
GET /v1/calls/:id/recording
Mints a 15-minute playback URL pointing at /v1/calls/:id/recording/stream. The stream endpoint re-checks tenant ownership and TTL before serving the MP3.
Intents
GET /v1/voice/intents
Returns built-in (talk_to_human, leave_message, end_call) plus custom intents.
POST /v1/voice/intents
Create a custom intent.
curl -X POST https://api.senderz.com/v1/voice/intents \
-H "Authorization: Bearer tf_live_YOUR_KEY" \
-d '{
"name": "book_table",
"description": "Caller wants to book a table — capture party size and time.",
"action": "webhook",
"action_config": { "url": "https://your-app.example.com/voice/book" },
"language": "all"
}'
name must be ^[a-z][a-z0-9_]{1,39}$ and unique per tenant. action is one of transfer, message, webhook, end_call. language is one of en, es-MX, tr-TR, all.
PATCH /v1/voice/intents/:id
Updates description / action / config / language / enabled. name is immutable — delete and recreate to rename.
DELETE /v1/voice/intents/:id
Removes a custom intent. Built-in names that get deleted reseed from the prompt builder's defaults.
Billing
GET /v1/billing/voice
Current voice subscription state plus minutes used.
POST /v1/billing/voice/subscribe
Body: { "tier": "starter" | "growth" | "scale" }. Requires an active messaging subscription on the tenant.
POST /v1/billing/voice/cancel
Cancels the voice subscription item at period end. Returns 404 NOT_FOUND if voice is not active for this tenant.