Update an agent
Rename an agent.
Answers with the updated agent. The web app shows the new name at once; agent lists show it within seconds. In the web app, the caller shows as who last changed the agent.
curl --request PATCH \
--url https://api.us.phonely.ai/v1/agents/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>"
}
'import requests
url = "https://api.us.phonely.ai/v1/agents/{id}"
payload = { "name": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>'})
};
fetch('https://api.us.phonely.ai/v1/agents/{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.us.phonely.ai/v1/agents/{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([
'name' => '<string>'
]),
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.us.phonely.ai/v1/agents/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.us.phonely.ai/v1/agents/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.us.phonely.ai/v1/agents/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"object": "agent",
"phone_number": "<string>"
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}Authorizations
An org API key: Authorization: Bearer phk_…
Headers
The ETag from your last read: the change is made only if the resource still has it, otherwise 412. Optional, except that a change replacing a list needs it (428 without it).
Optional. Must be the key's org.
Path Parameters
The agent's ID.
Body
The agent's new name.
The name shown in the web app: 1 to 50 characters, without spaces at either end, which are dropped. It needn't be unique.
1 - 50Response
Successful Response
An agent: a voice agent that answers and places the organization's calls.
The agent's ID.
The name shown in the web app. null when the agent has none.
The type of this object, always agent.
"agent"The agent's primary phone number in E.164, such as +14155550100. null when it has none, or when its primary line is a SIP address.
curl --request PATCH \
--url https://api.us.phonely.ai/v1/agents/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>"
}
'import requests
url = "https://api.us.phonely.ai/v1/agents/{id}"
payload = { "name": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>'})
};
fetch('https://api.us.phonely.ai/v1/agents/{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.us.phonely.ai/v1/agents/{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([
'name' => '<string>'
]),
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.us.phonely.ai/v1/agents/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.us.phonely.ai/v1/agents/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.us.phonely.ai/v1/agents/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"object": "agent",
"phone_number": "<string>"
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"message": "<string>"
}
],
"message": "<string>",
"request_id": "<string>"
}
}
