curl --request POST \
--url https://api.goyappr.com/phone-numbers/configure \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"inbound_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"outbound_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"friendly_name": "<string>",
"inbound_split": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"percent": 50
},
"outbound_split": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"percent": 50
}
}
'import requests
url = "https://api.goyappr.com/phone-numbers/configure"
payload = {
"phone_number_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"inbound_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"outbound_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"friendly_name": "<string>",
"inbound_split": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"percent": 50
},
"outbound_split": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"percent": 50
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone_number_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
inbound_agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
outbound_agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
friendly_name: '<string>',
inbound_split: {agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', percent: 50},
outbound_split: {agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', percent: 50}
})
};
fetch('https://api.goyappr.com/phone-numbers/configure', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.goyappr.com/phone-numbers/configure",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone_number_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'inbound_agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'outbound_agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'friendly_name' => '<string>',
'inbound_split' => [
'agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'percent' => 50
],
'outbound_split' => [
'agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'percent' => 50
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/phone-numbers/configure"
payload := strings.NewReader("{\n \"phone_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"inbound_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"outbound_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"friendly_name\": \"<string>\",\n \"inbound_split\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"percent\": 50\n },\n \"outbound_split\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"percent\": 50\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.goyappr.com/phone-numbers/configure")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"inbound_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"outbound_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"friendly_name\": \"<string>\",\n \"inbound_split\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"percent\": 50\n },\n \"outbound_split\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"percent\": 50\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/phone-numbers/configure")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"inbound_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"outbound_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"friendly_name\": \"<string>\",\n \"inbound_split\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"percent\": 50\n },\n \"outbound_split\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"percent\": 50\n }\n}"
response = http.request(request)
puts response.read_body{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}Configure Number
Assign inbound/outbound agents to a phone number. Accepts the same
inbound_split / outbound_split objects as
PATCH /phone-numbers/{id}, which is the preferred shape for new
integrations.
The takeover is immediate. As soon as this returns 200, the
number’s next call goes to the agent named here; calls already
connected finish with the agent that answered them. Nothing warns you
that the number was already carrying traffic — read the number first
if it is in production.
curl --request POST \
--url https://api.goyappr.com/phone-numbers/configure \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"inbound_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"outbound_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"friendly_name": "<string>",
"inbound_split": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"percent": 50
},
"outbound_split": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"percent": 50
}
}
'import requests
url = "https://api.goyappr.com/phone-numbers/configure"
payload = {
"phone_number_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"inbound_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"outbound_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"friendly_name": "<string>",
"inbound_split": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"percent": 50
},
"outbound_split": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"percent": 50
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone_number_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
inbound_agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
outbound_agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
friendly_name: '<string>',
inbound_split: {agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', percent: 50},
outbound_split: {agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', percent: 50}
})
};
fetch('https://api.goyappr.com/phone-numbers/configure', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.goyappr.com/phone-numbers/configure",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone_number_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'inbound_agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'outbound_agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'friendly_name' => '<string>',
'inbound_split' => [
'agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'percent' => 50
],
'outbound_split' => [
'agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'percent' => 50
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/phone-numbers/configure"
payload := strings.NewReader("{\n \"phone_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"inbound_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"outbound_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"friendly_name\": \"<string>\",\n \"inbound_split\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"percent\": 50\n },\n \"outbound_split\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"percent\": 50\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.goyappr.com/phone-numbers/configure")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"inbound_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"outbound_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"friendly_name\": \"<string>\",\n \"inbound_split\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"percent\": 50\n },\n \"outbound_split\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"percent\": 50\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/phone-numbers/configure")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"inbound_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"outbound_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"friendly_name\": \"<string>\",\n \"inbound_split\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"percent\": 50\n },\n \"outbound_split\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"percent\": 50\n }\n}"
response = http.request(request)
puts response.read_body{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}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.curl --request POST "$YAPPR_API_URL/phone-numbers/configure" \
--header "Authorization: Bearer $YAPPR_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"phone_number_id": "c0ffee00-0000-4000-8000-000000000001",
"inbound_agent_id": "9b29b0c9-0000-4000-8000-000000000001",
"outbound_agent_id": "9b29b0c9-0000-4000-8000-000000000001",
"friendly_name": "Clinic main line"
}'
| Field | Required | Notes |
|---|---|---|
phone_number_id | yes | The number’s UUID from the list — not the number itself. |
inbound_agent_id | no | Agent that answers. null unbinds. Omit to leave as it is. |
outbound_agent_id | no | Agent used when POST /calls sends no agent_id. null unbinds. |
friendly_name | no | Label shown in the dashboard. null clears it. |
inbound_split | no | {"agent_id":"…","percent":30} to run a second agent on incoming calls, or null to stop. percent is the share the second agent takes. |
outbound_split | no | The same for calls this number places. |
null is how you unbind. See
What a partial update writes below.
Response
{
"success": true,
"phone_number_id": "c0ffee00-0000-4000-8000-000000000001",
"sip_inbound_configured": true,
"sip_outbound_configured": true
}
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.
| What you send | What is written |
|---|---|
{"inbound_agent_id": "..."} | inbound_agent_id, and nothing else. The outbound agent, the name and both splits are untouched. |
{"inbound_agent_id": null} | inbound_agent_id is cleared. Still nothing else. |
{"friendly_name": "Haifa branch"} | The name. Neither agent moves. |
{"inbound_split": {...}} or {"inbound_split": null} | Both columns of that direction’s split, together. The other direction is untouched. |
{} (no writable field) | Nothing. The call still answers 200. |
The takeover is immediate
There is no staging step and no scheduled cutover. The moment this call returns200, 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:
curl https://api.goyappr.com/phone-numbers \
-H "Authorization: Bearer YOUR_API_KEY"
id. On that row, inbound_agent_id and outbound_agent_id say
who answers today.
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:- Buy the number —
POST /phone-numbers/purchase, or the dashboard. - Create the agent —
POST /agents, or duplicate one withPOST /agents/{id}/duplicateand change what differs. - Point the number at it — this endpoint, one call per number.
{
"phone_number_id": "3f0c1a2b-...",
"inbound_agent_id": "6f1b2c3d-...",
"friendly_name": "Haifa branch"
}
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.
Errors
| HTTP | Body | When |
|---|---|---|
400 | {"error":"phone_number_id is required"} | The field is missing. |
400 | {"error":"Invalid JSON body"} | The body did not parse. |
400 | {"error":"Cannot assign agents to a phone number that is pending regulatory approval"} | The number is still pending_requirements. Only a request that sets inbound_agent_id or outbound_agent_id is refused; one that changes friendly_name or a split goes through. |
403 | {"error":"You do not have access to this phone number"} | The number exists but belongs to another workspace. |
404 | {"error":"Phone number not found"} | No number with that id. A wrong or stale phone_number_id lands here, so check the id before assuming the number was released. |
422 | {"error":"…","code":"INVALID_SPLIT"} | The split is not an object or null, carries a key other than agent_id / percent, the share is outside 1–99, or the second agent is the one already bound to that direction. The message says which. An agent field that names no agent in this workspace is 404 AGENT_NOT_FOUND, naming the field. |
403 | {"error":"This key does not hold …","code":"INSUFFICIENT_SCOPE"} | The key does not hold phone_numbers:configure. |
Authorizations
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
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.