cURL
curl --request PATCH \
--url https://my.cald.ai/client/api/v1/phonenumbers/{phoneNumberId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"agentId": "<string>"
}
'import requests
url = "https://my.cald.ai/client/api/v1/phonenumbers/{phoneNumberId}"
payload = { "agentId": "<string>" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({agentId: '<string>'})
};
fetch('https://my.cald.ai/client/api/v1/phonenumbers/{phoneNumberId}', 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://my.cald.ai/client/api/v1/phonenumbers/{phoneNumberId}",
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([
'agentId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://my.cald.ai/client/api/v1/phonenumbers/{phoneNumberId}"
payload := strings.NewReader("{\n \"agentId\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<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://my.cald.ai/client/api/v1/phonenumbers/{phoneNumberId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agentId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://my.cald.ai/client/api/v1/phonenumbers/{phoneNumberId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agentId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"phoneNumberId": "<string>",
"phoneNumber": "<string>",
"price": 123,
"agentId": "<string>"
}Phone Number Management (U.S. Only)
Edit Phone Number Settings
Update the details of a specific phone number
PATCH
/
phonenumbers
/
{phoneNumberId}
cURL
curl --request PATCH \
--url https://my.cald.ai/client/api/v1/phonenumbers/{phoneNumberId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"agentId": "<string>"
}
'import requests
url = "https://my.cald.ai/client/api/v1/phonenumbers/{phoneNumberId}"
payload = { "agentId": "<string>" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({agentId: '<string>'})
};
fetch('https://my.cald.ai/client/api/v1/phonenumbers/{phoneNumberId}', 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://my.cald.ai/client/api/v1/phonenumbers/{phoneNumberId}",
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([
'agentId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://my.cald.ai/client/api/v1/phonenumbers/{phoneNumberId}"
payload := strings.NewReader("{\n \"agentId\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<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://my.cald.ai/client/api/v1/phonenumbers/{phoneNumberId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agentId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://my.cald.ai/client/api/v1/phonenumbers/{phoneNumberId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agentId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"phoneNumberId": "<string>",
"phoneNumber": "<string>",
"price": 123,
"agentId": "<string>"
}Authorizations
Body
application/json
The agent ID of the agent to use when an inbound call is received on the phone number. If not specified, the agent will be removed from the phone number and no agent will be used when an inbound call is received - this is useful if you want to use the phone number for outbound calls only and don't want to receive/incur charges for inbound calls
Response
Success response with phone number details