curl --request POST \
--url https://api.tryhamsa.com/v2/voice-overs \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "COMMERCIAL",
"dialectId": "2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17",
"voiceOverDescription": "A 30-second ad for a new coffee shop in Cairo",
"includeBackgroundMusic": true
}
'import requests
url = "https://api.tryhamsa.com/v2/voice-overs"
payload = {
"type": "COMMERCIAL",
"dialectId": "2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17",
"voiceOverDescription": "A 30-second ad for a new coffee shop in Cairo",
"includeBackgroundMusic": True
}
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({
type: 'COMMERCIAL',
dialectId: '2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17',
voiceOverDescription: 'A 30-second ad for a new coffee shop in Cairo',
includeBackgroundMusic: true
})
};
fetch('https://api.tryhamsa.com/v2/voice-overs', 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",
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([
'type' => 'COMMERCIAL',
'dialectId' => '2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17',
'voiceOverDescription' => 'A 30-second ad for a new coffee shop in Cairo',
'includeBackgroundMusic' => true
]),
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"
payload := strings.NewReader("{\n \"type\": \"COMMERCIAL\",\n \"dialectId\": \"2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17\",\n \"voiceOverDescription\": \"A 30-second ad for a new coffee shop in Cairo\",\n \"includeBackgroundMusic\": true\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")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"COMMERCIAL\",\n \"dialectId\": \"2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17\",\n \"voiceOverDescription\": \"A 30-second ad for a new coffee shop in Cairo\",\n \"includeBackgroundMusic\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v2/voice-overs")
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 \"type\": \"COMMERCIAL\",\n \"dialectId\": \"2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17\",\n \"voiceOverDescription\": \"A 30-second ad for a new coffee shop in Cairo\",\n \"includeBackgroundMusic\": true\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"
}
}Suggest Voice Overs
Describe what you need, and Hamsa writes three scripts and has each read by a voice that suits the type (the same voice can read more than one), with a different background track for each if you ask for music. It is made in the background: read it with Get Voice Over until status changes. You are charged once, when it is ready. When two or three takes succeed, choose one with Approve Voice Over; when only one does, it is chosen for you.
The voices are public Arabic voices of the dialect you pick, so dialectId must be an Arabic dialect from List Dialects.
Needs Create on Voice overs (voice_overs:create).
curl --request POST \
--url https://api.tryhamsa.com/v2/voice-overs \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "COMMERCIAL",
"dialectId": "2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17",
"voiceOverDescription": "A 30-second ad for a new coffee shop in Cairo",
"includeBackgroundMusic": true
}
'import requests
url = "https://api.tryhamsa.com/v2/voice-overs"
payload = {
"type": "COMMERCIAL",
"dialectId": "2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17",
"voiceOverDescription": "A 30-second ad for a new coffee shop in Cairo",
"includeBackgroundMusic": True
}
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({
type: 'COMMERCIAL',
dialectId: '2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17',
voiceOverDescription: 'A 30-second ad for a new coffee shop in Cairo',
includeBackgroundMusic: true
})
};
fetch('https://api.tryhamsa.com/v2/voice-overs', 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",
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([
'type' => 'COMMERCIAL',
'dialectId' => '2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17',
'voiceOverDescription' => 'A 30-second ad for a new coffee shop in Cairo',
'includeBackgroundMusic' => true
]),
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"
payload := strings.NewReader("{\n \"type\": \"COMMERCIAL\",\n \"dialectId\": \"2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17\",\n \"voiceOverDescription\": \"A 30-second ad for a new coffee shop in Cairo\",\n \"includeBackgroundMusic\": true\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")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"COMMERCIAL\",\n \"dialectId\": \"2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17\",\n \"voiceOverDescription\": \"A 30-second ad for a new coffee shop in Cairo\",\n \"includeBackgroundMusic\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v2/voice-overs")
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 \"type\": \"COMMERCIAL\",\n \"dialectId\": \"2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17\",\n \"voiceOverDescription\": \"A 30-second ad for a new coffee shop in Cairo\",\n \"includeBackgroundMusic\": true\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
The kind of voice over. POETRY: a poem (in Arabic, with rhyme and rhythm). COMMERCIAL: an ad, hook to benefits to call to action. RELIGIOUS: a calm, spiritual script. STORIES: a narrated story. The three prose types aim for 30 to 120 seconds (75 to 220 words).
POETRY, COMMERCIAL, RELIGIOUS, STORIES "COMMERCIAL"
The Arabic dialect of the voices, from List Dialects.
"2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17"
Was this page helpful?