Publish an earlier version of an AI phone agent
curl --request POST \
--url http://localhost:8080/phone/{phone_agent_id}/versions/{version}/publish \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:8080/phone/{phone_agent_id}/versions/{version}/publish"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:8080/phone/{phone_agent_id}/versions/{version}/publish', 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}/versions/{version}/publish",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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}/versions/{version}/publish"
req, _ := http.NewRequest("POST", 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.post("http://localhost:8080/phone/{phone_agent_id}/versions/{version}/publish")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/phone/{phone_agent_id}/versions/{version}/publish")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"agent_id": "<string>",
"version": 0,
"revision": 0
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}AI Phone Agents
Publish an earlier version of an AI phone agent
Put an earlier published version of an AI phone agent live again, unchanged. It is recorded as a new version and the draft is reset to it.
POST
/
phone
/
{phone_agent_id}
/
versions
/
{version}
/
publish
Publish an earlier version of an AI phone agent
curl --request POST \
--url http://localhost:8080/phone/{phone_agent_id}/versions/{version}/publish \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:8080/phone/{phone_agent_id}/versions/{version}/publish"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:8080/phone/{phone_agent_id}/versions/{version}/publish', 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}/versions/{version}/publish",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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}/versions/{version}/publish"
req, _ := http.NewRequest("POST", 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.post("http://localhost:8080/phone/{phone_agent_id}/versions/{version}/publish")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/phone/{phone_agent_id}/versions/{version}/publish")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"agent_id": "<string>",
"version": 0,
"revision": 0
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Requires the
Calls already in progress finish with the settings they started with. Agents on an older voice runtime have no drafts or versions, so the request returns
phone:write scope.
Every publish is numbered as a version: the number is in each publish response and in the agent’s version history in the dashboard. Send the number of an earlier one in the path to make its settings live again, exactly as they were. Calls that start afterwards use it, and it is recorded as a new version, so the agent’s history keeps every step.
The draft is reset to that version, as after any publish: its unpublished changes are discarded and its revision moves, so a publish based on the draft as it was before is refused. Read the draft first if it has changes you want to keep. Instructions, knowledge, actions or other items deleted since that version was published are left out, not refused.
Refusals carry a code beside the message, so your code can branch on the reason:
| Status | code | Meaning |
|---|---|---|
201 | The version is live. The response returns the new version and the reset draft’s revision. | |
400 | nothing_to_publish | That version is what calls already use. |
400 | draft_invalid | A setting in that version is no longer valid (for example an inactive workflow). |
409 | number_held | A phone number in that version was given to another agent, IVR or interpreter since. The message names it; free the number first. |
403 | That version differs from what is live in settings only the OpenCX team can change. Ask the OpenCX team to publish it. | |
404 | The agent or the version does not exist in your organization. |
400 for them.Authorizations
Path Parameters
Was this page helpful?