Update phone number assignment
curl --request PUT \
--url https://api.upon-ai.com/api/numbers/{number}/agent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountSid": "29e90072-fb58-4c6c-870a-43005115131e",
"workspaceId": 1,
"outboundAgentId": "agent_d3c2df14e163c7ca8ac5b1bf38",
"outboundAgentVersion": 0,
"inboundAgents": [
{
"agent_id": "agent_d3c2df14e163c7ca8ac5b1bf38",
"agent_version": 0,
"weight": 0.5
},
{
"agent_id": "agent_1f864a29b7c2ab407103c88335",
"agent_version": 0,
"weight": 0.5
}
],
"inboundWebhookUrl": "https://app.uponai.com/inbound-dynamic-vars/1/uponaiworkspace-913",
"isTimeRoutingEnabled": false
}
'import requests
url = "https://api.upon-ai.com/api/numbers/{number}/agent"
payload = {
"accountSid": "29e90072-fb58-4c6c-870a-43005115131e",
"workspaceId": 1,
"outboundAgentId": "agent_d3c2df14e163c7ca8ac5b1bf38",
"outboundAgentVersion": 0,
"inboundAgents": [
{
"agent_id": "agent_d3c2df14e163c7ca8ac5b1bf38",
"agent_version": 0,
"weight": 0.5
},
{
"agent_id": "agent_1f864a29b7c2ab407103c88335",
"agent_version": 0,
"weight": 0.5
}
],
"inboundWebhookUrl": "https://app.uponai.com/inbound-dynamic-vars/1/uponaiworkspace-913",
"isTimeRoutingEnabled": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountSid: '29e90072-fb58-4c6c-870a-43005115131e',
workspaceId: 1,
outboundAgentId: 'agent_d3c2df14e163c7ca8ac5b1bf38',
outboundAgentVersion: 0,
inboundAgents: [
{agent_id: 'agent_d3c2df14e163c7ca8ac5b1bf38', agent_version: 0, weight: 0.5},
{agent_id: 'agent_1f864a29b7c2ab407103c88335', agent_version: 0, weight: 0.5}
],
inboundWebhookUrl: 'https://app.uponai.com/inbound-dynamic-vars/1/uponaiworkspace-913',
isTimeRoutingEnabled: false
})
};
fetch('https://api.upon-ai.com/api/numbers/{number}/agent', 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.upon-ai.com/api/numbers/{number}/agent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'accountSid' => '29e90072-fb58-4c6c-870a-43005115131e',
'workspaceId' => 1,
'outboundAgentId' => 'agent_d3c2df14e163c7ca8ac5b1bf38',
'outboundAgentVersion' => 0,
'inboundAgents' => [
[
'agent_id' => 'agent_d3c2df14e163c7ca8ac5b1bf38',
'agent_version' => 0,
'weight' => 0.5
],
[
'agent_id' => 'agent_1f864a29b7c2ab407103c88335',
'agent_version' => 0,
'weight' => 0.5
]
],
'inboundWebhookUrl' => 'https://app.uponai.com/inbound-dynamic-vars/1/uponaiworkspace-913',
'isTimeRoutingEnabled' => false
]),
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.upon-ai.com/api/numbers/{number}/agent"
payload := strings.NewReader("{\n \"accountSid\": \"29e90072-fb58-4c6c-870a-43005115131e\",\n \"workspaceId\": 1,\n \"outboundAgentId\": \"agent_d3c2df14e163c7ca8ac5b1bf38\",\n \"outboundAgentVersion\": 0,\n \"inboundAgents\": [\n {\n \"agent_id\": \"agent_d3c2df14e163c7ca8ac5b1bf38\",\n \"agent_version\": 0,\n \"weight\": 0.5\n },\n {\n \"agent_id\": \"agent_1f864a29b7c2ab407103c88335\",\n \"agent_version\": 0,\n \"weight\": 0.5\n }\n ],\n \"inboundWebhookUrl\": \"https://app.uponai.com/inbound-dynamic-vars/1/uponaiworkspace-913\",\n \"isTimeRoutingEnabled\": false\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.upon-ai.com/api/numbers/{number}/agent")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"accountSid\": \"29e90072-fb58-4c6c-870a-43005115131e\",\n \"workspaceId\": 1,\n \"outboundAgentId\": \"agent_d3c2df14e163c7ca8ac5b1bf38\",\n \"outboundAgentVersion\": 0,\n \"inboundAgents\": [\n {\n \"agent_id\": \"agent_d3c2df14e163c7ca8ac5b1bf38\",\n \"agent_version\": 0,\n \"weight\": 0.5\n },\n {\n \"agent_id\": \"agent_1f864a29b7c2ab407103c88335\",\n \"agent_version\": 0,\n \"weight\": 0.5\n }\n ],\n \"inboundWebhookUrl\": \"https://app.uponai.com/inbound-dynamic-vars/1/uponaiworkspace-913\",\n \"isTimeRoutingEnabled\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upon-ai.com/api/numbers/{number}/agent")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountSid\": \"29e90072-fb58-4c6c-870a-43005115131e\",\n \"workspaceId\": 1,\n \"outboundAgentId\": \"agent_d3c2df14e163c7ca8ac5b1bf38\",\n \"outboundAgentVersion\": 0,\n \"inboundAgents\": [\n {\n \"agent_id\": \"agent_d3c2df14e163c7ca8ac5b1bf38\",\n \"agent_version\": 0,\n \"weight\": 0.5\n },\n {\n \"agent_id\": \"agent_1f864a29b7c2ab407103c88335\",\n \"agent_version\": 0,\n \"weight\": 0.5\n }\n ],\n \"inboundWebhookUrl\": \"https://app.uponai.com/inbound-dynamic-vars/1/uponaiworkspace-913\",\n \"isTimeRoutingEnabled\": false\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"numbers": [
{
"id": 123,
"number": "<string>",
"base_number": "<string>",
"account_sid": "<string>",
"workspace_id": 123,
"agent_id": "<string>",
"default_agent_id": "<string>",
"inbound_agent_id": "<string>",
"inbound_agents": [
{
"agent_id": "<string>",
"agent_version": 123,
"weight": 123
}
],
"outbound_agents": [
{
"agent_id": "<string>",
"agent_version": 123,
"weight": 123
}
],
"inbound_agent_version": 123,
"outbound_agent_version": 123,
"application_sid": "<string>",
"phone_number_sid": "<string>",
"inbound_webhook_url": "<string>",
"is_time_routing_enabled": true,
"platform_import_error": true,
"platform_import_error_message": "<string>"
}
],
"assignment": {
"account_sid": "<string>",
"workspace_id": 123,
"agent_id": "<string>",
"inbound_agent_id": "<string>",
"outbound_agents": [
{
"agent_id": "<string>",
"agent_version": 123,
"weight": 123
}
],
"inbound_agents": [
{
"agent_id": "<string>",
"agent_version": 123,
"weight": 123
}
],
"is_time_routing_enabled": true,
"platform_import_error": true,
"platform_import_error_message": "<string>"
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Phone Numbers
Update phone number assignment
Assign, update, or remove outbound and inbound phone number bindings. Supports weighted agent arrays for inbound and outbound assignment, optional agent versions, and inbound A/B testing.
PUT
/
api
/
numbers
/
{number}
/
agent
Update phone number assignment
curl --request PUT \
--url https://api.upon-ai.com/api/numbers/{number}/agent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountSid": "29e90072-fb58-4c6c-870a-43005115131e",
"workspaceId": 1,
"outboundAgentId": "agent_d3c2df14e163c7ca8ac5b1bf38",
"outboundAgentVersion": 0,
"inboundAgents": [
{
"agent_id": "agent_d3c2df14e163c7ca8ac5b1bf38",
"agent_version": 0,
"weight": 0.5
},
{
"agent_id": "agent_1f864a29b7c2ab407103c88335",
"agent_version": 0,
"weight": 0.5
}
],
"inboundWebhookUrl": "https://app.uponai.com/inbound-dynamic-vars/1/uponaiworkspace-913",
"isTimeRoutingEnabled": false
}
'import requests
url = "https://api.upon-ai.com/api/numbers/{number}/agent"
payload = {
"accountSid": "29e90072-fb58-4c6c-870a-43005115131e",
"workspaceId": 1,
"outboundAgentId": "agent_d3c2df14e163c7ca8ac5b1bf38",
"outboundAgentVersion": 0,
"inboundAgents": [
{
"agent_id": "agent_d3c2df14e163c7ca8ac5b1bf38",
"agent_version": 0,
"weight": 0.5
},
{
"agent_id": "agent_1f864a29b7c2ab407103c88335",
"agent_version": 0,
"weight": 0.5
}
],
"inboundWebhookUrl": "https://app.uponai.com/inbound-dynamic-vars/1/uponaiworkspace-913",
"isTimeRoutingEnabled": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountSid: '29e90072-fb58-4c6c-870a-43005115131e',
workspaceId: 1,
outboundAgentId: 'agent_d3c2df14e163c7ca8ac5b1bf38',
outboundAgentVersion: 0,
inboundAgents: [
{agent_id: 'agent_d3c2df14e163c7ca8ac5b1bf38', agent_version: 0, weight: 0.5},
{agent_id: 'agent_1f864a29b7c2ab407103c88335', agent_version: 0, weight: 0.5}
],
inboundWebhookUrl: 'https://app.uponai.com/inbound-dynamic-vars/1/uponaiworkspace-913',
isTimeRoutingEnabled: false
})
};
fetch('https://api.upon-ai.com/api/numbers/{number}/agent', 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.upon-ai.com/api/numbers/{number}/agent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'accountSid' => '29e90072-fb58-4c6c-870a-43005115131e',
'workspaceId' => 1,
'outboundAgentId' => 'agent_d3c2df14e163c7ca8ac5b1bf38',
'outboundAgentVersion' => 0,
'inboundAgents' => [
[
'agent_id' => 'agent_d3c2df14e163c7ca8ac5b1bf38',
'agent_version' => 0,
'weight' => 0.5
],
[
'agent_id' => 'agent_1f864a29b7c2ab407103c88335',
'agent_version' => 0,
'weight' => 0.5
]
],
'inboundWebhookUrl' => 'https://app.uponai.com/inbound-dynamic-vars/1/uponaiworkspace-913',
'isTimeRoutingEnabled' => false
]),
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.upon-ai.com/api/numbers/{number}/agent"
payload := strings.NewReader("{\n \"accountSid\": \"29e90072-fb58-4c6c-870a-43005115131e\",\n \"workspaceId\": 1,\n \"outboundAgentId\": \"agent_d3c2df14e163c7ca8ac5b1bf38\",\n \"outboundAgentVersion\": 0,\n \"inboundAgents\": [\n {\n \"agent_id\": \"agent_d3c2df14e163c7ca8ac5b1bf38\",\n \"agent_version\": 0,\n \"weight\": 0.5\n },\n {\n \"agent_id\": \"agent_1f864a29b7c2ab407103c88335\",\n \"agent_version\": 0,\n \"weight\": 0.5\n }\n ],\n \"inboundWebhookUrl\": \"https://app.uponai.com/inbound-dynamic-vars/1/uponaiworkspace-913\",\n \"isTimeRoutingEnabled\": false\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.upon-ai.com/api/numbers/{number}/agent")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"accountSid\": \"29e90072-fb58-4c6c-870a-43005115131e\",\n \"workspaceId\": 1,\n \"outboundAgentId\": \"agent_d3c2df14e163c7ca8ac5b1bf38\",\n \"outboundAgentVersion\": 0,\n \"inboundAgents\": [\n {\n \"agent_id\": \"agent_d3c2df14e163c7ca8ac5b1bf38\",\n \"agent_version\": 0,\n \"weight\": 0.5\n },\n {\n \"agent_id\": \"agent_1f864a29b7c2ab407103c88335\",\n \"agent_version\": 0,\n \"weight\": 0.5\n }\n ],\n \"inboundWebhookUrl\": \"https://app.uponai.com/inbound-dynamic-vars/1/uponaiworkspace-913\",\n \"isTimeRoutingEnabled\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upon-ai.com/api/numbers/{number}/agent")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountSid\": \"29e90072-fb58-4c6c-870a-43005115131e\",\n \"workspaceId\": 1,\n \"outboundAgentId\": \"agent_d3c2df14e163c7ca8ac5b1bf38\",\n \"outboundAgentVersion\": 0,\n \"inboundAgents\": [\n {\n \"agent_id\": \"agent_d3c2df14e163c7ca8ac5b1bf38\",\n \"agent_version\": 0,\n \"weight\": 0.5\n },\n {\n \"agent_id\": \"agent_1f864a29b7c2ab407103c88335\",\n \"agent_version\": 0,\n \"weight\": 0.5\n }\n ],\n \"inboundWebhookUrl\": \"https://app.uponai.com/inbound-dynamic-vars/1/uponaiworkspace-913\",\n \"isTimeRoutingEnabled\": false\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"numbers": [
{
"id": 123,
"number": "<string>",
"base_number": "<string>",
"account_sid": "<string>",
"workspace_id": 123,
"agent_id": "<string>",
"default_agent_id": "<string>",
"inbound_agent_id": "<string>",
"inbound_agents": [
{
"agent_id": "<string>",
"agent_version": 123,
"weight": 123
}
],
"outbound_agents": [
{
"agent_id": "<string>",
"agent_version": 123,
"weight": 123
}
],
"inbound_agent_version": 123,
"outbound_agent_version": 123,
"application_sid": "<string>",
"phone_number_sid": "<string>",
"inbound_webhook_url": "<string>",
"is_time_routing_enabled": true,
"platform_import_error": true,
"platform_import_error_message": "<string>"
}
],
"assignment": {
"account_sid": "<string>",
"workspace_id": 123,
"agent_id": "<string>",
"inbound_agent_id": "<string>",
"outbound_agents": [
{
"agent_id": "<string>",
"agent_version": 123,
"weight": 123
}
],
"inbound_agents": [
{
"agent_id": "<string>",
"agent_version": 123,
"weight": 123
}
],
"is_time_routing_enabled": true,
"platform_import_error": true,
"platform_import_error_message": "<string>"
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Generate tokens from your profile settings at app.uponai.com.
Path Parameters
Phone number or extension identifier to update.
Body
application/json
⌘I