Get the draft of an AI phone agent
curl --request GET \
--url http://localhost:8080/phone/{phone_agent_id}/draft \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:8080/phone/{phone_agent_id}/draft"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:8080/phone/{phone_agent_id}/draft', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/phone/{phone_agent_id}/draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8080/phone/{phone_agent_id}/draft"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:8080/phone/{phone_agent_id}/draft")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/phone/{phone_agent_id}/draft")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"agent_id": "<string>",
"published": true,
"revision": 0,
"has_unpublished_changes": true,
"live_version": 0,
"config": {
"name": "<string>",
"type": "inbound",
"instructions": [
"<string>"
],
"first_message": "<string>",
"language": [
"<string>"
],
"accent": "<string>",
"handoff_phone_number": "<string>",
"speed": 499.995,
"interruptible": true,
"flow": null,
"data_collection_fields": [
"<string>"
],
"data_collection_webhook_url": "<string>",
"use_org_knowledgebase": true,
"voice_mode": "modular",
"voice_id": "<string>",
"tts_provider": "elevenlabs",
"tts_speed_pct": 50,
"background_noise_preset": "office",
"background_volume_pct": 100,
"typing_sound_enabled": true,
"recording_enabled": true,
"stt_keyterms": [
"<string>"
],
"stt_model": "deepgram/flux-general",
"failover_transfer_destination_id": "<string>",
"outbound_trunk_id": "<string>",
"outbound_caller_number": "<string>",
"outbound_number_pool_id": "<string>",
"outbound_pool_max_attempts": 2,
"outbound_pool_retry_delay_minutes": 720,
"action_ids": [
"<string>"
],
"workflow_ids": [
"<string>"
],
"transfer_destination_ids": [
"<string>"
],
"instruction_ids": [
"<string>"
],
"instruction_directory_ids": [
"<string>"
],
"knowledge_item_ids": [
"<string>"
],
"knowledge_folder_keys": [
"<string>"
],
"inbound_number_ids": [
"<string>"
]
},
"field_changes": {}
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}AI Phone Agents
Get the draft of an AI phone agent
Read the settings an agent will use after its next publish, whether they differ from what is live, and the revision to publish them with.
GET
/
phone
/
{phone_agent_id}
/
draft
Get the draft of an AI phone agent
curl --request GET \
--url http://localhost:8080/phone/{phone_agent_id}/draft \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:8080/phone/{phone_agent_id}/draft"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:8080/phone/{phone_agent_id}/draft', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/phone/{phone_agent_id}/draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8080/phone/{phone_agent_id}/draft"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:8080/phone/{phone_agent_id}/draft")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/phone/{phone_agent_id}/draft")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"agent_id": "<string>",
"published": true,
"revision": 0,
"has_unpublished_changes": true,
"live_version": 0,
"config": {
"name": "<string>",
"type": "inbound",
"instructions": [
"<string>"
],
"first_message": "<string>",
"language": [
"<string>"
],
"accent": "<string>",
"handoff_phone_number": "<string>",
"speed": 499.995,
"interruptible": true,
"flow": null,
"data_collection_fields": [
"<string>"
],
"data_collection_webhook_url": "<string>",
"use_org_knowledgebase": true,
"voice_mode": "modular",
"voice_id": "<string>",
"tts_provider": "elevenlabs",
"tts_speed_pct": 50,
"background_noise_preset": "office",
"background_volume_pct": 100,
"typing_sound_enabled": true,
"recording_enabled": true,
"stt_keyterms": [
"<string>"
],
"stt_model": "deepgram/flux-general",
"failover_transfer_destination_id": "<string>",
"outbound_trunk_id": "<string>",
"outbound_caller_number": "<string>",
"outbound_number_pool_id": "<string>",
"outbound_pool_max_attempts": 2,
"outbound_pool_retry_delay_minutes": 720,
"action_ids": [
"<string>"
],
"workflow_ids": [
"<string>"
],
"transfer_destination_ids": [
"<string>"
],
"instruction_ids": [
"<string>"
],
"instruction_directory_ids": [
"<string>"
],
"knowledge_item_ids": [
"<string>"
],
"knowledge_folder_keys": [
"<string>"
],
"inbound_number_ids": [
"<string>"
]
},
"field_changes": {}
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Requires the
phone:read scope.
Every change you make to an agent through the API (PATCH /phone/{phone_agent_id} and the knowledge sources, workflows and caller number endpoints) is saved to its draft. Calls keep using the live settings until you publish. Agents on the older runtimes have no draft: their changes still apply immediately, and the draft endpoints answer 400 for them. The SIP endpoints (inbound numbers, outbound trunk, transfer destinations) change the live agent immediately, and the same change is copied into its draft.
publishedisfalsefor an agent that was never published. It takes no calls yet.has_unpublished_changestells you whether the draft differs from what is live.field_changesrecords, for each setting edited in the draft, who changed it and when.revisionchanges with every edit. Pass it to the publish endpoint so that only the draft you reviewed goes live.
GET /phone/{phone_agent_id} returns the published settings, or, for an agent that was never published, its draft with published: false. This endpoint shows the pending changes of a published agent.Authorizations
Response
Default Response
Was this page helpful?