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>",
"copy": "agent"
}
'import requests
url = "https://api.tryhamsa.com/v1/voice-agents/clone"
payload = {
"agentName": "<string>",
"copy": "agent"
}
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>', copy: 'agent'})
};
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>',
'copy' => 'agent'
]),
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 \"copy\": \"agent\"\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 \"copy\": \"agent\"\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 \"copy\": \"agent\"\n}"
response = http.request(request)
puts response.read_body{
"success": false,
"message": "success",
"data": {
"id": "1f6d7b90-9d4e-475e-b065-87ef52866527",
"agentName": "My Assistant 04-9 - Copy",
"greetingMessage": "Hello, how can I help you today?",
"greetingMessageType": "STATIC",
"preamble": "You are a helpful assistant that will answer users questions.",
"lang": "ar",
"type": "Single Prompt",
"pokeMessages": [
"Are you still there?",
"Take your time, I'm here when you're ready."
],
"realTime": false,
"silenceThreshold": 800,
"interrupt": true,
"outcome": null,
"projectId": "b23e5e46-3ee1-496d-82b3-d58bf0b000e7",
"createdAt": "2024-11-19T08:49:35.390Z",
"updatedAt": "2024-11-19T00:00:00.000Z",
"voiceRecordId": "39348c01-f7fd-46ec-b314-c84c9534055f",
"deletedAt": null,
"deletedBy": null,
"isTemplate": false,
"icon": null,
"description": null,
"params": {
"customer_name": "Sara",
"order_number": "48213"
},
"toolsId": null,
"alignment": null,
"tools": {
"id": "a7ef6f91-4663-4726-8300-905e1d7483f2",
"genderDetection": false,
"smartCallEnd": false,
"voiceAgentId": "1f6d7b90-9d4e-475e-b065-87ef52866527",
"createdAt": "2024-11-19T08:49:35.390Z",
"updatedAt": "2024-11-19T00:00:00.000Z"
},
"voiceRecord": {
"id": "39348c01-f7fd-46ec-b314-c84c9534055f",
"language": "ar",
"name": "Layla (Gulf)",
"provider": "awspolly",
"options": {
"Engine": "neural",
"VoiceId": "Hala",
"LanguageCode": "ar-AE"
},
"tags": [
"Arabic",
"Female",
"Gulf"
],
"createdAt": "2024-10-28T07:22:39.225Z",
"updatedAt": "2024-10-28T00:00:00.000Z",
"deletedAt": null,
"deletedBy": null
},
"userInactivityTimeout": 5,
"maxCallDuration": 30,
"responseDelay": 400,
"backgroundNoise": false,
"thinkingVoice": false,
"speakerIdentification": false,
"llmConfigId": "849e77c6-5cb3-479a-a985-7fab630e2c78",
"llmConfig": {
"provider": "openai",
"modelName": "text-davinci-003",
"baseUrl": "https://api.openai.com/v1",
"apiKey": "{{secrets.OPENAI_KEY}}",
"reasoningEffort": "high",
"temperature": 0.5,
"hasApiKey": true,
"apiKeyLast4": "7890"
},
"noiseCancellation": "DISABLED",
"cancelNoisePer": "CONVERSATION",
"agenticRag": false,
"languageDialectSwitcher": false,
"waitForUserToSpeakFirst": 0,
"smartCallEndPrompt": "Terminate the call when: (1) all customer inquiries have been resolved, (2) the conversation has reached a natural conclusion, (3) the customer's goal has been achieved, or (4) further conversation would be unproductive. Use this tool only when you've achieved the primary objective of the call.",
"minInterruptionDuration": 0.5,
"vadActivationThreshold": 0.5,
"enableAutoGainControl": false,
"sendDenoisedToStt": false,
"copiedVersions": 12,
"copiedDrafts": 2,
"outcomeResponseShape": {
"type": "object",
"properties": {
"test": {
"type": "number",
"description": "Hello world from Hamsa AI!"
}
},
"required": [
"test"
]
},
"apiKeyId": "<string>",
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"authKey": "bearer",
"authSecret": "your_webhook_secret"
},
"webToolsIds": [
"<string>"
],
"voiceDictionaryIds": [
"<string>"
],
"knowledgeBaseItemsIds": [
"<string>"
],
"webToolsOverrides": {}
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}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>",
"copy": "agent"
}
'import requests
url = "https://api.tryhamsa.com/v1/voice-agents/clone"
payload = {
"agentName": "<string>",
"copy": "agent"
}
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>', copy: 'agent'})
};
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>',
'copy' => 'agent'
]),
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 \"copy\": \"agent\"\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 \"copy\": \"agent\"\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 \"copy\": \"agent\"\n}"
response = http.request(request)
puts response.read_body{
"success": false,
"message": "success",
"data": {
"id": "1f6d7b90-9d4e-475e-b065-87ef52866527",
"agentName": "My Assistant 04-9 - Copy",
"greetingMessage": "Hello, how can I help you today?",
"greetingMessageType": "STATIC",
"preamble": "You are a helpful assistant that will answer users questions.",
"lang": "ar",
"type": "Single Prompt",
"pokeMessages": [
"Are you still there?",
"Take your time, I'm here when you're ready."
],
"realTime": false,
"silenceThreshold": 800,
"interrupt": true,
"outcome": null,
"projectId": "b23e5e46-3ee1-496d-82b3-d58bf0b000e7",
"createdAt": "2024-11-19T08:49:35.390Z",
"updatedAt": "2024-11-19T00:00:00.000Z",
"voiceRecordId": "39348c01-f7fd-46ec-b314-c84c9534055f",
"deletedAt": null,
"deletedBy": null,
"isTemplate": false,
"icon": null,
"description": null,
"params": {
"customer_name": "Sara",
"order_number": "48213"
},
"toolsId": null,
"alignment": null,
"tools": {
"id": "a7ef6f91-4663-4726-8300-905e1d7483f2",
"genderDetection": false,
"smartCallEnd": false,
"voiceAgentId": "1f6d7b90-9d4e-475e-b065-87ef52866527",
"createdAt": "2024-11-19T08:49:35.390Z",
"updatedAt": "2024-11-19T00:00:00.000Z"
},
"voiceRecord": {
"id": "39348c01-f7fd-46ec-b314-c84c9534055f",
"language": "ar",
"name": "Layla (Gulf)",
"provider": "awspolly",
"options": {
"Engine": "neural",
"VoiceId": "Hala",
"LanguageCode": "ar-AE"
},
"tags": [
"Arabic",
"Female",
"Gulf"
],
"createdAt": "2024-10-28T07:22:39.225Z",
"updatedAt": "2024-10-28T00:00:00.000Z",
"deletedAt": null,
"deletedBy": null
},
"userInactivityTimeout": 5,
"maxCallDuration": 30,
"responseDelay": 400,
"backgroundNoise": false,
"thinkingVoice": false,
"speakerIdentification": false,
"llmConfigId": "849e77c6-5cb3-479a-a985-7fab630e2c78",
"llmConfig": {
"provider": "openai",
"modelName": "text-davinci-003",
"baseUrl": "https://api.openai.com/v1",
"apiKey": "{{secrets.OPENAI_KEY}}",
"reasoningEffort": "high",
"temperature": 0.5,
"hasApiKey": true,
"apiKeyLast4": "7890"
},
"noiseCancellation": "DISABLED",
"cancelNoisePer": "CONVERSATION",
"agenticRag": false,
"languageDialectSwitcher": false,
"waitForUserToSpeakFirst": 0,
"smartCallEndPrompt": "Terminate the call when: (1) all customer inquiries have been resolved, (2) the conversation has reached a natural conclusion, (3) the customer's goal has been achieved, or (4) further conversation would be unproductive. Use this tool only when you've achieved the primary objective of the call.",
"minInterruptionDuration": 0.5,
"vadActivationThreshold": 0.5,
"enableAutoGainControl": false,
"sendDenoisedToStt": false,
"copiedVersions": 12,
"copiedDrafts": 2,
"outcomeResponseShape": {
"type": "object",
"properties": {
"test": {
"type": "number",
"description": "Hello world from Hamsa AI!"
}
},
"required": [
"test"
]
},
"apiKeyId": "<string>",
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"authKey": "bearer",
"authSecret": "your_webhook_secret"
},
"webToolsIds": [
"<string>"
],
"voiceDictionaryIds": [
"<string>"
],
"knowledgeBaseItemsIds": [
"<string>"
],
"webToolsOverrides": {}
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Authorizations
Body
application/json
Was this page helpful?