Outbound calls
POST /v1/calls calls one person with an assistant. MoreVoice checks the call against the compliance rules, dials it, and answers straight away with the call object; the conversation then runs on its own. To call a list of people within calling hours, with retries, use a campaign instead.
# A reminder call. The Idempotency-Key is your own ID for this call: a retry with the same key# returns the first answer and never dials twice.curl https://api.morevoice.ai/v1/calls \ -H "Authorization: Bearer $MOREVOICE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: reminder-$APPOINTMENT_ID" \ -d '{ "to": "+972501234567", "from_number_id": "'"$FROM_NUMBER_ID"'", "assistant_id": "'"$ASSISTANT_ID"'", "purpose": "service", "variables": { "customer_name": "דנה", "appointment": "יום שלישי ב-10:30" }, "metadata": { "crm_contact_id": "0031x00000AbCdE", "appointment_id": "'"$APPOINTMENT_ID"'" }, "max_duration_s": 300 }'import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // reads MOREVOICE_API_KEYconst appointmentId = process.env.APPOINTMENT_ID!;
// A reminder call. The idempotency key is your own ID for this call: a retry with the same key// returns the first answer and never dials twice.const call = await mv.calls.create( { to: "+972501234567", from_number_id: process.env.FROM_NUMBER_ID!, assistant_id: process.env.ASSISTANT_ID!, purpose: "service", variables: { customer_name: "דנה", appointment: "יום שלישי ב-10:30" }, metadata: { crm_contact_id: "0031x00000AbCdE", appointment_id: appointmentId }, max_duration_s: 300, }, { idempotencyKey: `reminder-${appointmentId}` },);console.log(call.id, call.status); // call_… queuedimport os
import requests
API = "https://api.morevoice.ai/v1"HEADERS = {"Authorization": f"Bearer {os.environ['MOREVOICE_API_KEY']}"}appointment_id = os.environ["APPOINTMENT_ID"]
# A reminder call. The Idempotency-Key is your own ID for this call: a retry with the same key# returns the first answer and never dials twice.response = requests.post( f"{API}/calls", headers={**HEADERS, "Idempotency-Key": f"reminder-{appointment_id}"}, json={ "to": "+972501234567", "from_number_id": os.environ["FROM_NUMBER_ID"], "assistant_id": os.environ["ASSISTANT_ID"], "purpose": "service", "variables": {"customer_name": "דנה", "appointment": "יום שלישי ב-10:30"}, "metadata": {"crm_contact_id": "0031x00000AbCdE", "appointment_id": appointment_id}, "max_duration_s": 300, }, timeout=30,)response.raise_for_status()call = response.json()print(call["id"], call["status"]) # call_… queuedThe request
Section titled “The request”| Field | Required | What it does |
|---|---|---|
to |
Yes | The number to call, in E.164 format: +972501234567. |
purpose |
Yes | service, marketing or survey. It decides the compliance checks. |
assistant_id |
One of the two | The assistant that talks. |
flow_id |
One of the two | A published voice flow, which runs with the assistant linked to it. |
from_number_id |
Live mode | The number to call from (pn_…, from GET /v1/phone_numbers): it sets the SIP connection and the caller ID. |
connection_id, caller_id |
Instead of from_number_id: a SIP connection (by default, the organisation’s default one) and a number it is allowed to present. |
|
variables |
Values for the {{variables}} of the instructions, first message and flow. |
|
first_message |
What the assistant says first on this call, instead of its own first message. See a first message per call. | |
metadata |
Your own key–value strings, kept on the call. | |
max_duration_s |
End the call after this many seconds (10–14,400). By default, the assistant’s limit. | |
amd |
Answering-machine detection for this call: see answering machines. By default, the assistant’s setting. |
The answer is 201 Created with the call object, in status queued. metadata, variables and purpose are on it from the start.
Variables
Section titled “Variables”Variables personalise one call without changing the assistant. Write {{customer_name}} in the assistant’s first_message or system_prompt, and pass "variables": { "customer_name": "דנה" } with each call.
- Up to 50 per call. Names are letters, digits and
_(up to 40 characters, not starting with a digit); values are strings of up to 1,000 characters. - The call keeps its
variables, so you can see later what each call was told.
A first message per call
Section titled “A first message per call”first_message replaces the assistant’s own first message for one call, so the greeting can name the person and the reason for the call without a new assistant: "first_message": "Hi {{customer_name}}, this is Noa from Acme about your order.".
- The assistant speaks first on that call. When the call needs an AI disclosure, it is still said before your text.
- Up to 500 characters, and up to 2,000 once the variables are filled in. Each
{{name}}must be one of the call’svariables(pass""to say nothing there), and with afirst_messageno variable value may contain{{or}}. A value is never read as a placeholder itself. - It works with
assistant_id. A voice flow (flow_id, or an assistant that runs one) starts with the flow’s Start node instead, and a connect-modestreamlets your bot speak first, so those requests are refused with400 parameter_invalidonfirst_message. - Empty or left out, the assistant’s own first message plays, as before. The call object doesn’t return it.
Metadata
Section titled “Metadata”metadata is for you: your CRM’s contact ID, the order the call is about, the campaign in your own system. MoreVoice never reads it: it keeps it on the call and sends it back in the call object and in the call’s webhook events. Up to 50 keys of up to 40 characters, values of up to 500 characters.
Use metadata to find your record when an event arrives; use variables for what the assistant should say.
Purpose and compliance
Section titled “Purpose and compliance”Every outbound call states why it is made, and live calls pass the same compliance gate as every other outbound call before anything is dialled:
purpose |
Checked before the call |
|---|---|
service |
The organisation’s do-not-call list. |
survey |
The organisation’s do-not-call list. |
marketing |
The do-not-call list, a recorded consent to marketing calls (§30A), and the national do-not-call registry for Israeli numbers. A number the registry can’t confirm is blocked too. |
A blocked call isn’t dialled. The request answers 403 with a compliance_error whose code names the rule (dnc_listed, registry_listed, registry_unavailable, consent_missing or compliance_blocked) and whose details.verdict lists every check. Compliance explains each rule.
Calling hours, Shabbat and holidays are kept by campaigns, which wait for an allowed moment. A call you place with POST /v1/calls goes out when you place it, so place it within your calling hours, or ask for a callback and let MoreVoice pick the moment.
Check before you dial
Section titled “Check before you dial”When you call from your own list, ask first instead of handling a 403 per call. POST /v1/dnc/check takes up to 100 numbers and a purpose, and answers for each one whether a call would be allowed now, and why not:
# Would a marketing call to these numbers be allowed? Your do-not-call list, consent and the national registry.curl https://api.morevoice.ai/v1/dnc/check \ -H "Authorization: Bearer $MOREVOICE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "phones": ["+972501234567", "0527654321"], "purpose": "marketing" }'import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // reads MOREVOICE_API_KEY
// Would a marketing call to these numbers be allowed? Your do-not-call list, consent and the national registry.const check = await mv.dnc.check({ phones: ["+972501234567", "0527654321"], purpose: "marketing" });for (const r of check.results) { console.log(r.phone ?? r.input, r.callable ? "callable" : `blocked: ${r.reasons.join(", ")}`, `registry: ${r.registry.status}`);}import os
import requests
API = "https://api.morevoice.ai/v1"HEADERS = {"Authorization": f"Bearer {os.environ['MOREVOICE_API_KEY']}"}
# Would a marketing call to these numbers be allowed? Your do-not-call list, consent and the national registry.response = requests.post( f"{API}/dnc/check", headers=HEADERS, json={"phones": ["+972501234567", "0527654321"], "purpose": "marketing"}, timeout=30,)response.raise_for_status()for r in response.json()["results"]: verdict = "callable" if r["callable"] else "blocked: " + ", ".join(r["reasons"]) print(r["phone"] or r["input"], verdict, "registry:", r["registry"]["status"])The check reads the same do-not-call list, consent records and national registry as the dialer, so a number marked callable is dialled unless something changes in between (the person opts out, a consent is revoked). Compliance over the API has the details.
Retrying safely: the Idempotency-Key
Section titled “Retrying safely: the Idempotency-Key”POST /v1/calls requires an Idempotency-Key header, so a call is never placed twice:
- Send the same key again, with the same body, and you get the first answer back, with an
Idempotent-Replayed: trueheader. Nobody is dialled again. - Use a key that means something in your system, such as
reminder-<appointment ID>, so that two copies of the same job can’t both call. - Keys are kept for 24 hours, per organisation and mode, and are up to 255 printable characters.
- The same key with a different body answers
409with the codeidempotency_mismatch. While the first request is still running, a retry answers409withrequest_in_progress: wait a moment and retry. - A
5xx,409or429answer doesn’t use up the key, so retry with the same one.
The SDK sends a key with every POST and reuses it when it retries; pass idempotencyKey to choose your own. Every other POST and DELETE of the API accepts Idempotency-Key too, but only POST /v1/calls requires it.
When the call can’t start
Section titled “When the call can’t start”| HTTP | Code | Why |
|---|---|---|
| 400 | parameter_missing, parameter_invalid |
A field is missing or wrong; param says which. An unknown assistant or flow is parameter_invalid on assistant_id or flow_id. |
| 400 | dial_rejected |
The connection or the caller ID can’t place this call. |
| 402 | balance_exhausted, spend_cap, trial_limit, … |
Billing doesn’t allow new calls; details.reason says why. |
| 403 | dnc_listed, consent_missing, … |
A compliance rule blocks the call. |
| 429 | concurrency_limit |
As many calls are in progress as your plan allows; details has active and limit. |
| 429 | rate_limited |
More than the new calls per second your plan allows. |
| 429 | capacity_exceeded |
No line is free right now. |
A 429 carries Retry-After: wait, then send the same request with the same key. Errors, rate limits and concurrency has the details.
Answering machines
Section titled “Answering machines”With answering-machine detection on, MoreVoice listens to the first seconds after the call is answered and decides whether a person or a machine picked up. Set it per call with amd, or leave it out to use the assistant’s setting:
amd |
What happens on a machine |
|---|---|
{ "enabled": false } |
Nothing special: the assistant talks to whatever answered. |
{ "enabled": true, "on_machine": "hangup" } |
The call ends at once, with the end reason amd-machine. |
{ "enabled": true, "on_machine": "leave_message", "message": "…" } |
MoreVoice waits for the beep, leaves message (by default, the assistant’s voicemail message), after the AI disclosure when one applies, and hangs up with amd-left-message. Without any message to leave, it hangs up as with hangup. |
# A reminder that is left as a voicemail when a machine answers.curl https://api.morevoice.ai/v1/calls \ -H "Authorization: Bearer $MOREVOICE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: reminder-$APPOINTMENT_ID" \ -d '{ "to": "+972501234567", "from_number_id": "'"$FROM_NUMBER_ID"'", "assistant_id": "'"$ASSISTANT_ID"'", "purpose": "service", "variables": { "customer_name": "דנה" }, "amd": { "enabled": true, "on_machine": "leave_message", "message": "שלום דנה, מזכירים שיש לך תור ביום שלישי ב-10:30. לשינוי, אפשר לחזור אלינו." } }'import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // reads MOREVOICE_API_KEY
// A reminder that is left as a voicemail when a machine answers.const call = await mv.calls.create( { to: "+972501234567", from_number_id: process.env.FROM_NUMBER_ID!, assistant_id: process.env.ASSISTANT_ID!, purpose: "service", variables: { customer_name: "דנה" }, amd: { enabled: true, on_machine: "leave_message", message: "שלום דנה, מזכירים שיש לך תור ביום שלישי ב-10:30. לשינוי, אפשר לחזור אלינו.", }, }, { idempotencyKey: `reminder-${process.env.APPOINTMENT_ID}` },);console.log(call.id, call.status);import os
import requests
API = "https://api.morevoice.ai/v1"HEADERS = {"Authorization": f"Bearer {os.environ['MOREVOICE_API_KEY']}"}
# A reminder that is left as a voicemail when a machine answers.response = requests.post( f"{API}/calls", headers={**HEADERS, "Idempotency-Key": f"reminder-{os.environ['APPOINTMENT_ID']}"}, json={ "to": "+972501234567", "from_number_id": os.environ["FROM_NUMBER_ID"], "assistant_id": os.environ["ASSISTANT_ID"], "purpose": "service", "variables": {"customer_name": "דנה"}, "amd": { "enabled": True, "on_machine": "leave_message", "message": "שלום דנה, מזכירים שיש לך תור ביום שלישי ב-10:30. לשינוי, אפשר לחזור אלינו.", }, }, timeout=30,)response.raise_for_status()call = response.json()print(call["id"], call["status"])The verdict is on the call as answered_by (human, machine or unknown) and in the call.answered event. A person gets the assistant’s first message as usual; unknown is treated as a person.
How a call ends
Section titled “How a call ends”A call goes from queued to ringing, in_progress (answered) and ended. Once it has ended, the call object carries ended_at, duration_ms, end_reason and cost, and the summary follows a few seconds later. The events arrive in this order:
| Event | When |
|---|---|
call.created |
The call was accepted and is being dialled. |
call.ringing |
The far end rings. |
call.answered |
Someone (or something: answered_by) picked up. |
call.ended |
The call ended, with end_reason and duration_ms. Unanswered calls end here too. |
call.analyzed |
The summary, outcome and extracted details are ready. |
call.cost_finalized |
The price is final. |
end_reason tells you what to do next:
end_reason |
Meaning | What to do |
|---|---|---|
customer-ended-call, assistant-ended-call, assistant-said-end-call-phrase, flow-ended, tool-requested |
The conversation ended as designed. | Read the summary (call.analyzed). |
transferred |
The call was handed to a queue, a number or a person. | Follow it in your queue or contact centre. |
customer-busy |
The line was busy. | Try again later. |
customer-did-not-answer, customer-declined |
Nobody answered, or the call was rejected. | Try again later, or schedule a callback. |
amd-machine, amd-left-message |
A machine answered; with leave_message, your message was left. |
Don’t call straight back. |
opted-out |
The person asked not to be called again: the number is on your do-not-call list now. | Don’t call again; update your CRM (contact.opted_out arrives too). |
exceeded-max-duration, silence-timed-out |
The call hit max_duration_s, or nobody spoke. |
Check the transcript. |
api-ended-call, operator-ended-call |
You hung up through the API or the dashboard. | — |
invalid-number, peer-rtp-timeout, sip-… |
The number or the network failed. | Check the number and the SIP connection. |
Campaigns read the same reasons to decide on retries.
Follow the call
Section titled “Follow the call”Follow a call with the webhooks above, or read it with GET /v1/calls/{id}. The SDK’s calls.waitUntilEnded() polls until the call has ended (the quickstart shows it). To find calls, list them with filters:
# Ended calls of one assistant, newest first.curl "https://api.morevoice.ai/v1/calls?assistant_id=$ASSISTANT_ID&status=ended&limit=20" \ -H "Authorization: Bearer $MOREVOICE_API_KEY"import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // reads MOREVOICE_API_KEY
// Ended calls of one assistant, newest first. The list fetches the next page when you need it.for await (const call of mv.calls.list({ assistant_id: process.env.ASSISTANT_ID!, status: "ended", limit: 20 })) { console.log(call.id, call.to, call.end_reason, call.metadata);}import os
import requests
API = "https://api.morevoice.ai/v1"HEADERS = {"Authorization": f"Bearer {os.environ['MOREVOICE_API_KEY']}"}
# Ended calls of one assistant, newest first.response = requests.get( f"{API}/calls", headers=HEADERS, params={"assistant_id": os.environ["ASSISTANT_ID"], "status": "ended", "limit": 20}, timeout=30,)response.raise_for_status()for call in response.json()["data"]: print(call["id"], call["to"], call["end_reason"], call["metadata"])Act on a live call
Section titled “Act on a live call”End a call from your side:
curl -X POST https://api.morevoice.ai/v1/calls/$CALL_ID/hangup \ -H "Authorization: Bearer $MOREVOICE_API_KEY"import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // reads MOREVOICE_API_KEY
const call = await mv.calls.hangup(process.env.CALL_ID!);console.log(call.status);import os
import requests
API = "https://api.morevoice.ai/v1"HEADERS = {"Authorization": f"Bearer {os.environ['MOREVOICE_API_KEY']}"}call_id = os.environ["CALL_ID"]
response = requests.post(f"{API}/calls/{call_id}/hangup", headers=HEADERS, timeout=30)response.raise_for_status()print(response.json()["status"])Or hand it to people: a queue, a phone number, another assistant or a specific agent. cold hands the call over; warm lets the assistant whisper your note to whoever takes it (with a human call, the agent talks to the target first):
# Hand the call to the people in a queue, with a note they see next to it.curl https://api.morevoice.ai/v1/calls/$CALL_ID/transfer \ -H "Authorization: Bearer $MOREVOICE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "to": { "queue_id": "'"$QUEUE_ID"'" }, "mode": "cold", "note": "Wants to move Tuesday'"'"'s appointment to next week" }'import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // reads MOREVOICE_API_KEY
// Hand the call to the people in a queue, with a note they see next to it.await mv.calls.transfer(process.env.CALL_ID!, { to: { queue_id: process.env.QUEUE_ID! }, mode: "cold", note: "Wants to move Tuesday's appointment to next week",});import os
import requests
API = "https://api.morevoice.ai/v1"HEADERS = {"Authorization": f"Bearer {os.environ['MOREVOICE_API_KEY']}"}call_id = os.environ["CALL_ID"]
# Hand the call to the people in a queue, with a note they see next to it.response = requests.post( f"{API}/calls/{call_id}/transfer", headers=HEADERS, json={ "to": {"queue_id": os.environ["QUEUE_ID"]}, "mode": "cold", "note": "Wants to move Tuesday's appointment to next week", }, timeout=30,)response.raise_for_status()Both answer 409 with the code call_not_active when the call has already ended. Calls handled by people can also be put on hold, sent DTMF tones, consulted on and joined by more participants: see live control of agents’ calls.
Call back later
Section titled “Call back later”When the time isn’t right (outside calling hours, the person asked for tomorrow, nobody answered), don’t keep the job in your own scheduler: ask MoreVoice for a callback. With route: "assistant" the AI calls back by itself; with agent_queue or agent your people do (see callbacks for agents):
# Ask the AI to call the customer back tomorrow morning. The time moves into your calling hours.curl https://api.morevoice.ai/v1/callbacks \ -H "Authorization: Bearer $MOREVOICE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "phone": "+972501234567", "name": "Dana Levi", "due_at": "2026-11-04T09:00:00+02:00", "route": "assistant", "assistant_id": "'"$ASSISTANT_ID"'", "max_attempts": 2, "note": "Wants to hear about the renewal offer", "metadata": { "crm_contact_id": "0031x00000AbCdE" } }'import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // reads MOREVOICE_API_KEY
// Ask the AI to call the customer back tomorrow morning. The time moves into your calling hours.const callback = await mv.callbacks.create({ phone: "+972501234567", name: "Dana Levi", due_at: "2026-11-04T09:00:00+02:00", route: "assistant", assistant_id: process.env.ASSISTANT_ID!, max_attempts: 2, note: "Wants to hear about the renewal offer", metadata: { crm_contact_id: "0031x00000AbCdE" },});console.log(callback.id, callback.status, callback.due_at);import os
import requests
API = "https://api.morevoice.ai/v1"HEADERS = {"Authorization": f"Bearer {os.environ['MOREVOICE_API_KEY']}"}
# Ask the AI to call the customer back tomorrow morning. The time moves into your calling hours.response = requests.post( f"{API}/callbacks", headers=HEADERS, json={ "phone": "+972501234567", "name": "Dana Levi", "due_at": "2026-11-04T09:00:00+02:00", "route": "assistant", "assistant_id": os.environ["ASSISTANT_ID"], "max_attempts": 2, "note": "Wants to hear about the renewal offer", "metadata": {"crm_contact_id": "0031x00000AbCdE"}, }, timeout=30,)response.raise_for_status()callback = response.json()print(callback["id"], callback["status"], callback["due_at"])- When.
due_atis the earliest time to call (by default now, at most 90 days ahead). It is moved into your callback hours, which follow the calling hours, Shabbat and holidays, andwindow_endsays when it is too late. - Attempts.
max_attempts(1–10) tries before the callbackfailed. Each attempt is a call with its own call object;call_idpoints to the one that got through. - One per person. A second request for the same number while one is open is merged into it (
merged_requestscounts them);call_idon the request ties it to the call it came from, so repeating the request for the same call returns the first callback. - Events.
callback.scheduled, thencallback.completed,callback.failedorcallback.cancelled. - What the call carries. The call that returns the callback gets its
metadata, on the call object and in itscall.*events, so you can match it to your record. Withroute: "assistant",variablesandfirst_messagework as onPOST /v1/calls: the assistant also has the callback’s own{{name}},{{phone}},{{callback_reason}}(the note),{{callback_summary}}and{{callback_context}}, and your variables win over them.variablesandfirst_messageare not returned on the callback, and are deleted once it is closed.
The callback’s calls go through the same compliance gate as every other outbound call.
Test mode
Section titled “Test mode”With a test key, POST /v1/calls places a simulated call on the virtual carrier: no phone network is reached, nothing is billed (cost is 0), and the test numbers let you play out a busy line, a voicemail or a do-not-call refusal. from_number_id is optional in test mode; when you send one, it must be one of your sandbox numbers (GET /v1/phone_numbers with a test key).