Skip to main content
PATCH
/
v1
/
phone-numbers
/
{phone_number_id}
Update the configuration of an existing phone number
curl --request PATCH \
  --url https://api.example.com/v1/phone-numbers/{phone_number_id} \
  --header 'Content-Type: application/json' \
  --data '
{
  "friendly_name": "<string>",
  "inbound_agent_id": "<string>",
  "outbound_agent_id": "<string>",
  "sip_termination_uri": "<string>",
  "sip_trunk_username": "<string>",
  "sip_trunk_password": "<string>"
}
'
import requests

url = "https://api.example.com/v1/phone-numbers/{phone_number_id}"

payload = {
"friendly_name": "<string>",
"inbound_agent_id": "<string>",
"outbound_agent_id": "<string>",
"sip_termination_uri": "<string>",
"sip_trunk_username": "<string>",
"sip_trunk_password": "<string>"
}
headers = {"Content-Type": "application/json"}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
friendly_name: '<string>',
inbound_agent_id: '<string>',
outbound_agent_id: '<string>',
sip_termination_uri: '<string>',
sip_trunk_username: '<string>',
sip_trunk_password: '<string>'
})
};

fetch('https://api.example.com/v1/phone-numbers/{phone_number_id}', 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.example.com/v1/phone-numbers/{phone_number_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'friendly_name' => '<string>',
'inbound_agent_id' => '<string>',
'outbound_agent_id' => '<string>',
'sip_termination_uri' => '<string>',
'sip_trunk_username' => '<string>',
'sip_trunk_password' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/v1/phone-numbers/{phone_number_id}"

payload := strings.NewReader("{\n \"friendly_name\": \"<string>\",\n \"inbound_agent_id\": \"<string>\",\n \"outbound_agent_id\": \"<string>\",\n \"sip_termination_uri\": \"<string>\",\n \"sip_trunk_username\": \"<string>\",\n \"sip_trunk_password\": \"<string>\"\n}")

req, _ := http.NewRequest("PATCH", url, payload)

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.patch("https://api.example.com/v1/phone-numbers/{phone_number_id}")
.header("Content-Type", "application/json")
.body("{\n \"friendly_name\": \"<string>\",\n \"inbound_agent_id\": \"<string>\",\n \"outbound_agent_id\": \"<string>\",\n \"sip_termination_uri\": \"<string>\",\n \"sip_trunk_username\": \"<string>\",\n \"sip_trunk_password\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/phone-numbers/{phone_number_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"friendly_name\": \"<string>\",\n \"inbound_agent_id\": \"<string>\",\n \"outbound_agent_id\": \"<string>\",\n \"sip_termination_uri\": \"<string>\",\n \"sip_trunk_username\": \"<string>\",\n \"sip_trunk_password\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "phone_number": "<string>",
  "_id": "<string>",
  "provider": "sip",
  "friendly_name": "<string>",
  "sip_termination_uri": "<string>",
  "sip_trunk_username": "<string>",
  "sip_trunk_password": "<string>",
  "inbound_agent_id": "<string>",
  "outbound_agent_id": "<string>",
  "sip_infra_region": "global"
}
{
"error": "<string>",
"message": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
{
"error": "<string>",
"message": "<string>"
}

Path Parameters

phone_number_id
string
required

Body

application/json
friendly_name
string | null

A human-readable label for this phone number to help identify its purpose

inbound_agent_id
string | null

ID of the AI agent that will handle incoming calls to this number

outbound_agent_id
string | null

ID of the AI agent that will be used when making outbound calls from this number

sip_termination_uri
string | null

The SIP URI where calls to this Import Phone Number should be terminated

sip_trunk_username
string | null

Username for authenticating with the SIP trunk provider

sip_trunk_password
string | null

Password for authenticating with the SIP trunk provider

Response

Successful Response

phone_number
string
required

The phone number in E.164 format, including country code (e.g., +14155552671)

_id
string

Unique identifier for this phone number record

provider
string
default:sip

Indicates this is an Import Phone Number (SIP provider)

Allowed value: "sip"
friendly_name
string | null

A human-readable label for this phone number

sip_termination_uri
string | null

The SIP URI where calls are terminated

sip_trunk_username
string | null

Username for SIP trunk authentication

sip_trunk_password
string | null

Password for SIP trunk authentication

inbound_agent_id
string | null

ID of the AI agent handling incoming calls

outbound_agent_id
string | null

ID of the AI agent used for outbound calls

sip_infra_region
enum<string>
default:global

The infrastructure region for SIP routing: 'global' or 'bd' (Bangladesh)

Available options:
global,
bd,
bd_link3