Introduction

AgentPhone is the phone call API for AI agents. Your agent sends a phone number and an objective; an AI voice assistant calls, handles the conversation, and you get back who picked up, a direct answer, an outcome, a summary, the transcript and, if you ask for it, typed JSON. Call several numbers for one goal with tasks, let the caller ask you questions mid-call, or have it hand the call to you. Use it over REST, the hosted MCP server, or the SDKs. Your first 5 calls are free, no credit card required.

Base URL: https://agentphone.app/api/v1. Calls go to US and Canada numbers only. Each call attempt costs 1 credit.

Use Policy

AgentPhone runs errands on behalf of a named person: calls to businesses, or to people who expect the call. Booking, confirming, cancelling, asking a question, passing on a message. The caller always says it is an AI assistant calling on behalf of that person (set on_behalf_of) and never claims to be human. No cold sales, telemarketing, robocalls or calls the other side would not expect, and never emergency or service numbers (911, 411, 988 and similar are blocked).

Authentication

Every request needs an API key, sent in the x-api-key header or as Authorization: Bearer. Get your key from the dashboard.

Header
x-api-key: ak_live_your_key_here# orAuthorization: Bearer ak_live_your_key_here

Quickstart

Make your first call in 30 seconds:

curl -X POST https://agentphone.app/api/v1/calls \  -H "x-api-key: YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "to_phone_number": "+14155551234",    "business_name": "Nopa",    "objective": "Ask if they have a table for 2 at 7pm tonight. Do not book.",    "on_behalf_of": "Sarah Lee"  }'

The call is queued immediately and the response carries its call_id. Poll until status is completed, failed or canceled, or get the result pushed to you with a webhook:

curl https://agentphone.app/api/v1/calls/CALL_ID \  -H "x-api-key: YOUR_API_KEY"

MCP Server

Give any MCP client the ability to place calls. The hosted server lives at https://agentphone.app/mcp (streamable HTTP). Nothing to install.

claude.ai and ChatGPT (sign in, no key)

Apps that cannot send a custom header connect with OAuth. Add the server URL as a connector; the app opens an AgentPhone sign-in page, you sign in (or create an account), check the app name and where you will be sent back, and click Approve. Calls placed by the app use your account's credits, same as with an API key.

  • claude.ai: Settings, Connectors, Add custom connector. URL https://agentphone.app/mcp. Leave the OAuth client ID and secret empty.
  • ChatGPT: add a connector (app) with URL https://agentphone.app/mcp and authentication set to OAuth.
  • Any other client that supports MCP OAuth can also connect with just the URL.

Disconnect an app any time from API Keys, Connected apps in the dashboard. Its access stops immediately.

Claude Code, Cursor, VS Code, Codex (API key)

Send your API key as Authorization: Bearer. This is the quickest option for coding agents.

Claude Code
claude mcp add --transport http agentphone https://agentphone.app/mcp \  --header "Authorization: Bearer ak_live_your_key_here"
Cursor: ~/.cursor/mcp.json
{  "mcpServers": {    "agentphone": {      "url": "https://agentphone.app/mcp",      "headers": { "Authorization": "Bearer ak_live_your_key_here" }    }  }}
VS Code: .vscode/mcp.json
{  "servers": {    "agentphone": {      "type": "http",      "url": "https://agentphone.app/mcp",      "headers": { "Authorization": "Bearer ak_live_your_key_here" }    }  }}
Codex: ~/.codex/config.toml
[mcp_servers.agentphone]url = "https://agentphone.app/mcp"bearer_token_env_var = "AGENTPHONE_API_KEY"
Clients that only run local servers
npx mcp-remote https://agentphone.app/mcp \  --header "Authorization: Bearer ak_live_your_key_here"

Tools

place_calltool

Calls a US or Canada number and works toward the objective. Inputs: to_phone_number, objective, business_name, website, language, on_behalf_of, caller_name, on_voicemail, callback_number, voicemail_message, webhook_url, output_schema, retry, allow_questions, question_timeout_seconds, transfer_to, sms_fallback, sms_text (same rules as Create Call) and wait_seconds. Costs 1 credit per attempt and returns credits_remaining. Returns early with pending_question when the caller asks you something.

get_calltool

Inputs: call_id, wait_seconds. Status and result of a call. Waits for it to finish, so an agent can call it again until done is true. Also returns pending_question, direction, from_phone_number, and when they apply sms_fallback, messages (the fallback text and replies), inbound_message and related_call_id.

list_callstool

Inputs: limit (1 to 50, default 10), status (any call status, including scheduled). Recent calls, newest first, with status, reached, answer, outcome, summary and attempt.

get_creditstool

Credits left on the account, plus a link to buy more.

answer_questiontool

Inputs: call_id, question_id (pending_question.id), answer (1 to 1000 characters). The caller relays the answer right away. Then call get_call (or get_task) to keep waiting.

start_tasktool

Calls 2 to 10 numbers with one objective and picks the best result. Inputs: objective, targets, output_schema, pick_best, max_concurrency, stop_when, on_behalf_of, caller_name, language, on_voicemail, callback_number, voicemail_message, webhook_url, retry, sms_fallback, sms_text, allow_questions, question_timeout_seconds, transfer_to and wait_seconds (same rules as Create Task). Waits for the task, sends progress notifications ("2 of 5 calls finished") and returns early when a call asks a question.

get_tasktool

Inputs: task_id, wait_seconds. Progress, each call's result and best, same shape as Get Task. Returns early when a call asks a question.

list_numberstool

No inputs. The account's dedicated numbers and the price (pricing). Buying stays a dashboard or API action by the account owner. See Numbers.

list_messagestool

Inputs: call_id, direction (inbound or outbound), phone_number, limit (1 to 100, default 20). Texts sent and received on the account's numbers, newest first.

Waiting for the result

place_call and get_call wait for the call to finish before returning: wait_seconds defaults to 50, max 240, and 0 returns immediately. Clients that send a progress token get a progress notification every poll, which keeps them from timing out. Most calls take longer than one wait, so the loop is:

  • Call place_call. If the result has done: false, call get_call with the same call_id. Repeat until done is true.
  • Report answer (or outcome and summary) to the user. reached says who picked up.
  • If nobody was reached and a retry is scheduled, the result has next_attempt with the new call_id and scheduled_for. Call get_call on that id after that time.
  • Every result includes a plain-language next_step while there is more to do.
get_call result
{  "call_id": "4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d",  "status": "completed",  "done": true,  "to_phone_number": "+14155551234",  "objective": "Ask if they have a blowout slot today between 1pm and 3pm. Do not book.",  "reached": "human",  "answer": "Yes, they have a 2:15pm slot today.",  "outcome": "achieved",  "outcome_details": "2:15pm slot available, about 45 minutes.",  "structured_output": { "available": true, "earliest_time": "2:15pm" },  "summary": "The salon has a 2:15pm blowout slot today.",  "transcript": "AI: Hi, this is an AI assistant calling for Yan...",  "duration_seconds": 58,  "recording_url": "https://agentphone.app/api/v1/calls/4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d/recording",  "attempt": 1,  "error": null,  "call_url": "https://agentphone.app/dashboard/calls/4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d"}

MCP results name two fields differently from REST: error is the call's error_code, and a retry carries previous_attempt_call_id instead of parent_call_id.

Answering the caller's questions

With allow_questions: true, the caller can put the other side on hold and ask you something. place_call and get_call then return right away with done: false and a pending_question. Answer before pending_question.expires_at:

Question loop
place_call(allow_questions: true)       -> done: false, pending_question { id, question, expires_at }  ask the user (or decide, if they already told you)answer_question(call_id, question_id, answer)get_call(call_id)                       -> waits; may return another pending_question...                                     -> done: true with answer / structured_output

