Skip to main content
POST
Configure number
Bind agents to a number you own: who answers incoming calls, who places outgoing ones, and whether either side is running an A/B test. Required scope: phone_numbers:configure. This is the last step of the number journey — the one that makes a number do something. Until an agent is bound, an incoming call is not answered and POST /calls without an explicit agent_id is refused with 422 AGENT_NOT_RESOLVED.
PATCH /phone-numbers/{id} takes the same fields against the same row and is the preferred shape for new integrations — the id is in the path, and unknown fields are rejected instead of ignored. This endpoint keeps working and answers identically; nothing that calls it has to move.
Omitted fields keep their stored value, and are not written at all. Sending an explicit null is how you unbind. See What a partial update writes below.

Response

The two sip_* flags are echoed as they already were: carrier-side routing is set up once, when the number activates, not on every agent change. Re-read the number with List owned numbers to see the bindings you just wrote.

What a partial update writes

A field you do not name is left alone — not read back and written again. Both doors into the row behave this way: PATCH /phone-numbers/{id} and this endpoint. This matters when more than one thing changes a number: a teammate in the dashboard, a second integration, a script re-running. Because each request carries only its own fields, two callers changing different fields do not overwrite each other, and a request that names only the inbound agent can never put back an outbound agent someone else has just changed.
The dashboard’s number page follows the same rule: pressing Save sends only the fields you edited on that screen, so a binding changed through the API in the meantime survives.
A split is validated against the agent the same request binds, falling back to the stored one when the request does not name it — so a single call can never leave a number split against itself.

The takeover is immediate

There is no staging step and no scheduled cutover. The moment this call returns 200, the number’s next call goes to the agent you just named — including a call that is already ringing but has not been answered yet. Calls already connected finish with the agent that answered them. Nothing warns you that the number was busy. If the number is in production, read it first and decide from what comes back:
Check what is on the number before you move it
This lists every number the workspace owns; find the one you are about to move by its id. On that row, inbound_agent_id and outbound_agent_id say who answers today.
How busy the number is, is not something the API reports per number today — the call list filters by agent, not by number. To see the traffic a number carries, open it in the dashboard: it shows the calls taken in each direction, and asks you to confirm before it moves a number that has been answering.
An agent that is inactive or an unpublished workflow will take the number’s calls and fail them, so publish the replacement before you point the number at it. To undo, send the previous agent ids back — the same call in the other direction.

One number per location

A number answers with exactly one agent, so a customer with several branches gives each branch its own number and its own agent. The number dialled is what decides which branch the caller reached; there is no routing to write inside the agent. Per location, once:
  1. Buy the number — POST /phone-numbers/purchase, or the dashboard.
  2. Create the agent — POST /agents, or duplicate one with POST /agents/{id}/duplicate and change what differs.
  3. Point the number at it — this endpoint, one call per number.
Give the Haifa number the Haifa agent
Outbound calls from a location work the same way: set outbound_agent_id on that location’s number, and place the call with from set to it. An explicit agent_id on POST /calls always wins over the number’s outbound agent.
Running two agents on one number — to compare two versions of a script on real traffic — is a different thing, and is described under Update Number.

Errors

Authorizations

Authorization
string
header
required

Your Yappr API key (e.g. ypr_live_...). Generate one in the dashboard under Settings → API Keys. No key is 401 MISSING_KEY; a key that is not one of ours, or is revoked, is 401 INVALID_KEY; an expired one is 401 EXPIRED_KEY. A valid key without the scope an operation needs is 403 INSUFFICIENT_SCOPE on every operation, and the message names the scope. Every response, a 401 included, carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset: the budget is 60 requests a minute per API key. Every 429, whatever its code, carries Retry-After (whole seconds, never zero): the per-key budget's RATE_LIMIT asks for what is left of the minute, a route's daily cap (RATE_LIMITED) for the time until that cap resets. All four headers are listed in Access-Control-Expose-Headers, so a browser can read them. A path the API does not serve (an unknown sub-path, an id left empty) is 404 ROUTE_NOT_FOUND, and a method a served path does not take is 405 METHOD_NOT_ALLOWED with an Allow header; both are answered before any scope check, and nothing is read or changed. A trailing slash is ignored where it cannot be an id left empty (POST /calls/ is POST /calls) and refused where it can (GET /calls/). A doubled slash inside a path is merged into one before the request reaches the API (GET //calls is GET /calls).

Body

application/json
phone_number_id
string<uuid>
required
inbound_agent_id
string<uuid> | null
outbound_agent_id
string<uuid> | null
friendly_name
string | null
inbound_split
object | null

A two-agent A/B test. percent is the share of calls the second agent (agent_id) takes; the resource's existing agent takes 100 - percent.

outbound_split
object | null

A two-agent A/B test. percent is the share of calls the second agent (agent_id) takes; the resource's existing agent takes 100 - percent.

Response

Number configured. The body echoes success, phone_number_id and the two sip_* flags as they already stood — carrier routing is set up once, at activation, not on every agent change. Re-read GET /phone-numbers to see the new bindings.