Make a video from a voice over
curl --request POST \
--url https://api.tryhamsa.com/v2/voice-overs/{id}/videos \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"voiceOverSuggestionId": "c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1",
"style": "REALISTIC",
"aspectRatio": "9:16",
"includeSubtitles": true,
"captionStyle": "WORD_BY_WORD",
"captionBox": true,
"transition": "FADE",
"kenBurnsEnabled": false,
"prompt": "Warm morning light, a busy street café"
}
'import requests
url = "https://api.tryhamsa.com/v2/voice-overs/{id}/videos"
payload = {
"voiceOverSuggestionId": "c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1",
"style": "REALISTIC",
"aspectRatio": "9:16",
"includeSubtitles": True,
"captionStyle": "WORD_BY_WORD",
"captionBox": True,
"transition": "FADE",
"kenBurnsEnabled": False,
"prompt": "Warm morning light, a busy street café"
}
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({
voiceOverSuggestionId: 'c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1',
style: 'REALISTIC',
aspectRatio: '9:16',
includeSubtitles: true,
captionStyle: 'WORD_BY_WORD',
captionBox: true,
transition: 'FADE',
kenBurnsEnabled: false,
prompt: 'Warm morning light, a busy street café'
})
};
fetch('https://api.tryhamsa.com/v2/voice-overs/{id}/videos', 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/{id}/videos",
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([
'voiceOverSuggestionId' => 'c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1',
'style' => 'REALISTIC',
'aspectRatio' => '9:16',
'includeSubtitles' => true,
'captionStyle' => 'WORD_BY_WORD',
'captionBox' => true,
'transition' => 'FADE',
'kenBurnsEnabled' => false,
'prompt' => 'Warm morning light, a busy street café'
]),
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/{id}/videos"
payload := strings.NewReader("{\n \"voiceOverSuggestionId\": \"c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1\",\n \"style\": \"REALISTIC\",\n \"aspectRatio\": \"9:16\",\n \"includeSubtitles\": true,\n \"captionStyle\": \"WORD_BY_WORD\",\n \"captionBox\": true,\n \"transition\": \"FADE\",\n \"kenBurnsEnabled\": false,\n \"prompt\": \"Warm morning light, a busy street café\"\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/{id}/videos")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"voiceOverSuggestionId\": \"c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1\",\n \"style\": \"REALISTIC\",\n \"aspectRatio\": \"9:16\",\n \"includeSubtitles\": true,\n \"captionStyle\": \"WORD_BY_WORD\",\n \"captionBox\": true,\n \"transition\": \"FADE\",\n \"kenBurnsEnabled\": false,\n \"prompt\": \"Warm morning light, a busy street café\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v2/voice-overs/{id}/videos")
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 \"voiceOverSuggestionId\": \"c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1\",\n \"style\": \"REALISTIC\",\n \"aspectRatio\": \"9:16\",\n \"includeSubtitles\": true,\n \"captionStyle\": \"WORD_BY_WORD\",\n \"captionBox\": true,\n \"transition\": \"FADE\",\n \"kenBurnsEnabled\": false,\n \"prompt\": \"Warm morning light, a busy street café\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "voice over video generation started",
"messageKey": "VoiceOverVideoGenerationStarted",
"data": {
"id": "3e9a7c21-5b4d-4f8e-a1c2-7d6e5f4a3b29",
"status": "IN_PROGRESS"
}
}{
"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 Video
Makes an MP4 video from an approved voice over: one generated image per sentence of the script, with its audio, captions if you want them, and a Hamsa logo. 1080×1920 for 9:16, 1920×1080 for 16:9. It is made in the background: follow it in voiceOverVideos of Get Voice Over until status is COMPLETED (then videoUrl is set) or FAILED. A video that makes no progress for 20 minutes fails. You are charged only when it completes. Voice overs belong to the person who made them: an API key sees and changes the voice overs of its creator in its project.
Needs Create on Voice overs (voice_overs:create).
POST
/
v2
/
voice-overs
/
{id}
/
videos
Make a video from a voice over
curl --request POST \
--url https://api.tryhamsa.com/v2/voice-overs/{id}/videos \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"voiceOverSuggestionId": "c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1",
"style": "REALISTIC",
"aspectRatio": "9:16",
"includeSubtitles": true,
"captionStyle": "WORD_BY_WORD",
"captionBox": true,
"transition": "FADE",
"kenBurnsEnabled": false,
"prompt": "Warm morning light, a busy street café"
}
'import requests
url = "https://api.tryhamsa.com/v2/voice-overs/{id}/videos"
payload = {
"voiceOverSuggestionId": "c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1",
"style": "REALISTIC",
"aspectRatio": "9:16",
"includeSubtitles": True,
"captionStyle": "WORD_BY_WORD",
"captionBox": True,
"transition": "FADE",
"kenBurnsEnabled": False,
"prompt": "Warm morning light, a busy street café"
}
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({
voiceOverSuggestionId: 'c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1',
style: 'REALISTIC',
aspectRatio: '9:16',
includeSubtitles: true,
captionStyle: 'WORD_BY_WORD',
captionBox: true,
transition: 'FADE',
kenBurnsEnabled: false,
prompt: 'Warm morning light, a busy street café'
})
};
fetch('https://api.tryhamsa.com/v2/voice-overs/{id}/videos', 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/{id}/videos",
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([
'voiceOverSuggestionId' => 'c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1',
'style' => 'REALISTIC',
'aspectRatio' => '9:16',
'includeSubtitles' => true,
'captionStyle' => 'WORD_BY_WORD',
'captionBox' => true,
'transition' => 'FADE',
'kenBurnsEnabled' => false,
'prompt' => 'Warm morning light, a busy street café'
]),
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/{id}/videos"
payload := strings.NewReader("{\n \"voiceOverSuggestionId\": \"c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1\",\n \"style\": \"REALISTIC\",\n \"aspectRatio\": \"9:16\",\n \"includeSubtitles\": true,\n \"captionStyle\": \"WORD_BY_WORD\",\n \"captionBox\": true,\n \"transition\": \"FADE\",\n \"kenBurnsEnabled\": false,\n \"prompt\": \"Warm morning light, a busy street café\"\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/{id}/videos")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"voiceOverSuggestionId\": \"c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1\",\n \"style\": \"REALISTIC\",\n \"aspectRatio\": \"9:16\",\n \"includeSubtitles\": true,\n \"captionStyle\": \"WORD_BY_WORD\",\n \"captionBox\": true,\n \"transition\": \"FADE\",\n \"kenBurnsEnabled\": false,\n \"prompt\": \"Warm morning light, a busy street café\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v2/voice-overs/{id}/videos")
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 \"voiceOverSuggestionId\": \"c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1\",\n \"style\": \"REALISTIC\",\n \"aspectRatio\": \"9:16\",\n \"includeSubtitles\": true,\n \"captionStyle\": \"WORD_BY_WORD\",\n \"captionBox\": true,\n \"transition\": \"FADE\",\n \"kenBurnsEnabled\": false,\n \"prompt\": \"Warm morning light, a busy street café\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "voice over video generation started",
"messageKey": "VoiceOverVideoGenerationStarted",
"data": {
"id": "3e9a7c21-5b4d-4f8e-a1c2-7d6e5f4a3b29",
"status": "IN_PROGRESS"
}
}{
"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?