Tasks work the same way: start_task or get_task returns early when a target has a pending_question; answer it with answer_question (that target's call_id), then call get_task until done is true and report best. The next_step field spells out the exact call to make.

place_call result while the caller waits (excerpt)
{  "call_id": "4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d",  "status": "in_progress",  "done": false,  "pending_question": {    "id": "5e0a1b2c-3d4e-4f5a-9b6c-7d8e9f0a1b2c",    "question": "They have 2:15pm, not 2pm. OK to book 2:15?",    "asked_at": "2026-10-29T18:02:10.000Z",    "expires_at": "2026-10-29T18:02:55.000Z"  },  "next_step": "The caller is on hold waiting for your answer to: \"They have 2:15pm, not 2pm. OK to book 2:15?\". Ask the user (or decide if they already told you), then call answer_question with call_id 4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d and question_id 5e0a1b2c-3d4e-4f5a-9b6c-7d8e9f0a1b2c before 2026-10-29T18:02:55.000Z. Then call get_call to keep waiting for the result."}

SDKs

Official Node.js / TypeScript and Python SDKs, both named agentphone-app. Coming soon: the packages are not published yet, and install instructions will appear here once they are. Until then, use the REST API or MCP server above. This is how they work:

  • Node.js: zero dependencies, built-in fetch, ESM and CommonJS, Node 18+.
  • Python: standard library only, Python 3.8+.
  • Both read AGENTPHONE_API_KEY from the environment, retry reads on network errors and 5xx, and never retry a create blindly.

Place a call and wait for the result

from agentphone_app import AgentPhoneclient = AgentPhone()  # reads AGENTPHONE_API_KEYcall = client.calls.create_and_wait(    "+14155551234",    "Ask if they have a table for 4 at 7pm tonight. Do not book.",    business_name="Luigi's Trattoria",    on_behalf_of="Sarah Lee",    output_schema={        "type": "object",        "properties": {"available": {"type": "boolean"}, "closest_time": {"type": "string"}},    },)print(call["reached"])               # "human"print(call.get("answer") or call["summary"])print(call["outcome"])print(call["structured_output"])     # {"available": True, "closest_time": "7:00pm"}

createAndWait / create_and_wait polls every 5 seconds for up to 10 minutes. On timeout it throws WaitTimeoutError with the call id; the call keeps going and you can wait on it again.

Everything else

created = client.calls.create(to_phone_number, objective, on_behalf_of="Sarah Lee")call = client.calls.get(created["call_id"])done = client.calls.wait(created["call_id"], timeout=300)recent = client.calls.list(limit=10, status="completed")link = client.calls.recording(created["call_id"], channel="stereo")  # {"url", "expires_at", ...}# With retry set, block until the last attempt finishesfinal = client.calls.wait(created["call_id"], follow_retries=True, timeout=7200)

Every Create Call parameter is accepted as a field (Node) or keyword argument (Python). Errors are typed (InvalidRequestError, AuthenticationError, InsufficientCreditsError, NotFoundError, RateLimitError, ServerError) and carry status and the API's code.

Verify webhooks

from agentphone_app import verify_webhook# Flaskif not verify_webhook(request.get_data(), request.headers, os.environ["AGENTPHONE_WEBHOOK_SECRET"]):    abort(401)

verifyWebhook / verify_webhook checks the v2 signature with a 5 minute replay window and falls back to the v1 signature. See Webhooks.

Agent skill

Agents that load skills (OpenClaw and others) can read https://agentphone.app/skills.md: the full instructions for placing calls with curl and an API key.

Create Call

Create an outbound phone call. An AI voice assistant dials the number and works toward the objective, introducing itself as an AI assistant calling on behalf of on_behalf_of.

POST/calls

Request body

to_phone_numberstringrequired

US or Canada number to call. E.164 preferred, e.g. +14155551234. A 10-digit number is read as US/Canada. Emergency and service numbers (911, 411, 988 and similar) are refused.

objectivestringrequired

What the caller should accomplish, written as instructions to the caller: what to find out or say, and any details it needs (names, dates, times, booking references). Say "Do not book" when you only want information.

on_behalf_ofstring, max 100

Person or company the call is for. The caller says it is calling on their behalf. Strongly recommended.

caller_namestring, max 60

How the caller introduces itself. Default an AI assistant. A first name like Alex becomes "Alex, an AI assistant".

business_namestring

Name of the business being called.

websitestring

The business's website. It is read before the call so the caller has context.

languagestring

Language to hold the call in: a name or ISO code, e.g. Spanish or de. Default: detected from the objective, else English. Writing the objective in a language, or saying "in Spanish" in it, also works.

on_voicemail"leave_message" | "hang_up"

What to do when voicemail answers. leave_message leaves a short message with who is calling, for whom, why, and the callback number. When you leave it out, the call leaves a message if it has on_behalf_of, callback_number or voicemail_message, and hangs up otherwise, since a message with no name and no number gives them nothing to act on.

callback_numberstring

US or Canada number the other side can call back. Read out on voicemail and given when asked. Validated like to_phone_number.

voicemail_messagestring, max 500

Exact voicemail text, replacing the generated message. Used when on_voicemail is leave_message.

output_schemaJSON Schema object

Typed result, returned as structured_output. Root must be "type": "object" with at least one field in properties. Max 8000 bytes, nesting depth 6, 50 fields in total, no $ref. See Structured Output.

retryobject

Call again if nobody is reached: { "on": ["no_answer", "busy"], "max_attempts": 2, "delay_minutes": 30 }. Every key is optional. See Retries.

webhook_urlstring (public https URL)

Where this call's result is posted, instead of your account webhook URL. Max 2048 characters; private, loopback and link-local addresses are refused.

allow_questionsboolean

Default false. Lets the caller put the other side on hold and ask you a question when it needs a decision the objective does not cover. You answer with Answer a Question. See Questions Mid-Call.

question_timeout_secondsinteger, 10 to 120

How long the caller waits for your answer before carrying on without it. Default 45. Only used with allow_questions.

transfer_tostring

Your own US or Canada phone, E.164. When the other side needs to talk to you directly, the caller offers to connect them and, if they agree, hands the call over. Cannot be the number being called. See Live Handoff.

sms_fallbackboolean

Available on request. Default false. Text the person once if nobody picks up (no answer, busy or voicemail) and the objective was not achieved. Needs a dedicated number on the account. See Texting and Call Backs.

sms_textstring, max 300

Exact text for sms_fallback, replacing the generated one. Needs sms_fallback: true.

curl -X POST https://agentphone.app/api/v1/calls \  -H "x-api-key: YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "to_phone_number": "+14155551234",    "business_name": "Mia Blowout Bar",    "objective": "Ask if they have a blowout slot today between 1pm and 3pm, and how long it takes. Do not book.",    "on_behalf_of": "Yan",    "callback_number": "+14155550123",    "output_schema": {      "type": "object",      "properties": {        "available": { "type": "boolean" },        "earliest_time": { "type": "string" },        "duration_minutes": { "type": "integer" }      },      "required": ["available"]    },    "retry": { "on": ["no_answer", "busy"], "max_attempts": 2, "delay_minutes": 30 }  }'

Response (202)

Response
{  "data": {    "call_id": "4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d",    "status": "dialing",    "provider_call_id": "019a3c1e-...",    "created_at": "2026-10-29T18:02:51.000Z"  },  "credits_remaining": 4}

If the call cannot be dialed it comes back with status: "failed" and the credit is refunded (credits_remaining reflects the refund).

Get Call

Retrieve the current status and result of a call. See Call Object for every field.

GET/calls/:call_id
curl https://agentphone.app/api/v1/calls/CALL_ID \  -H "x-api-key: YOUR_API_KEY"

Response (200)

Response
{  "data": {    "call_id": "4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d",    "status": "completed",    "to_phone_number": "+14155551234",    "objective": "Ask if they have a blowout slot today between 1pm and 3pm, and how long it takes. Do not book.",    "business_name": "Mia Blowout Bar",    "website": null,    "on_behalf_of": "Yan",    "caller_name": null,    "language": "en",    "reached": "human",    "answer": "Yes, they have a 2:15pm slot today; a blowout takes about 45 minutes.",    "outcome": "achieved",    "outcome_details": "2:15pm slot available today, about 45 minutes.",    "structured_output": { "available": true, "earliest_time": "2:15pm", "duration_minutes": 45 },    "summary": "The salon has a 2:15pm blowout slot today. A blowout takes about 45 minutes.",    "transcript": "AI: Hi, this is an AI assistant calling for Yan about a blowout appointment today...\nUser: Sure, we have 2:15...",    "duration_seconds": 58,    "recording_url": "https://agentphone.app/api/v1/calls/4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d/recording",    "ended_reason": "customer-ended-call",    "error_code": null,    "attempt": 1,    "parent_call_id": null,    "next_attempt_at": null,    "next_attempt": null,    "task_id": null,    "allow_questions": true,    "question_timeout_seconds": 45,    "transfer_to": null,    "pending_question": null,    "questions": [      {        "id": "5e0a1b2c-3d4e-4f5a-9b6c-7d8e9f0a1b2c",        "question": "They have 2:15pm, not 2pm. OK to book 2:15?",        "status": "answered",        "asked_at": "2026-10-29T18:03:10.000Z",        "expires_at": "2026-10-29T18:03:55.000Z",        "answer": "Yes, 2:15 works.",        "answered_at": "2026-10-29T18:03:21.000Z"      }    ],    "direction": "outbound",    "from_phone_number": null,    "sms_fallback": null,    "sms_text": null,    "related_call_id": null,    "inbound_message": null,    "messages": [],    "started_at": "2026-10-29T18:02:58.000Z",    "ended_at": "2026-10-29T18:03:56.000Z",    "created_at": "2026-10-29T18:02:51.000Z",    "updated_at": "2026-10-29T18:04:02.000Z",    "call_url": "https://agentphone.app/dashboard/calls/4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d"  }}

List Calls

List your recent calls, newest first. Each item is a full call object.

GET/calls

Query parameters

limitinteger

Number of calls to return. Default 50, max 200.

statusstring

Filter by status: scheduled, queued, dialing, in_progress, completed, canceled, failed

curl "https://agentphone.app/api/v1/calls?limit=10&status=completed" \  -H "x-api-key: YOUR_API_KEY"

Recordings

Recordings are stored privately and signed download links expire, so AgentPhone never hands them out directly. Every recording_url (REST, webhooks, MCP) is a stable AgentPhone link that needs your API key and redirects to a freshly signed, short-lived audio URL. recording_url is null when the call has no recording.

GET/calls/:call_id/recording

Query parameters

channelstring

mono (default, both sides mixed), stereo (caller left, recipient right), assistant (caller only) or customer (recipient only).

redirectboolean

Default: respond 302 with Location set to the signed URL. false returns JSON instead.

# Download. Use Authorization so curl drops the key when it follows the redirect to storage.curl -L -o call.wav -H "Authorization: Bearer YOUR_API_KEY" \  https://agentphone.app/api/v1/calls/CALL_ID/recording# Get the signed URL as JSON insteadcurl -H "x-api-key: YOUR_API_KEY" \  "https://agentphone.app/api/v1/calls/CALL_ID/recording?redirect=false&channel=stereo"

Responses

StatusMeaning
302Location is a signed audio URL valid for a short time. Follow it right away; ask again later for a new one.
200With redirect=false: { "data": { "call_id", "channel", "url", "expires_at" } }
400 invalid_channelchannel is not one of mono, stereo, assistant, customer.
401 unauthorizedMissing or invalid API key.
404 call_not_foundNo such call in your account.
404 recording_not_readyThe call is still in progress.
404 recording_not_foundThe call ended without a recording.
502 recording_unavailableStorage is temporarily unreachable. Retry after the Retry-After header (30 seconds).

Answer a Question

Answers the question a live call is waiting on. Only for calls placed with allow_questions: true. Take the id from pending_question on Get Call or from the call.question webhook. The caller relays your answer immediately. See Questions Mid-Call.

POST/calls/:call_id/answer

Request body

question_idstringrequired

pending_question.id.

answerstring, 1 to 1000 charactersrequired

Your answer, as you would tell the caller, e.g. Yes, 2:15 works. Book it.

curl -X POST https://agentphone.app/api/v1/calls/CALL_ID/answer \  -H "x-api-key: YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{ "question_id": "QUESTION_ID", "answer": "Yes, 2:15 works. Book it." }'

Responses

StatusMeaning
200Answered: { "data": { "call_id", "question": { "id", "question", "status": "answered", "asked_at", "expires_at", "answer", "answered_at" } } }
400 missing_fieldquestion_id or answer is missing.
400 invalid_answeranswer is empty or longer than 1000 characters.
404 call_not_foundNo such call in your account.
404 question_not_foundNo such question on this call.
409 question_already_answeredThis question was already answered.
409 question_expiredThe question timed out; the caller carried on without an answer.

Create Task

One objective, 2 to 10 numbers, a few calls at a time, and the best result picked for you. "Call these 5 salons and give me the earliest blowout slot today." Every call is a normal call: it has its own call_id, works with Get Call and sends its own webhook events. See Tasks for how calls are scheduled, charged and compared.

POST/tasks

Request body

objectivestringrequired

What every call should accomplish, written as instructions to the caller.

targetsarray, 2 to 10 itemsrequired

{ "to_phone_number", "business_name"?, "website"? }. Each number is validated like to_phone_number on a single call. No duplicates. Dialed in the order given. For one number, use Create Call.

output_schemaJSON Schema object

Shared by every call; each call returns structured_output in this shape. Required for pick_best.

pick_bestobject

{ "by": "<field>", "prefer": "earliest" | "latest" | "min" | "max" | "true" }. by names a field of structured_output and may be a dot path (slot.time); its first part must be in output_schema.properties. Without it, best is the first call to achieve the objective. See Tasks.

max_concurrencyinteger, 1 to 10

Calls live at the same time. Default 3, capped at the number of targets.

stop_when"all" | "first_success"

Default all: call every target. first_success: once a call achieves the objective, targets not yet dialed are canceled. Calls already live finish normally.

Every Create Call optionshared

on_behalf_of, caller_name, language, on_voicemail, callback_number, voicemail_message, retry, webhook_url, allow_questions, question_timeout_seconds, transfer_to, sms_fallback, sms_text. They apply to every target, with the same rules as Create Call. A webhook_url also receives task.completed.

curl -X POST https://agentphone.app/api/v1/tasks \  -H "x-api-key: YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "objective": "Ask for the earliest blowout slot today and the price. Do not book.",    "on_behalf_of": "Yan",    "targets": [      { "to_phone_number": "+14155550201", "business_name": "Mia Blowout Bar" },      { "to_phone_number": "+14155550202", "business_name": "Drybar Union St" },      { "to_phone_number": "+14155550203", "business_name": "Blo Marina" }    ],    "output_schema": {      "type": "object",      "properties": { "earliest_time": { "type": "string" }, "price": { "type": "number" } }    },    "pick_best": { "by": "earliest_time", "prefer": "earliest" },    "max_concurrency": 2  }'

Response (202)

The task object (see Get Task), after the first batch of up to max_concurrency calls has been dialed. Poll GET /tasks/:task_id until done is true, or wait for the task.completed webhook.

Errors

StatusMeaning
400 invalid_targetstargets is not an array of 2 to 10 objects, or a number is listed twice.
400 invalid_pick_bestpick_best is malformed, output_schema is missing, or by is not in output_schema.properties.
400 invalid_max_concurrencymax_concurrency is not an integer from 1 to 10.
400 invalid_stop_whenstop_when is not all or first_success.
400 (any Create Call code)A target or shared option failed a Create Call check. The message starts with targets[i]:.
400 sms_fallback_needs_numbersms_fallback without an active dedicated number. Refused before any credit is reserved.
400 sms_fallback_unavailableTexting is not enabled for this account yet.
402 insufficient_creditsNot enough credits to start. Includes credits_required, credits_balance and buy_credits_url.
429 rate_limit_exceededCreating a task counts as one request against the 10 per minute limit.

Get Task

Progress, every call's result and the best one. Also the data of the task.completed webhook and the result of MCP get_task.

GET/tasks/:task_id
curl https://agentphone.app/api/v1/tasks/TASK_ID \  -H "x-api-key: YOUR_API_KEY"

Response (200)

Response
{  "data": {    "task_id": "8c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",    "status": "completed",    "done": true,    "objective": "Ask for the earliest blowout slot today and the price. Do not book.",    "stop_when": "all",    "max_concurrency": 2,    "pick_best": { "by": "earliest_time", "prefer": "earliest" },    "counts": { "total": 3, "queued": 0, "in_progress": 0, "done": 3, "canceled": 0, "failed": 0 },    "credits": { "spent": 3, "reserved": 0 },    "best": {      "index": 0,      "call_id": "4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d",      "to_phone_number": "+14155550201",      "business_name": "Mia Blowout Bar",      "value": "2:15pm",      "reason": "Earliest earliest_time.",      "answer": "They have a 2:15pm slot today for $45.",      "structured_output": { "earliest_time": "2:15pm", "price": 45 }    },    "targets": [      {        "index": 0,        "to_phone_number": "+14155550201",        "business_name": "Mia Blowout Bar",        "status": "done",        "call_id": "4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d",        "call_status": "completed",        "attempt": 1,        "reached": "human",        "outcome": "achieved",        "answer": "They have a 2:15pm slot today for $45.",        "summary": "Mia Blowout Bar has a 2:15pm blowout slot today for $45.",        "structured_output": { "earliest_time": "2:15pm", "price": 45 },        "duration_seconds": 64,        "finished_order": 2,        "error": null,        "pending_question": null      }    ],    "created_at": "2026-10-29T18:00:00.000Z",    "completed_at": "2026-10-29T18:03:10.000Z",    "task_url": "https://agentphone.app/api/v1/tasks/8c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f"  }}

Fields

status, donestring, boolean

running or completed; done is true once every target is resolved.

countsobject

Targets by state: total, queued, in_progress (dialing or calling), done, canceled, failed.

creditsobject

spent: calls dialed so far, retries included. reserved: credits still held for targets not yet dialed (0 once the task completes).

bestobject | null

The winning target: index, call_id, to_phone_number, business_name, value (the compared field, null without pick_best), reason, answer, structured_output. Null when no call qualifies.

targets[].statusstring

queued, dialing, calling (a scheduled retry also counts as calling), done, canceled (stopped by first_success before dialing) or failed (never dialed, the dial failed, or no result after 60 minutes; see error).

targets[]object

Also call_id (the latest attempt when retry is set), call_status, attempt, reached, outcome, answer, summary, structured_output, duration_seconds, finished_order (1 for the first call to finish), error and pending_question (while that call waits on you).

404 task_not_found when the task does not exist or belongs to another account.

List Tasks

Your recent tasks, newest first. Each item is a summary: task_id, status, objective, stop_when, targets (how many), created_at, completed_at. Use Get Task for results.

GET/tasks

Query parameters

limitinteger

Number of tasks to return. Default 50, max 100.

curl "https://agentphone.app/api/v1/tasks?limit=20" \  -H "x-api-key: YOUR_API_KEY"

Numbers

Available on request. Dedicated numbers and texting are turned off until they are enabled for your account. Until then GET /numbers shows pricing.enabled: false, buying returns 403 numbers_disabled and sms_fallback returns 400 sms_fallback_unavailable. Ask at support@agentphone.app.

Your own US number. Outbound calls then come from it instead of a shared number, so the person you called can call or text back, and texts (sms_fallback) are sent from it. A number costs a monthly price in credits, charged when you buy it and then every month. See Texting and Call Backs.

List numbers and the price

GET/numbers

?include_released=true also lists released numbers.

Response
{  "data": [    {      "id": "6c1f2a3b-4c5d-4e6f-8a9b-0c1d2e3f4a5b",      "phone_number": "+14155550142",      "status": "active",      "capabilities": { "voice": true, "sms": true },      "owner_name": "Yan Mellata",      "monthly_credits": 3,      "paid_through": "2026-11-29T18:00:00.000Z",      "created_at": "2026-10-29T18:00:00.000Z",      "released_at": null    }  ],  "pricing": { "enabled": true, "available": true, "monthly_credits": 3, "max_numbers": 1, "sms_available": true }}
statusstring

active, past_due (the monthly credits could not be charged: calls use the shared number and texts stop; it turns active again at the next hourly renewal check once the account has credits) or released.

pricingobject

enabled: numbers are on for this account. available: a number can be bought now. monthly_credits: the price to send back as accept_monthly_credits. max_numbers: per account. sms_available: texting is on.

Examples here are illustrative: the price comes from pricing.monthly_credits.

Buy a number

POST/numbers
accept_monthly_creditsintegerrequired

The monthly price you accept. Must equal pricing.monthly_credits; otherwise you get 402 price_confirmation_required with the price in monthly_credits and nothing is bought. The first month is charged from your credits right away.

area_codestring, 3 digits

Preferred US area code, e.g. 415.

owner_namestring, max 100

Who the AI answers for on calls to this number.

# See the price firstcurl https://agentphone.app/api/v1/numbers -H "x-api-key: YOUR_API_KEY"# Buy, accepting that pricecurl -X POST https://agentphone.app/api/v1/numbers \  -H "x-api-key: YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{ "area_code": "415", "owner_name": "Yan Mellata", "accept_monthly_credits": 3 }'

201 with { "data": <number>, "credits_remaining": 97 }.

StatusMeaning
403 numbers_disabledNumbers are not enabled for this account yet.
402 price_confirmation_requiredaccept_monthly_credits is missing or not the current price. The body has monthly_credits.
402 billing_not_configuredNumbers cannot be bought yet: pricing is not set up.
402 insufficient_creditsNot enough credits for the first month. Includes monthly_credits and buy_credits_url.
400 invalid_area_codearea_code is not a 3-digit US area code.
400 invalid_owner_nameowner_name is longer than 100 characters.
400 invalid_accept_monthly_creditsaccept_monthly_credits is not a whole number.
409 number_limit_reachedThe account already has max_numbers numbers. Release one first.
409 no_numbers_availableNothing available (in that area code). Try another or leave it out.
502 provision_failedSetup failed. Nothing was charged; retry.
503 numbers_unavailableTemporarily unavailable. Nothing was charged.

Change the owner name

PATCH/numbers/:id

Body { "owner_name": "Acme Dental" } (a string up to 100 characters, or null). Returns the number. 404 number_not_found, 400 invalid_owner_name.

Release a number

DELETE/numbers/:id

Gives the number back to the carrier. Irreversible: the number can go to someone else. Credits already paid for the current month are not refunded. Returns the number with status: "released". 404 number_not_found, 502 release_failed (nothing changed, retry).

Messages

Available on request, like Numbers. Texts sent from and received on your numbers, newest first: SMS fallbacks after unanswered calls, replies to them, and opt-outs.

GET/messages

Query parameters

limitinteger

Default 50, max 200.

call_idstring

Only texts linked to this call.

direction"inbound" | "outbound"

Received or sent. Anything else returns 400 invalid_direction.

phone_numberstring

Only texts to or from this number (E.164).

curl "https://agentphone.app/api/v1/messages?call_id=CALL_ID&direction=inbound" \  -H "x-api-key: YOUR_API_KEY"
Response
{  "data": [    {      "message_id": "b13c4d5e-6f70-4a8b-9c0d-1e2f3a4b5c6d",      "direction": "inbound",      "from": "+14155551234",      "to": "+14155550142",      "body": "Yes we have a table at 7, under what name?",      "call_id": "4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d",      "kind": "reply",      "status": "received",      "error_code": null,      "created_at": "2026-10-29T18:20:41.000Z",      "call_url": "https://agentphone.app/dashboard/calls/4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d"    }  ]}
kindstring

sms_fallback, reply, opt_out (STOP and similar) or opt_in (START).

statusstring

Inbound: received. Outbound: queued, sent, delivered, undelivered, failed or skipped (not sent; error_code says why).

call_id, call_urlstring | null

The call a text belongs to. A reply is linked to the call whose text it answers, else the latest call to that number in the last 7 days. call_url is present only when call_id is set.

Call Object

Returned by Get Call, List Calls and (as data) in webhook events. Fields that do not apply are null.

Result

call_idstring (UUID)

Unique id of this call attempt.

statusstring

scheduled, queued, dialing, in_progress, completed, failed or canceled. See Call Lifecycle.

reachedstring | null

Who picked up: human, voicemail, ivr (phone menu), screener (call screening), no_answer, busy or unknown.

answerstring | null

Direct answer to the objective in plain text. null when nobody was reached.

outcomestring | null

achieved, partial, not_achieved, not_reached (nobody was reached) or voicemail_left.

outcome_detailsstring | null

One-line explanation of the outcome.

structured_outputobject | null

JSON matching your output_schema, or null.

summarystring | null

Summary of the conversation.

transcriptstring | null

Full transcript, one line per turn (AI: is the caller, User: the other side).

recording_urlstring | null

Stable link to the recording: requires your API key and redirects to a short-lived signed URL. See Recordings.

duration_secondsinteger | null

Length of the connected call.

ended_reasonstring | null

Telephony reason the call ended, e.g. customer-ended-call, customer-did-not-answer, voicemail.

error_codestring | null

Why a call failed, in plain text.

started_at, ended_at, created_at, updated_atISO 8601 string

Timestamps.

call_urlstring

Get Call only: dashboard page with transcript and recording.

Retry chain

attemptinteger

1 for the first call, 2 or 3 for retries.

parent_call_idstring | null

The previous attempt's call_id.

next_attempt_atISO 8601 string | null

On a scheduled retry: when it dials.

next_attemptobject | null

Get Call only. On an attempt that scheduled a retry: { call_id, status, attempt, scheduled_for } of that retry.

retry_policyobject | null

The retry settings in effect for this chain.

Request echo

to_phone_number, objective, business_name, websitestring

As sent.

on_behalf_of, caller_name, on_voicemail, callback_number, voicemail_message, output_schema, webhook_urlas sent

The call options you set. on_voicemail shows the default leave_message when you did not set it.

languagestring

ISO code of the language the call was held in, e.g. en, es.

allow_questions, question_timeout_seconds, transfer_toas sent

question_timeout_seconds shows the default 45 when questions are on, and is null when they are off.

sms_fallback, sms_textboolean | null, string | null

The texting options you set.

Tasks, questions and texts

task_idstring | null

The task this call belongs to.

pending_questionobject | null

Get Call only. While the caller waits on you: { id, question, asked_at, expires_at }. See Questions Mid-Call.

questionsarray

Get Call only. Every question on the call: { id, question, status, asked_at, expires_at, answer, answered_at }, status one of pending, answered, expired.

directionstring

outbound, or inbound for a call to your dedicated number.

from_phone_numberstring | null

Outbound: the number that dialed, your dedicated number or the shared one (can be null for the shared number). Inbound: the caller.

related_call_id, inbound_messageinbound only

The outbound call this caller is most likely returning, and the message they left. See Texting and Call Backs.

messagesarray

Get Call only. The SMS fallback text and replies linked to this call, oldest first, in the message shape.

Call Lifecycle

Every call progresses through these statuses:

scheduledA retry waiting for next_attempt_at. No credit is spent until it dials.
queuedCall created, waiting to be dispatched.
dialingPhone is ringing.
in_progressCall connected, the caller is talking.
completedCall finished. Transcript, summary, answer and outcome available.
canceledCall was canceled before completion.
failedCall could not be placed or nobody picked up. Check reached and error_code.

completed, failed and canceled are final. The summary and transcript can land a few seconds after the status turns completed.

Outcomes

achievedThe objective was done.
partialPart of it was done, or only part of the information was available.
not_achievedSomeone was reached but the objective was not done (they said no, did not know, refused).
not_reachedNobody was reached: no answer, busy, a screener or phone menu that never handed over, or voicemail without a message.
voicemail_leftVoicemail answered and the caller left a message.

How the Caller Behaves

  • It is always an AI assistant calling on behalf of a named person or company. Its first turn says who it is, who it is calling for and why, in about 20 words: "Hi, this is an AI assistant calling for Yan about a blowout appointment today."
  • It waits for the other side to say hello before speaking. If your account set a custom first message in settings, that message is spoken first instead.
  • It never claims to be human. Asked "is this a robot?", it says it is an AI assistant.
  • Call screeners (iPhone call screening, Google Call Screen, Google Voice "state your name"): it answers once with who, for whom and why, then waits silently for the person. It never asks the screener the question.
  • Phone menus: it listens to the options and presses keys.
  • Voicemail: it leaves a short message (who, for whom, why, callback number) or hangs up, per on_voicemail.
  • It ends the call when the objective is done, refused, or the other side says goodbye. It stays on through hold music and up to 60 seconds of silence, long enough for a screener to hand over.
  • Language: set language, write the objective in that language, or say "in Spanish" in the objective. Supported: English, Spanish, French, German, Italian, Portuguese, Dutch, Hindi, Russian, Japanese, Chinese, Korean, Polish, Ukrainian, Vietnamese, Turkish, Swedish, Arabic, Tagalog and more.

Structured Output

Pass a JSON Schema as output_schema and the call result includes structured_output: JSON extracted from the conversation that matches it. Use it when your code needs fields, not prose.

  • The root must be "type": "object" with at least one field under properties.
  • Types: object, array, string, number, integer, boolean, null. enum, required, items, description, anyOf, oneOf and allOf work.
  • Limits: 8000 bytes, nesting depth 6, 50 fields in total. $ref is not supported; inline the definition.
  • Fields the call could not fill can come back missing or null, so check reached and outcome before trusting them.
output_schema
{  "type": "object",  "properties": {    "available": { "type": "boolean" },    "earliest_time": { "type": "string", "description": "Earliest open slot, e.g. 2:15pm" },    "duration_minutes": { "type": "integer" },    "price_usd": { "type": ["number", "null"] },    "services": { "type": "array", "items": { "type": "string", "enum": ["blowout", "cut", "color"] } }  },  "required": ["available"]}
Result
{  "status": "completed",  "reached": "human",  "answer": "Yes, they have a 2:15pm slot today; a blowout takes about 45 minutes.",  "outcome": "achieved",  "structured_output": {    "available": true,    "earliest_time": "2:15pm",    "duration_minutes": 45,    "price_usd": 55,    "services": ["blowout"]  }}

Retries

Set retry to call again automatically when nobody is reached.

onarray

Any of no_answer, busy, voicemail: the reached values that trigger a retry. Default ["no_answer", "busy"].

max_attemptsinteger, 1 to 3

Total attempts including the first call. Default 2. 1 means no retries.

delay_minutesinteger, 5 to 1440

Wait between attempts. Default 30.

  • Each attempt is its own call with its own call_id, attempt number and parent_call_id. It starts as scheduled and dials at or shortly after next_attempt_at.
  • Get Call on the unanswered attempt returns next_attempt so you can follow the chain. Each attempt sends its own webhook event.
  • Each attempt costs 1 credit, charged when it dials; a failed dial is refunded. If the account is out of credits when a retry is due, that attempt is marked failed and not dialed.
GET /calls/:call_id on the first attempt
{  "data": {    "call_id": "4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d",    "status": "failed",    "reached": "no_answer",    "outcome": "not_reached",    "answer": null,    "attempt": 1,    "next_attempt": {      "call_id": "9e8d7c6b-5a49-4382-a1b0-c9d8e7f6a5b4",      "status": "scheduled",      "attempt": 2,      "scheduled_for": "2026-10-29T18:34:10.000Z"    }  }}

Tasks

A task runs one objective against several numbers. Create it with Create Task (or MCP start_task) and read it with Get Task.

How calls are scheduled

  • Targets are dialed in the order given, at most max_concurrency at a time. When a call ends, the next queued target is dialed right away.
  • With retry, a target follows its retries: it stays calling until the last attempt ends, and its call_id points at the latest attempt.
  • stop_when: "first_success": once any call's outcome is achieved, targets not yet dialed become canceled. Calls already live finish normally and still count.
  • A call that reports no result within 60 minutes is marked failed so the task can finish.
  • The task completes when every target is done, canceled or failed. Then task.completed is sent once.

Credits

  • Each dialed call costs 1 credit, like any call.
  • stop_when: "all" needs one credit per target when you create the task. They are reserved up front, so the task cannot run dry halfway.
  • stop_when: "first_success" needs only 1 credit to start. It reserves up to one per target from your balance. If the reservation runs out, later targets use your balance when they dial and are marked failed ("Not called: out of credits.") if it is empty.
  • Reserved credits for targets that were never dialed (canceled by first_success, or a dial that failed) go back to your balance. credits.reserved is 0 once the task completes.
  • Retry attempts are charged when they dial, like any retry.

The best result

Only calls that reached someone count: targets that are done with an outcome other than not_reached or voicemail_left. Without pick_best, best is the first of them to finish with outcome achieved. With it, the call whose structured_output field by has the best value:

preferPicks
earliestThe smallest time of day (2:15pm, 14:15, noon), date or datetime (2026-10-30T14:15:00Z), or number. When results mix these kinds, the most common kind is compared.
latestThe largest value, compared the same way as earliest.
minThe lowest number. Strings like $45 or 1,200 count as numbers.
maxThe highest number, parsed the same way as min.
trueThe first call where the field is true (or the string yes).

Values that cannot be compared are skipped. Ties go to the call that finished first. best is null when no call qualifies; the per-target results are still there.

Questions Mid-Call

With allow_questions: true the caller can put the other side on hold and ask you something it cannot decide alone: "They have 2:15, not 2pm. OK to book?" Works on single calls, tasks and MCP.

  • The caller says a short hold line ("Let me check with Yan, one moment.") and asks one self-contained question, including what the other side offered.
  • You get a call.question webhook, and Get Call (or the task target) shows pending_question. Over MCP, place_call, get_call, start_task and get_task return early with it.
  • Answer with POST /calls/:call_id/answer or MCP answer_question before expires_at. The caller relays it immediately.
  • No answer within question_timeout_seconds (default 45, 10 to 120): the caller does not commit to anything that needed the decision. It says you will follow up, or offers to take a message, and carries on.
  • On English calls the caller reassures the other side while it waits ("Thanks for holding, I'm still checking.").
  • At most 3 questions per call. Only the account that placed the call can answer. Webhook retries run far longer than the timeout, so answer from the first delivery.
pending_question
"pending_question": {  "id": "5e0a1b2c-3d4e-4f5a-9b6c-7d8e9f0a1b2c",  "question": "They have 2:15pm, not 2pm. OK to book 2:15?",  "asked_at": "2026-10-29T18:02:10.000Z",  "expires_at": "2026-10-29T18:02:55.000Z"}

Get Call also returns questions: every question on the call with its status (pending, answered, expired), answer and answered_at. For the MCP loop see Answering the caller's questions.

Live Handoff

Set transfer_to to your own US or Canada phone and the caller can connect the other side to you live.

  • It offers the handoff only when the other side needs you directly: they insist on speaking with you, they need your own consent or identity, or a decision the caller cannot make (and, with allow_questions, a question could not settle).
  • It asks first ("Would you like me to connect you with Yan now?"). Only if they agree, it says "Connecting you now" and transfers.
  • Your phone rings. When you pick up you are connected and the AI drops off. Where the line supports it, you first hear a short briefing on who is on the line and what the call is about.
  • It never transfers to a voicemail, a call screener or a phone menu, and never just because the objective is done.
  • transfer_to is validated like callback_number and cannot be the number being called (invalid_transfer_to).

Texting and Call Backs

Available on request. Everything in this section needs a dedicated number (Numbers), which is disabled until enabled for your account. Texting is enabled separately. Ask at support@agentphone.app.

Which number a call uses

Your oldest active dedicated number, otherwise the shared AgentPhone number. from_phone_number on the call shows which. With your own number, the person you called can call or text it back.

Text when nobody answers

Add sms_fallback: true to a call or task. If nobody picks up (reached is no_answer, busy or voicemail) and the objective was not achieved, the person gets one text from your number: who, for whom, why, and how to reply. With retry, only the last attempt texts. Set sms_text (max 300 characters) for exact wording. Texts are never sent from the shared number.

Generated text
Hi, this is an AI assistant texting for Yan. I just called to ask if you have a table for two tonight at 7pm but couldn't reach you. Reply here or call this number back. Reply STOP to opt out.
  • With callback_number set, the text says "or call" that number instead of "call this number back".
  • Refused when you place the call, before any credit is spent: sms_fallback_needs_number (no active number), sms_fallback_unavailable (texting not enabled), invalid_sms_fallback, invalid_sms_text.
  • A text that cannot be sent at the end of the call is still recorded, with status: "skipped" and an error_code (opted_out, sms_disabled, a2p_not_registered, sms_unavailable, no_org_number, number_not_sms_capable), so you can see why. A carrier rejection is failed with the carrier's error code.
  • Replies arrive as message.received webhooks, appear in messages on Get Call and MCP get_call, and in GET /messages.

Opt-outs

"Reply STOP to opt out." is added to the first text your account sends to a number. A reply of STOP, STOPALL, UNSUBSCRIBE, CANCEL, END, QUIT, OPTOUT or REVOKE (the whole message, any case) stops every text from your account to that number until they reply START, UNSTOP or YES. Those replies are stored with kind opt_out or opt_in and sent as message.received. Texts to an opted-out number are skipped with error_code: "opted_out".

Inbound calls

When someone calls your number, an AI assistant answers for you: "Hi, you've reached the AI assistant for Yan. Yan can't take the call right now, but I can take a message. Who's calling?" It takes who is calling, the best callback number and what it is about. If you called them in the last 7 days, it knows what that call was about and captures their answer. It says it is an AI, never agrees to anything on your behalf, and only shares what that earlier call's objective and summary contain. The name it answers for is the earlier call's on_behalf_of, else the number's owner_name.

The call is stored like any other with direction: "inbound", from_phone_number the caller, to_phone_number your number, related_call_id the call they are returning, answer the message, and inbound_message. You get a call.inbound webhook once it ends.

inbound_message
"inbound_message": {  "caller_name": "Maria, Luigi's",  "callback_number": "+14155551234",  "message": "A table for two at 7pm tonight is available.",  "about_previous_call": true,  "answer_to_previous_call": "Yes, 7pm works for two."}

Inbound texts

Texts to your number are stored, linked to the call they answer (the call whose text they reply to, else your latest call to that number in the last 7 days) and sent as message.received.

Webhooks

When a call ends (and for the other events below), AgentPhone POSTs a JSON event to your webhook URL. Set the URL and a signing secret on the Webhooks page of the dashboard. A per-call webhook_url set when placing the call takes precedence over the account URL.

Events

eventWhen
call.completedThe call connected and ended normally. Sent once the transcript and summary are ready (at most about 2 minutes after hang-up).
call.failedThe call failed or was canceled: no answer, busy, dial error.
call.questionThe caller asked you a question mid-call (allow_questions). Answer before data.question.expires_at.
task.completedEvery target of a task is resolved. data is the task from Get Task, including best.
call.inboundAvailable on request. Someone called your dedicated number and the call ended. Sent once the transcript or summary is in.
message.sentAvailable on request. A text was handed to the carrier (not sent for skipped texts).
message.receivedAvailable on request. A text arrived on your number, including STOP and START.
webhook.testSent by the dashboard Send test event button. data is sample data with test: true.

Call events (call.completed, call.failed, call.inbound) keep "type": "call.updated" so receivers written against the original webhook keep working. For call.question, task.completed, message.sent and message.received, type equals event. New receivers should switch on event.

Where each event goes: call events and call.question use the call's webhook_url, task.completed the task's, and message events the webhook_url of the call the text is linked to. Without one, the account URL. Inbound calls always use the account URL. Every event has the same headers, signatures and retries.

Payload

POST to your webhook URL
{  "type": "call.updated",  "event": "call.completed",  "delivery_id": "8f2d6c1e-3b0a-4c47-9d0e-2a51f7c1b9aa",  "created_at": "2026-10-29T18:04:11.201Z",  "data": {    "call_id": "4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d",    "status": "completed",    "to_phone_number": "+14155551234",    "objective": "Ask if they have a table for 2 tonight at 7pm. Do not book.",    "business_name": "Sample Bistro",    "website": null,    "started_at": "2026-10-29T18:02:58.000Z",    "ended_at": "2026-10-29T18:04:05.000Z",    "duration_seconds": 67,    "reached": "human",    "answer": "Yes, they have a table for 2 at 7pm tonight.",    "outcome": "achieved",    "outcome_details": "Table for 2 at 7pm available.",    "structured_output": null,    "ended_reason": "customer-ended-call",    "attempt": 1,    "parent_call_id": null,    "task_id": null,    "summary": "...",    "transcript": "...",    "recording_url": "https://agentphone.app/api/v1/calls/4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d/recording",    "error_code": null,    "created_at": "2026-10-29T18:02:51.000Z",    "updated_at": "2026-10-29T18:04:09.000Z",    "call_url": "https://agentphone.app/dashboard/calls/4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d"  }}

call.question payload

call.question
{  "type": "call.question",  "event": "call.question",  "delivery_id": "1d7e0c4a-9b2f-4e61-8a3d-5c6b7a8e9f01",  "created_at": "2026-10-29T18:02:10.300Z",  "data": {    "call_id": "4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d",    "task_id": null,    "to_phone_number": "+14155550201",    "business_name": "Mia Blowout Bar",    "objective": "Book a blowout at 2pm today.",    "question": {      "id": "5e0a1b2c-3d4e-4f5a-9b6c-7d8e9f0a1b2c",      "question": "They have 2:15pm, not 2pm. OK to book 2:15?",      "asked_at": "2026-10-29T18:02:10.000Z",      "expires_at": "2026-10-29T18:02:55.000Z"    },    "answer_url": "https://agentphone.app/api/v1/calls/4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d/answer",    "call_url": "https://agentphone.app/dashboard/calls/4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d"  }}

Answer by posting { "question_id": data.question.id, "answer": "..." } to answer_url with your API key. See Answer a Question.

task.completed payload

task.completed (excerpt)
{  "type": "task.completed",  "event": "task.completed",  "delivery_id": "2a9c4e1f-7b3d-4f80-9e2a-6d5c4b3a2f10",  "created_at": "2026-10-29T18:03:10.500Z",  "data": {    "task_id": "8c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",    "status": "completed",    "done": true,    "counts": { "total": 3, "queued": 0, "in_progress": 0, "done": 3, "canceled": 0, "failed": 0 },    "credits": { "spent": 3, "reserved": 0 },    "best": {      "index": 0,      "call_id": "4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d",      "business_name": "Mia Blowout Bar",      "value": "2:15pm",      "reason": "Earliest earliest_time.",      "answer": "They have a 2:15pm slot today for $45."    },    "targets": [],    "task_url": "https://agentphone.app/api/v1/tasks/8c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f"  }}

data is the full task object from Get Task (cut short here). Each call in the task also sends its own call.completed or call.failed.

call.inbound payload

call.inbound (excerpt)
{  "type": "call.updated",  "event": "call.inbound",  "delivery_id": "3b0d5f2a-8c4e-4a91-8f3b-7e6d5c4b3a21",  "created_at": "2026-10-29T19:10:42.000Z",  "data": {    "call_id": "7f6e5d4c-3b2a-4190-8f7e-6d5c4b3a2918",    "status": "completed",    "direction": "inbound",    "from_phone_number": "+14155551234",    "to_phone_number": "+14155550142",    "related_call_id": "4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d",    "answer": "A table for two at 7pm tonight is available.",    "inbound_message": {      "caller_name": "Maria, Luigi's",      "callback_number": "+14155551234",      "message": "A table for two at 7pm tonight is available.",      "about_previous_call": true,      "answer_to_previous_call": "Yes, 7pm works for two."    },    "summary": "Maria from Luigi's called back: a table for two at 7pm tonight is available.",    "transcript": "...",    "call_url": "https://agentphone.app/dashboard/calls/7f6e5d4c-3b2a-4190-8f7e-6d5c4b3a2918"  }}

Same data fields as call.completed, with direction, from_phone_number, related_call_id and inbound_message filled in.

message.sent and message.received payload

message.received
{  "type": "message.received",  "event": "message.received",  "delivery_id": "4c1e6a3b-9d5f-4b02-9a4c-8f7e6d5c4b32",  "created_at": "2026-10-29T18:20:41.300Z",  "data": {    "message_id": "b13c4d5e-6f70-4a8b-9c0d-1e2f3a4b5c6d",    "direction": "inbound",    "from": "+14155551234",    "to": "+14155550142",    "body": "Yes we have a table at 7, under what name?",    "call_id": "4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d",    "kind": "reply",    "status": "received",    "error_code": null,    "created_at": "2026-10-29T18:20:41.000Z",    "call_url": "https://agentphone.app/dashboard/calls/4b1c2d3e-5f60-4a7b-8c9d-0e1f2a3b4c5d"  }}

data is a message. message.sent has the same shape with direction: "outbound" and kind: "sms_fallback".

Headers

HeaderMeaning
x-agentphone-eventSame as event in the body.
x-agentphone-delivery-idUnique per event, identical on every retry. Use it to ignore duplicates.
x-agentphone-attempt1 for the first try, up to 6.
x-agentphone-timestampUnix seconds when this attempt was sent.
x-agentphone-signaturev1: HMAC-SHA256 hex of the raw body with your webhook secret.
x-agentphone-signature-v2v2 (recommended): HMAC-SHA256 hex of "{timestamp}.{raw body}". Also lets you reject replays.

Signature headers are only sent when a webhook secret is set in the dashboard.

Verifying signatures

Always verify against the raw request body, before JSON parsing. v2 signs the timestamp together with the body, so reject timestamps more than a few minutes old:

import hashlib, hmac, os, timedef verify_agentphone(raw_body: bytes, headers, secret: str, tolerance_seconds: int = 300) -> bool:    ts = headers.get("x-agentphone-timestamp")    sig = headers.get("x-agentphone-signature-v2")    if not ts or not sig:        return False    if abs(time.time() - int(ts)) > tolerance_seconds:        return False    expected = hmac.new(secret.encode(), f"{ts}.".encode() + raw_body, hashlib.sha256).hexdigest()    return hmac.compare_digest(sig, expected)# Flask@app.post("/hook")def hook():    if not verify_agentphone(request.get_data(), request.headers, os.environ["AGENTPHONE_WEBHOOK_SECRET"]):        abort(401)    event = request.get_json()    return "", 200  # respond fast, dedupe on event["delivery_id"]

Legacy v1 check, body only:

expected = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()ok = hmac.compare_digest(expected, headers.get("x-agentphone-signature", ""))

Delivery and retries

  • Any 2xx response within 10 seconds counts as delivered. Anything else (non-2xx, timeout, connection error) is retried.
  • Up to 6 attempts: immediately, then after 1 minute, 5 minutes, 30 minutes, 2 hours and 12 hours (about 15 hours in total). After the 6th failure the delivery is marked failed and can be resent from the dashboard.
  • Retries carry the latest state of the call and the same delivery_id. Deliveries can arrive more than once (for example when your server timed out after processing), so dedupe on delivery_id.
  • Redirects are not followed. Point the webhook at the final URL.
  • Webhook URLs must be public addresses. Private, loopback and link-local addresses are refused. A per-call webhook_url must use https.
  • Changing the account webhook URL applies to pending retries; a per-call URL is fixed for that call.

Testing

On the Webhooks page, Send test event posts a signed webhook.test event to the URL in the field (saved or not) and shows the status code, latency and the start of the response body. Recent deliveries lists each delivery with its status, HTTP code and attempt, with Retry or Resend per row.

Errors

The API returns structured error responses:

Error response
{  "error": "Missing required field 'to_phone_number'. Expected E.164 phone number like +14155551234",  "code": "missing_field"}

Status codes

400Bad Request

Invalid input. code says which check failed and error says how to fix it.

401Unauthorized

Missing or invalid API key.

402Payment Required

Insufficient credits. The response includes a buy_credits_url, a Stripe Checkout link to purchase 10 credits. Surface this URL to the user. Buying a number without the price also returns 402 (price_confirmation_required).

403Forbidden

The feature is not enabled for your account (numbers_disabled).

404Not Found

Call, recording, task, question or number not found, or it doesn't belong to your account.

409Conflict

The question was already answered or expired, or a number cannot be bought right now.

429Too Many Requests

Rate limited. Max 10 calls/minute. Check the Retry-After header.

500Internal Server Error

Unexpected error on our end. Retry or contact support.

502Bad Gateway

Recording storage temporarily unreachable (retry after Retry-After), or the phone carrier failed while buying or releasing a number (nothing changed; retry).

503Service Unavailable

Numbers are temporarily unavailable. Nothing was charged.

Error codes

CodeDescription
unauthorizedMissing or invalid API key.
invalid_jsonRequest body is not valid JSON.
invalid_bodyBody is not a JSON object.
missing_fieldA required field (to_phone_number or objective) is missing.
invalid_phoneNot a valid US or Canada number. Expected +1XXXXXXXXXX with a real area code.
unsupported_regionOnly US/Canada (+1) numbers are supported, for to_phone_number and callback_number.
emergency_numberEmergency numbers cannot be called through the API.
blocked_numberService numbers (411, 611, 911, 988 and similar) cannot be called.
invalid_caller_namecaller_name is longer than 60 characters.
invalid_on_behalf_ofon_behalf_of is longer than 100 characters.
invalid_on_voicemailon_voicemail is not leave_message or hang_up.
invalid_callback_numbercallback_number is not a valid US or Canada number.
invalid_voicemail_messagevoicemail_message is longer than 500 characters.
invalid_output_schemaoutput_schema breaks a rule in Structured Output. The message names the field.
invalid_retryretry.on, retry.max_attempts or retry.delay_minutes is out of range.
invalid_webhook_urlwebhook_url is not a public https URL (or longer than 2048 characters).
invalid_allow_questionsallow_questions is not true or false.
invalid_question_timeoutquestion_timeout_seconds is not an integer from 10 to 120.
invalid_transfer_totransfer_to is not a valid US or Canada number, or is the number being called.
invalid_sms_fallbacksms_fallback is not true or false.
invalid_sms_textsms_text is not a string, is longer than 300 characters, or is set without sms_fallback: true.
sms_fallback_needs_numbersms_fallback needs an active dedicated number on the account.
sms_fallback_unavailableTexting is not enabled for this account yet.
invalid_targetstargets is not an array of 2 to 10 objects, or lists a number twice.
invalid_pick_bestpick_best is malformed, output_schema is missing, or by is not a field of output_schema.
invalid_max_concurrencymax_concurrency is not an integer from 1 to 10.
invalid_stop_whenstop_when is not all or first_success.
insufficient_creditsNot enough credits. Response includes buy_credits_url (Stripe Checkout link).
rate_limit_exceededToo many requests. Wait and retry.
call_not_foundThe specified call_id does not exist.
call_failedThe call could not be dispatched or completed.
task_not_foundThe specified task_id does not exist.
task_failedUnexpected error while starting the task. Check List Tasks before retrying.
invalid_answeranswer is empty or longer than 1000 characters.
question_not_foundNo such question on this call.
question_already_answeredThe question was already answered.
question_expiredThe question timed out; the caller carried on without an answer.
numbers_disabledDedicated numbers are not enabled for this account yet.
price_confirmation_requiredSend accept_monthly_credits equal to the current price (in monthly_credits).
billing_not_configuredNumbers cannot be bought yet: pricing is not set up.
invalid_area_codearea_code is not a 3-digit US area code.
invalid_owner_nameowner_name is too long (max 100) or not a string.
invalid_accept_monthly_creditsaccept_monthly_credits is not a whole number.
number_limit_reachedThe account already has the maximum number of numbers.
no_numbers_availableNo number available (in that area code).
provision_failedSetting up the number failed. Nothing was charged.
numbers_unavailableNumbers are temporarily unavailable. Nothing was charged.
number_not_foundNo such number on this account.
release_failedReleasing the number failed. It is unchanged; retry.
invalid_directiondirection is not inbound or outbound.
invalid_channelRecording channel is not mono, stereo, assistant or customer.
recording_not_readyThe call is still in progress.
recording_not_foundThe call ended without a recording.
recording_unavailableRecording storage is temporarily unreachable.

Rate limits

The API enforces a limit of 10 calls per minute per API key. Creating a task counts as one request. When exceeded, the response includes a Retry-After header with the number of seconds to wait.