curl --request PATCH \
--url https://api.lehar.ai/ca/api/v0/phone-numbers/{phone_number_id} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"inbound_enabled": true,
"inbound_agent_id": "agt_9f8e7d"
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/phone-numbers/{phone_number_id}"
payload = {
"inbound_enabled": True,
"inbound_agent_id": "agt_9f8e7d"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({inbound_enabled: true, inbound_agent_id: 'agt_9f8e7d'})
};
fetch('https://api.lehar.ai/ca/api/v0/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.lehar.ai/ca/api/v0/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([
'inbound_enabled' => true,
'inbound_agent_id' => 'agt_9f8e7d'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.lehar.ai/ca/api/v0/phone-numbers/{phone_number_id}"
payload := strings.NewReader("{\n \"inbound_enabled\": true,\n \"inbound_agent_id\": \"agt_9f8e7d\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.lehar.ai/ca/api/v0/phone-numbers/{phone_number_id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"inbound_enabled\": true,\n \"inbound_agent_id\": \"agt_9f8e7d\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/phone-numbers/{phone_number_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"inbound_enabled\": true,\n \"inbound_agent_id\": \"agt_9f8e7d\"\n}"
response = http.request(request)
puts response.read_body{
"id": "pn_a1b2c3d4",
"number": "+919876543210",
"display_name": "Sales line",
"source": "byo_trunk",
"sip_trunk_id": "trunk_x1y2z3",
"sip_trunk_name": "Acme SIP",
"status": "active",
"outbound_enabled": true,
"inbound_enabled": true,
"inbound_agent_id": "agt_9f8e7d",
"provider": "acme-telecom",
"metadata": {},
"created_at": "2026-09-01T12:00:00Z",
"updated_at": "2026-09-02T09:30:00Z"
}{
"error": {
"code": "invalid_request",
"message": "Nothing to update. Allowed fields: display_name, outbound_enabled, inbound_enabled, inbound_agent_id, metadata"
}
}{
"error": {
"code": "unauthorized",
"message": "Authentication required"
}
}{
"error": {
"code": "forbidden",
"message": "This role cannot manage phone numbers"
}
}{
"error": {
"code": "not_found",
"message": "Phone number not found"
}
}{
"error": {
"code": "conflict",
"message": "This number is archived and cannot be reconfigured. Add a new number instead."
}
}{
"error": {
"code": "service_unavailable",
"message": "Could not update inbound call routing with LiveKit"
}
}Update phone number
Update a phone number’s display name, direction flags, inbound agent, or metadata. Toggling inbound_enabled reconciles the per-number LiveKit inbound routing; for BYO-trunk numbers, supply the (never-stored) SIP auth_password to re-provision inbound. Rejected/archived numbers cannot have their direction/agent reconfigured. Requires the admin-tier phone_numbers:write scope (customer/platform admins, or an API key bearing the scope). Scope phone_numbers:write.
curl --request PATCH \
--url https://api.lehar.ai/ca/api/v0/phone-numbers/{phone_number_id} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"inbound_enabled": true,
"inbound_agent_id": "agt_9f8e7d"
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/phone-numbers/{phone_number_id}"
payload = {
"inbound_enabled": True,
"inbound_agent_id": "agt_9f8e7d"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({inbound_enabled: true, inbound_agent_id: 'agt_9f8e7d'})
};
fetch('https://api.lehar.ai/ca/api/v0/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.lehar.ai/ca/api/v0/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([
'inbound_enabled' => true,
'inbound_agent_id' => 'agt_9f8e7d'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.lehar.ai/ca/api/v0/phone-numbers/{phone_number_id}"
payload := strings.NewReader("{\n \"inbound_enabled\": true,\n \"inbound_agent_id\": \"agt_9f8e7d\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.lehar.ai/ca/api/v0/phone-numbers/{phone_number_id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"inbound_enabled\": true,\n \"inbound_agent_id\": \"agt_9f8e7d\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/phone-numbers/{phone_number_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"inbound_enabled\": true,\n \"inbound_agent_id\": \"agt_9f8e7d\"\n}"
response = http.request(request)
puts response.read_body{
"id": "pn_a1b2c3d4",
"number": "+919876543210",
"display_name": "Sales line",
"source": "byo_trunk",
"sip_trunk_id": "trunk_x1y2z3",
"sip_trunk_name": "Acme SIP",
"status": "active",
"outbound_enabled": true,
"inbound_enabled": true,
"inbound_agent_id": "agt_9f8e7d",
"provider": "acme-telecom",
"metadata": {},
"created_at": "2026-09-01T12:00:00Z",
"updated_at": "2026-09-02T09:30:00Z"
}{
"error": {
"code": "invalid_request",
"message": "Nothing to update. Allowed fields: display_name, outbound_enabled, inbound_enabled, inbound_agent_id, metadata"
}
}{
"error": {
"code": "unauthorized",
"message": "Authentication required"
}
}{
"error": {
"code": "forbidden",
"message": "This role cannot manage phone numbers"
}
}{
"error": {
"code": "not_found",
"message": "Phone number not found"
}
}{
"error": {
"code": "conflict",
"message": "This number is archived and cannot be reconfigured. Add a new number instead."
}
}{
"error": {
"code": "service_unavailable",
"message": "Could not update inbound call routing with LiveKit"
}
}Authorizations
Path Parameters
The phone number id.
Body
At least one recognized field is required.
Human label; empty/whitespace is stored as null.
Enable/disable outbound caller ID use.
Enable/disable inbound answering; reconciles LiveKit inbound routing.
Published agent to answer inbound calls; null to clear.
Replaces the stored metadata object.
For BYO-trunk numbers only: the SIP password, used solely to re-provision inbound. Write-only — never persisted or returned.
Response
Updated phone number.

