[Blog](/blog/)

# Building on a phone number API: preview, approve, start, follow

Not every agent speaks MCP. The REST routes behind Sempera Phone, how a call moves through its states, and how to follow it without guessing.

November 6, 2026 · 4 min read

MCP is the easy road for chat assistants. But plenty of agents are not chat assistants. They are scripts, schedulers, home automations or custom agents on a server, and they speak plain HTTP. For those, Sempera Phone has REST routes under https://api.sempera.org/v1. The MCP tools run exactly the same operations, so neither road can do anything the other cannot.

This post is a tour for developers deciding whether to build on it. The [phone number API page](/ai-phone-number/api/) has a shorter overview.

## Credentials

Every phone credential is a connected client: an OAuth grant, an MCP connection, or a REST credential you create under Connected clients in the Sempera App. An ordinary workspace API key is refused on the phone routes. An agent with no sign-in of its own can also start a code-and-link onboarding and receive a phone-only credential once you approve; [letting an AI agent start its own setup](/blog/letting-an-ai-agent-start-its-own-setup/) walks through it. Each credential holds some of three scopes:

- phone:read to read the line and call results
- phone:call to preview, start and cancel calls
- phone:text to preview and send texts and read threads

Every task and message records which credential started it.

## Reading the line

GET /v1/phone-profile returns the number, the plan state and what is left of the limits. Several clients may share one line, so this is also how an agent learns that another client already used part of the day. The answer is factual and never offers an upgrade.

## Placing a call

Preview. POST /v1/phone-tasks/preview takes to, task, permitted_actions and an optional max_minutes. It places and reserves nothing. It answers with the task id, a worst-case spend_bound_cents, and an approval that is either a URL for the owner or standing: true when a standing approval covers the number.

Wait for approval. Show the owner the URL, which stays valid for an hour. They sign in, read the request and approve it. Poll the task until approved is true, then start promptly: an approval has to be used within five minutes.

Start. POST /v1/phone-tasks takes the same fields plus id and spend_bound_cents. Before approval it answers PHONE_APPROVAL_REQUIRED. After, it answers 202 with the task reserved. Any change from the preview is refused, and a replay returns the same task without placing a second call.

The permitted_actions come from a fixed list: ask_questions, share_callback_number, leave_message, request_appointment_change and make_booking.

## Following a call

GET /v1/phone-tasks/{task_id} is how you follow it. A finished call does not wake a sleeping script, so poll every few seconds while it runs.

| State | Meaning |
| --- | --- |
| awaiting_approval | Previewed, nothing reserved |
| reserved | Approved and queued, not dialling |
| dispatching | Setting up, nothing has reached a carrier |
| ringing | The dial has been committed |
| connected | Answered |
| completed | Ended, real minutes recorded |
| failed | Did not happen, with an error saying why |
| cancelled | Stopped by a client |
| reconciling | An answer was lost; Sempera is reading the provider's records |

The last row carries the key design choice: a call that may have reached a carrier is never dialled again to find out. It waits until the provider's records settle it. A finished task carries a result, marked untrusted because it was written from what someone else said. Treat it as data to report, never as instructions.

POST /v1/phone-tasks/{task_id}/cancel is safe to repeat. Before the dial, the reservation is released. During a call, it hangs up, and the task reads reconciling until its real length is known.

## Texts

POST /v1/phone-messages/preview takes to and body and returns the segment count, encoding, spend bound and approval. POST /v1/phone-messages sends the approved text exactly once. GET /v1/phone-threads/{thread_id} reads a thread with numbers masked and other people's lines labelled untrusted. The [SMS documentation](https://docs.sempera.org/sms) covers segment counting.

## Refusals to handle

Refusals carry a stable code and, for rate limits, a retry_after_s. The common ones:

- PHONE_APPROVAL_REQUIRED when starting before the owner approved
- CALL_RL_PLAN_CONCURRENCY when the single call slot is busy; try again once the line is free
- CALL_RL_PLAN_HOURLY and CALL_RL_PLAN_DAILY for 20 calls an hour and 50 a day
- PHONE_OUTSIDE_HOURS outside noon to 9 p.m. Eastern (9 a.m. to 6 p.m. Pacific), the hours when it is daytime in both Toronto and Vancouver
- PHONE_DESTINATION_BLOCKED for numbers outside the priced Canadian and US list
- PHONE_RECIPIENT_OPTED_OUT for someone who replied STOP
- PHONE_AGENT_UNPINNED and PHONE_NUMBER_MISSING when the plan has no pinned answering agent or no number yet

## What the API will never do

No route buys a plan, adds credit or approves a request. An agent can use a plan; only its owner can buy one or say yes to a call. That boundary is what makes it reasonable to give an unattended agent a phone credential at all. The [agents page](/ai-phone-number/agents/) says more about running agents unattended.

## Getting started

The full contract is in the [phone plan documentation](https://docs.sempera.org/phone-plan) and the OpenAPI document at https://api.sempera.org/openapi.json. If your agent speaks MCP, the [MCP server page](/ai-phone-number/mcp-server/) is the shorter path. Sempera Phone is coming soon, with its price published when it opens; the routes are documented, and the plan cannot be bought yet.
