Create a voice over from your script
curl --request POST \
--url https://api.tryhamsa.com/v2/voice-overs/static \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"voiceOverText": "ابدأ يومك بقهوة تستحقها، في قلب القاهرة.",
"ttsVoiceId": "6a1f0c2e-8b7d-4e3a-9c5b-2d4f6e8a0b13",
"type": "COMMERCIAL",
"voiceOverBackgroundMusicId": "auto"
}
'import requests
url = "https://api.tryhamsa.com/v2/voice-overs/static"
payload = {
"voiceOverText": "ابدأ يومك بقهوة تستحقها، في قلب القاهرة.",
"ttsVoiceId": "6a1f0c2e-8b7d-4e3a-9c5b-2d4f6e8a0b13",
"type": "COMMERCIAL",
"voiceOverBackgroundMusicId": "auto"
}
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({
voiceOverText: 'ابدأ يومك بقهوة تستحقها، في قلب القاهرة.',
ttsVoiceId: '6a1f0c2e-8b7d-4e3a-9c5b-2d4f6e8a0b13',
type: 'COMMERCIAL',
voiceOverBackgroundMusicId: 'auto'
})
};
fetch('https://api.tryhamsa.com/v2/voice-overs/static', 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-overs/static",
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([
'voiceOverText' => 'ابدأ يومك بقهوة تستحقها، في قلب القاهرة.',
'ttsVoiceId' => '6a1f0c2e-8b7d-4e3a-9c5b-2d4f6e8a0b13',
'type' => 'COMMERCIAL',
'voiceOverBackgroundMusicId' => 'auto'
]),
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/v2/voice-overs/static"
payload := strings.NewReader("{\n \"voiceOverText\": \"ابدأ يومك بقهوة تستحقها، في قلب القاهرة.\",\n \"ttsVoiceId\": \"6a1f0c2e-8b7d-4e3a-9c5b-2d4f6e8a0b13\",\n \"type\": \"COMMERCIAL\",\n \"voiceOverBackgroundMusicId\": \"auto\"\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/v2/voice-overs/static")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"voiceOverText\": \"ابدأ يومك بقهوة تستحقها، في قلب القاهرة.\",\n \"ttsVoiceId\": \"6a1f0c2e-8b7d-4e3a-9c5b-2d4f6e8a0b13\",\n \"type\": \"COMMERCIAL\",\n \"voiceOverBackgroundMusicId\": \"auto\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v2/voice-overs/static")
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 \"voiceOverText\": \"ابدأ يومك بقهوة تستحقها، في قلب القاهرة.\",\n \"ttsVoiceId\": \"6a1f0c2e-8b7d-4e3a-9c5b-2d4f6e8a0b13\",\n \"type\": \"COMMERCIAL\",\n \"voiceOverBackgroundMusicId\": \"auto\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "success",
"data": {
"voiceOver": {
"id": "bd0ebca4-a16e-488b-b195-4690792259c7",
"status": "IN_PROGRESS",
"prompt": "<string>",
"media": null,
"type": "COMMERCIAL",
"voiceOverSuggestions": [
{
"id": "c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1",
"status": "PENDING"
}
]
}
}
}{
"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"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Voice Overs
Create Voice Over
Your own script, read by the voice you choose, with background music if you want it. It makes one take, which is chosen automatically. It is made in the background: read it with Get Voice Over until status changes. You are charged once, when it is ready.
Needs Create on Voice overs (voice_overs:create).
POST
/
v2
/
voice-overs
/
static
Create a voice over from your script
curl --request POST \
--url https://api.tryhamsa.com/v2/voice-overs/static \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"voiceOverText": "ابدأ يومك بقهوة تستحقها، في قلب القاهرة.",
"ttsVoiceId": "6a1f0c2e-8b7d-4e3a-9c5b-2d4f6e8a0b13",
"type": "COMMERCIAL",
"voiceOverBackgroundMusicId": "auto"
}
'import requests
url = "https://api.tryhamsa.com/v2/voice-overs/static"
payload = {
"voiceOverText": "ابدأ يومك بقهوة تستحقها، في قلب القاهرة.",
"ttsVoiceId": "6a1f0c2e-8b7d-4e3a-9c5b-2d4f6e8a0b13",
"type": "COMMERCIAL",
"voiceOverBackgroundMusicId": "auto"
}
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({
voiceOverText: 'ابدأ يومك بقهوة تستحقها، في قلب القاهرة.',
ttsVoiceId: '6a1f0c2e-8b7d-4e3a-9c5b-2d4f6e8a0b13',
type: 'COMMERCIAL',
voiceOverBackgroundMusicId: 'auto'
})
};
fetch('https://api.tryhamsa.com/v2/voice-overs/static', 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-overs/static",
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([
'voiceOverText' => 'ابدأ يومك بقهوة تستحقها، في قلب القاهرة.',
'ttsVoiceId' => '6a1f0c2e-8b7d-4e3a-9c5b-2d4f6e8a0b13',
'type' => 'COMMERCIAL',
'voiceOverBackgroundMusicId' => 'auto'
]),
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/v2/voice-overs/static"
payload := strings.NewReader("{\n \"voiceOverText\": \"ابدأ يومك بقهوة تستحقها، في قلب القاهرة.\",\n \"ttsVoiceId\": \"6a1f0c2e-8b7d-4e3a-9c5b-2d4f6e8a0b13\",\n \"type\": \"COMMERCIAL\",\n \"voiceOverBackgroundMusicId\": \"auto\"\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/v2/voice-overs/static")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"voiceOverText\": \"ابدأ يومك بقهوة تستحقها، في قلب القاهرة.\",\n \"ttsVoiceId\": \"6a1f0c2e-8b7d-4e3a-9c5b-2d4f6e8a0b13\",\n \"type\": \"COMMERCIAL\",\n \"voiceOverBackgroundMusicId\": \"auto\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v2/voice-overs/static")
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 \"voiceOverText\": \"ابدأ يومك بقهوة تستحقها، في قلب القاهرة.\",\n \"ttsVoiceId\": \"6a1f0c2e-8b7d-4e3a-9c5b-2d4f6e8a0b13\",\n \"type\": \"COMMERCIAL\",\n \"voiceOverBackgroundMusicId\": \"auto\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "success",
"data": {
"voiceOver": {
"id": "bd0ebca4-a16e-488b-b195-4690792259c7",
"status": "IN_PROGRESS",
"prompt": "<string>",
"media": null,
"type": "COMMERCIAL",
"voiceOverSuggestions": [
{
"id": "c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1",
"status": "PENDING"
}
]
}
}
}{
"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"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Authorizations
Body
application/json
Was this page helpful?