Turn on deployments for an agent
curl --request POST \
--url https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/versioning:enable \
--header 'Authorization: <api-key>'import requests
url = "https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/versioning:enable"
headers = {"Authorization": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
fetch('https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/versioning:enable', 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.tryhamsa.com/v2/voice-agents/{voiceAgentId}/versioning:enable",
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: <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"
"net/http"
"io"
)
func main() {
url := "https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/versioning:enable"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/versioning:enable")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/versioning:enable")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "success",
"data": {
"versioning": {
"enabled": true,
"enabledAt": "2026-10-28T09:15:00.000Z",
"enabledBy": {
"id": "b7d9e979-4a16-437b-8571-4ed92a94faa8",
"name": "Sara Ahmad"
}
},
"environments": [
{
"id": "6d2e8f14-3a7b-4c9d-b1e5-0f8a2c4d6e71",
"name": "prod",
"isDefault": true,
"isLocked": true,
"revision": "1c5a7e93-4d2f-4b6a-9e8c-3f1d5b7a9c02",
"variables": [
{
"key": "SUPPORT_PHONE",
"value": "+966500000000"
}
],
"savedBy": {
"id": "b7d9e979-4a16-437b-8571-4ed92a94faa8",
"name": "Sara Ahmad"
},
"updatedAt": "2026-10-28T09:15:00.000Z",
"publishedVersionId": "3b9e2c71-8f4d-4a6b-9c1e-2d7f5a8b0c34",
"deployedBy": {
"id": "b7d9e979-4a16-437b-8571-4ed92a94faa8",
"name": "Sara Ahmad"
},
"deployedAt": "2026-10-28T09:15:00.000Z"
}
]
}
}{
"code": 8409,
"message": "Your draft changed in another tab or through your API key. Reload it and try again.",
"messageKey": "DraftStaleRevision",
"params": {
"reason": "STALE_REVISION",
"revision": "e2f7a9c3-6b1d-4e5f-a8c2-7d3b9f0e1a56"
}
}{
"code": 8409,
"message": "Your draft changed in another tab or through your API key. Reload it and try again.",
"messageKey": "DraftStaleRevision",
"params": {
"reason": "STALE_REVISION",
"revision": "e2f7a9c3-6b1d-4e5f-a8c2-7d3b9f0e1a56"
}
}{
"code": 8409,
"message": "Your draft changed in another tab or through your API key. Reload it and try again.",
"messageKey": "DraftStaleRevision",
"params": {
"reason": "STALE_REVISION",
"revision": "e2f7a9c3-6b1d-4e5f-a8c2-7d3b9f0e1a56"
}
}{
"code": 8409,
"message": "Your draft changed in another tab or through your API key. Reload it and try again.",
"messageKey": "DraftStaleRevision",
"params": {
"reason": "STALE_REVISION",
"revision": "e2f7a9c3-6b1d-4e5f-a8c2-7d3b9f0e1a56"
}
}{
"code": 8409,
"message": "Your draft changed in another tab or through your API key. Reload it and try again.",
"messageKey": "DraftStaleRevision",
"params": {
"reason": "STALE_REVISION",
"revision": "e2f7a9c3-6b1d-4e5f-a8c2-7d3b9f0e1a56"
}
}Agent Versions & Drafts
Turn On Agent Deployments
Turns on deployments for the agent: the dashboard’s Deployments mode. In the API this setting is called versioning (as in this path, versioning.enabled and the VERSIONING_ON/VERSIONING_OFF reasons); an agent without it is in the dashboard’s Versioning mode. This is one way: it can’t be turned off. Calling it again changes nothing and returns the current state. Nothing callers hear changes: prod keeps running what it runs now, and dev and staging start on that same version with a copy of prod’s values. From then on, versions are published to dev and promoted to staging and prod (see the environment endpoints), and you can run A/B tests on prod with Set Agent Deployment.
POST
/
v2
/
voice-agents
/
{voiceAgentId}
/
versioning:enable
Turn on deployments for an agent
curl --request POST \
--url https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/versioning:enable \
--header 'Authorization: <api-key>'import requests
url = "https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/versioning:enable"
headers = {"Authorization": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
fetch('https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/versioning:enable', 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.tryhamsa.com/v2/voice-agents/{voiceAgentId}/versioning:enable",
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: <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"
"net/http"
"io"
)
func main() {
url := "https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/versioning:enable"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/versioning:enable")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/versioning:enable")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "success",
"data": {
"versioning": {
"enabled": true,
"enabledAt": "2026-10-28T09:15:00.000Z",
"enabledBy": {
"id": "b7d9e979-4a16-437b-8571-4ed92a94faa8",
"name": "Sara Ahmad"
}
},
"environments": [
{
"id": "6d2e8f14-3a7b-4c9d-b1e5-0f8a2c4d6e71",
"name": "prod",
"isDefault": true,
"isLocked": true,
"revision": "1c5a7e93-4d2f-4b6a-9e8c-3f1d5b7a9c02",
"variables": [
{
"key": "SUPPORT_PHONE",
"value": "+966500000000"
}
],
"savedBy": {
"id": "b7d9e979-4a16-437b-8571-4ed92a94faa8",
"name": "Sara Ahmad"
},
"updatedAt": "2026-10-28T09:15:00.000Z",
"publishedVersionId": "3b9e2c71-8f4d-4a6b-9c1e-2d7f5a8b0c34",
"deployedBy": {
"id": "b7d9e979-4a16-437b-8571-4ed92a94faa8",
"name": "Sara Ahmad"
},
"deployedAt": "2026-10-28T09:15:00.000Z"
}
]
}
}{
"code": 8409,
"message": "Your draft changed in another tab or through your API key. Reload it and try again.",
"messageKey": "DraftStaleRevision",
"params": {
"reason": "STALE_REVISION",
"revision": "e2f7a9c3-6b1d-4e5f-a8c2-7d3b9f0e1a56"
}
}{
"code": 8409,
"message": "Your draft changed in another tab or through your API key. Reload it and try again.",
"messageKey": "DraftStaleRevision",
"params": {
"reason": "STALE_REVISION",
"revision": "e2f7a9c3-6b1d-4e5f-a8c2-7d3b9f0e1a56"
}
}{
"code": 8409,
"message": "Your draft changed in another tab or through your API key. Reload it and try again.",
"messageKey": "DraftStaleRevision",
"params": {
"reason": "STALE_REVISION",
"revision": "e2f7a9c3-6b1d-4e5f-a8c2-7d3b9f0e1a56"
}
}{
"code": 8409,
"message": "Your draft changed in another tab or through your API key. Reload it and try again.",
"messageKey": "DraftStaleRevision",
"params": {
"reason": "STALE_REVISION",
"revision": "e2f7a9c3-6b1d-4e5f-a8c2-7d3b9f0e1a56"
}
}{
"code": 8409,
"message": "Your draft changed in another tab or through your API key. Reload it and try again.",
"messageKey": "DraftStaleRevision",
"params": {
"reason": "STALE_REVISION",
"revision": "e2f7a9c3-6b1d-4e5f-a8c2-7d3b9f0e1a56"
}
}Authorizations
Path Parameters
Was this page helpful?