Clone a voice agent
curl --request POST \
--url https://api.tryhamsa.com/v1/voice-agents/clone \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"agentName": "<string>"
}
'import requests
url = "https://api.tryhamsa.com/v1/voice-agents/clone"
payload = { "agentName": "<string>" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({agentName: '<string>'})
};
fetch('https://api.tryhamsa.com/v1/voice-agents/clone', 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/v1/voice-agents/clone",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agentName' => '<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://api.tryhamsa.com/v1/voice-agents/clone"
payload := strings.NewReader("{\n \"agentName\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.tryhamsa.com/v1/voice-agents/clone")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agentName\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/voice-agents/clone")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agentName\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": false,
"message": "success",
"data": {
"id": "<string>",
"agentName": "<string>",
"greetingMessage": "<string>",
"description": "<string>",
"preamble": "<string>",
"lang": "<string>",
"pokeMessages": [
"<string>"
],
"realTime": true,
"silenceThreshold": 123,
"interrupt": true,
"type": "<string>",
"outcome": "<string>",
"outcomeResponseShape": {
"type": "object",
"properties": {
"test": {
"type": "number",
"description": "Hello world from Hamsa AI!"
}
},
"required": [
"test"
]
},
"projectId": "<string>",
"apiKeyId": "<string>",
"voiceId": "<string>",
"voiceRecordId": "<string>",
"voiceRecord": {},
"collectionId": "<string>",
"isTemplate": true,
"icon": "<string>",
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"authKey": "Token",
"authSecret": "Secret"
},
"params": {},
"alignment": {
"greetingMessage": "<string>",
"preamble": "<string>"
},
"tools": {
"genderDetection": true,
"smartCallEnd": true
},
"webToolsIds": [
"<string>"
],
"voiceDictionaryIds": [
"<string>"
],
"knowledgeBaseItemsIds": [
"<string>"
],
"webToolsOverrides": {},
"userInactivityTimeout": 123,
"maxCallDuration": 123,
"responseDelay": 123,
"backgroundNoise": true,
"waitForUserToSpeakFirst": 123,
"thinkingVoice": true,
"speakerIdentification": true,
"llmConfig": {
"provider": "OpenAI",
"modelName": "GPT-4.1",
"baseUrl": "https://api.custom-llm.com/v1",
"apiKey": "sk-...",
"temperature": 0.2
},
"noiseCancellation": "<string>",
"cancelNoisePer": "<string>",
"agenticRag": true,
"languageDialectSwitcher": true,
"minInterruptionDuration": 123,
"vadActivationThreshold": 123,
"enableAutoGainControl": true,
"sendDenoisedToStt": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Voice Agents Routes
Clone Voice Agent Route
Use this route to clone an existing agent. You can use it to clone one of the voice agents templates created by our experts!
POST
/
v1
/
voice-agents
/
clone
Clone a voice agent
curl --request POST \
--url https://api.tryhamsa.com/v1/voice-agents/clone \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"agentName": "<string>"
}
'import requests
url = "https://api.tryhamsa.com/v1/voice-agents/clone"
payload = { "agentName": "<string>" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({agentName: '<string>'})
};
fetch('https://api.tryhamsa.com/v1/voice-agents/clone', 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/v1/voice-agents/clone",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agentName' => '<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://api.tryhamsa.com/v1/voice-agents/clone"
payload := strings.NewReader("{\n \"agentName\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.tryhamsa.com/v1/voice-agents/clone")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agentName\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/voice-agents/clone")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agentName\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": false,
"message": "success",
"data": {
"id": "<string>",
"agentName": "<string>",
"greetingMessage": "<string>",
"description": "<string>",
"preamble": "<string>",
"lang": "<string>",
"pokeMessages": [
"<string>"
],
"realTime": true,
"silenceThreshold": 123,
"interrupt": true,
"type": "<string>",
"outcome": "<string>",
"outcomeResponseShape": {
"type": "object",
"properties": {
"test": {
"type": "number",
"description": "Hello world from Hamsa AI!"
}
},
"required": [
"test"
]
},
"projectId": "<string>",
"apiKeyId": "<string>",
"voiceId": "<string>",
"voiceRecordId": "<string>",
"voiceRecord": {},
"collectionId": "<string>",
"isTemplate": true,
"icon": "<string>",
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"authKey": "Token",
"authSecret": "Secret"
},
"params": {},
"alignment": {
"greetingMessage": "<string>",
"preamble": "<string>"
},
"tools": {
"genderDetection": true,
"smartCallEnd": true
},
"webToolsIds": [
"<string>"
],
"voiceDictionaryIds": [
"<string>"
],
"knowledgeBaseItemsIds": [
"<string>"
],
"webToolsOverrides": {},
"userInactivityTimeout": 123,
"maxCallDuration": 123,
"responseDelay": 123,
"backgroundNoise": true,
"waitForUserToSpeakFirst": 123,
"thinkingVoice": true,
"speakerIdentification": true,
"llmConfig": {
"provider": "OpenAI",
"modelName": "GPT-4.1",
"baseUrl": "https://api.custom-llm.com/v1",
"apiKey": "sk-...",
"temperature": 0.2
},
"noiseCancellation": "<string>",
"cancelNoisePer": "<string>",
"agenticRag": true,
"languageDialectSwitcher": true,
"minInterruptionDuration": 123,
"vadActivationThreshold": 123,
"enableAutoGainControl": true,
"sendDenoisedToStt": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Authorizations
Pass the API key in the Authorization header, You need to put Token keyword before the API key. e.g. 'Authorization: Token '
Query Parameters
Body
application/json
Was this page helpful?
⌘I