curl -X PATCH https://api.voicy.co/functions/v1/phone-number-modify/%2B972771234567 \
-H "Authorization: Bearer voicy_sk_live_xxx" \
-H "Content-Type: application/json" \
-d '{ "agent_id": "550e8400-e29b-41d4-a716-446655440000" }'
const number = encodeURIComponent('+972771234567');
const phone = await (await fetch(`https://api.voicy.co/functions/v1/phone-number-modify/${number}`, {
method: 'PATCH',
headers: {
'Authorization': 'Bearer voicy_sk_live_xxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({ agent_id: '550e8400-e29b-41d4-a716-446655440000' }),
})).json();
import requests
from urllib.parse import quote
phone = requests.patch(
f"https://api.voicy.co/functions/v1/phone-number-modify/{quote('+972771234567')}",
headers={'Authorization': 'Bearer voicy_sk_live_xxx'},
json={'agent_id': '550e8400-e29b-41d4-a716-446655440000'},
).json()
{
"phone_number": "+972771234567",
"type": "sip",
"agent_id": "550e8400-e29b-41d4-a716-446655440000",
"agent_name": "Appointment Booker",
"status": "active"
}
{
"status": "error",
"message": "Cannot assign phone number to an undeployed agent. Deploy the agent first."
}
{
"status": "error",
"message": "Phone number not found"
}
Phone Numbers
Assign Phone Number
Choose which agent answers a phone number
PATCH
/
v1
/
phone-number-modify
/
{phone_number}
curl -X PATCH https://api.voicy.co/functions/v1/phone-number-modify/%2B972771234567 \
-H "Authorization: Bearer voicy_sk_live_xxx" \
-H "Content-Type: application/json" \
-d '{ "agent_id": "550e8400-e29b-41d4-a716-446655440000" }'
const number = encodeURIComponent('+972771234567');
const phone = await (await fetch(`https://api.voicy.co/functions/v1/phone-number-modify/${number}`, {
method: 'PATCH',
headers: {
'Authorization': 'Bearer voicy_sk_live_xxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({ agent_id: '550e8400-e29b-41d4-a716-446655440000' }),
})).json();
import requests
from urllib.parse import quote
phone = requests.patch(
f"https://api.voicy.co/functions/v1/phone-number-modify/{quote('+972771234567')}",
headers={'Authorization': 'Bearer voicy_sk_live_xxx'},
json={'agent_id': '550e8400-e29b-41d4-a716-446655440000'},
).json()
{
"phone_number": "+972771234567",
"type": "sip",
"agent_id": "550e8400-e29b-41d4-a716-446655440000",
"agent_name": "Appointment Booker",
"status": "active"
}
{
"status": "error",
"message": "Cannot assign phone number to an undeployed agent. Deploy the agent first."
}
{
"status": "error",
"message": "Phone number not found"
}
Assigns one of your account’s phone numbers to an agent, or unassigns it. It works
for every number on the account, Twilio and SIP alike, and is the same change as
picking an agent for the number in the dashboard.
The number answers with the agent’s latest deployed version and follows the
agent’s later deployments automatically — agents created or updated through the API
are deployed immediately. The assigned agent answers the number’s inbound calls, and
is the agent Dial uses for calls from the number when the
request names no other.
Changing a number’s agent ends any A/B split configured on it. Buying, releasing
and moving numbers between accounts stay in the dashboard.
Path Parameters
string
required
The number in E.164, URL-encoded:
+972771234567 is sent as %2B972771234567.Body Parameters
string | null
required
The agent to answer this number, or
null to unassign it. The agent must be on your
account and deployed.Response
string
The number in E.164.
string
twilio or sip.string | null
The agent that answers the number, or
null.string | null
That agent’s name.
string
active when an agent answers the number, unassigned otherwise.curl -X PATCH https://api.voicy.co/functions/v1/phone-number-modify/%2B972771234567 \
-H "Authorization: Bearer voicy_sk_live_xxx" \
-H "Content-Type: application/json" \
-d '{ "agent_id": "550e8400-e29b-41d4-a716-446655440000" }'
const number = encodeURIComponent('+972771234567');
const phone = await (await fetch(`https://api.voicy.co/functions/v1/phone-number-modify/${number}`, {
method: 'PATCH',
headers: {
'Authorization': 'Bearer voicy_sk_live_xxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({ agent_id: '550e8400-e29b-41d4-a716-446655440000' }),
})).json();
import requests
from urllib.parse import quote
phone = requests.patch(
f"https://api.voicy.co/functions/v1/phone-number-modify/{quote('+972771234567')}",
headers={'Authorization': 'Bearer voicy_sk_live_xxx'},
json={'agent_id': '550e8400-e29b-41d4-a716-446655440000'},
).json()
{
"phone_number": "+972771234567",
"type": "sip",
"agent_id": "550e8400-e29b-41d4-a716-446655440000",
"agent_name": "Appointment Booker",
"status": "active"
}
{
"status": "error",
"message": "Cannot assign phone number to an undeployed agent. Deploy the agent first."
}
{
"status": "error",
"message": "Phone number not found"
}