curl --request POST \
--url https://api.trugen.ai/v1/script-to-video/createVideo \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"avatar_id": "avatar_abc123",
"voice_id": "ZUrEGyu8GFMwnHbvLhv2",
"provider_name": "elevenlabs",
"model_name": "eleven_multilingual_v2",
"script": "Welcome to Trugen AI. This is a demonstration of our text to video generation capability.",
"callback_url": "https://your-app.com/webhook/video-ready"
}
'import requests
url = "https://api.trugen.ai/v1/script-to-video/createVideo"
payload = {
"avatar_id": "avatar_abc123",
"voice_id": "ZUrEGyu8GFMwnHbvLhv2",
"provider_name": "elevenlabs",
"model_name": "eleven_multilingual_v2",
"script": "Welcome to Trugen AI. This is a demonstration of our text to video generation capability.",
"callback_url": "https://your-app.com/webhook/video-ready"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
avatar_id: 'avatar_abc123',
voice_id: 'ZUrEGyu8GFMwnHbvLhv2',
provider_name: 'elevenlabs',
model_name: 'eleven_multilingual_v2',
script: 'Welcome to Trugen AI. This is a demonstration of our text to video generation capability.',
callback_url: 'https://your-app.com/webhook/video-ready'
})
};
fetch('https://api.trugen.ai/v1/script-to-video/createVideo', 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.trugen.ai/v1/script-to-video/createVideo",
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([
'avatar_id' => 'avatar_abc123',
'voice_id' => 'ZUrEGyu8GFMwnHbvLhv2',
'provider_name' => 'elevenlabs',
'model_name' => 'eleven_multilingual_v2',
'script' => 'Welcome to Trugen AI. This is a demonstration of our text to video generation capability.',
'callback_url' => 'https://your-app.com/webhook/video-ready'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.trugen.ai/v1/script-to-video/createVideo"
payload := strings.NewReader("{\n \"avatar_id\": \"avatar_abc123\",\n \"voice_id\": \"ZUrEGyu8GFMwnHbvLhv2\",\n \"provider_name\": \"elevenlabs\",\n \"model_name\": \"eleven_multilingual_v2\",\n \"script\": \"Welcome to Trugen AI. This is a demonstration of our text to video generation capability.\",\n \"callback_url\": \"https://your-app.com/webhook/video-ready\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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.trugen.ai/v1/script-to-video/createVideo")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"avatar_id\": \"avatar_abc123\",\n \"voice_id\": \"ZUrEGyu8GFMwnHbvLhv2\",\n \"provider_name\": \"elevenlabs\",\n \"model_name\": \"eleven_multilingual_v2\",\n \"script\": \"Welcome to Trugen AI. This is a demonstration of our text to video generation capability.\",\n \"callback_url\": \"https://your-app.com/webhook/video-ready\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trugen.ai/v1/script-to-video/createVideo")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"avatar_id\": \"avatar_abc123\",\n \"voice_id\": \"ZUrEGyu8GFMwnHbvLhv2\",\n \"provider_name\": \"elevenlabs\",\n \"model_name\": \"eleven_multilingual_v2\",\n \"script\": \"Welcome to Trugen AI. This is a demonstration of our text to video generation capability.\",\n \"callback_url\": \"https://your-app.com/webhook/video-ready\"\n}"
response = http.request(request)
puts response.read_body{
"estimated_duration": 2.09,
"generation_id": "529fb61c-da5d-4b2d-9d49-b612deede60f",
"status": "processing"
}{
"error": "Unauthorized: not a valid authorization api key"
}{
"error": "Failed to initiate video generation"
}Text To Video Generator
Generate a real life avatar video from text. Provide a script along with an avatar, voice, and provider configuration to produce a rendered video. The response returns a generation_id which can be used to track the status of the video generation.
curl --request POST \
--url https://api.trugen.ai/v1/script-to-video/createVideo \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"avatar_id": "avatar_abc123",
"voice_id": "ZUrEGyu8GFMwnHbvLhv2",
"provider_name": "elevenlabs",
"model_name": "eleven_multilingual_v2",
"script": "Welcome to Trugen AI. This is a demonstration of our text to video generation capability.",
"callback_url": "https://your-app.com/webhook/video-ready"
}
'import requests
url = "https://api.trugen.ai/v1/script-to-video/createVideo"
payload = {
"avatar_id": "avatar_abc123",
"voice_id": "ZUrEGyu8GFMwnHbvLhv2",
"provider_name": "elevenlabs",
"model_name": "eleven_multilingual_v2",
"script": "Welcome to Trugen AI. This is a demonstration of our text to video generation capability.",
"callback_url": "https://your-app.com/webhook/video-ready"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
avatar_id: 'avatar_abc123',
voice_id: 'ZUrEGyu8GFMwnHbvLhv2',
provider_name: 'elevenlabs',
model_name: 'eleven_multilingual_v2',
script: 'Welcome to Trugen AI. This is a demonstration of our text to video generation capability.',
callback_url: 'https://your-app.com/webhook/video-ready'
})
};
fetch('https://api.trugen.ai/v1/script-to-video/createVideo', 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.trugen.ai/v1/script-to-video/createVideo",
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([
'avatar_id' => 'avatar_abc123',
'voice_id' => 'ZUrEGyu8GFMwnHbvLhv2',
'provider_name' => 'elevenlabs',
'model_name' => 'eleven_multilingual_v2',
'script' => 'Welcome to Trugen AI. This is a demonstration of our text to video generation capability.',
'callback_url' => 'https://your-app.com/webhook/video-ready'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.trugen.ai/v1/script-to-video/createVideo"
payload := strings.NewReader("{\n \"avatar_id\": \"avatar_abc123\",\n \"voice_id\": \"ZUrEGyu8GFMwnHbvLhv2\",\n \"provider_name\": \"elevenlabs\",\n \"model_name\": \"eleven_multilingual_v2\",\n \"script\": \"Welcome to Trugen AI. This is a demonstration of our text to video generation capability.\",\n \"callback_url\": \"https://your-app.com/webhook/video-ready\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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.trugen.ai/v1/script-to-video/createVideo")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"avatar_id\": \"avatar_abc123\",\n \"voice_id\": \"ZUrEGyu8GFMwnHbvLhv2\",\n \"provider_name\": \"elevenlabs\",\n \"model_name\": \"eleven_multilingual_v2\",\n \"script\": \"Welcome to Trugen AI. This is a demonstration of our text to video generation capability.\",\n \"callback_url\": \"https://your-app.com/webhook/video-ready\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trugen.ai/v1/script-to-video/createVideo")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"avatar_id\": \"avatar_abc123\",\n \"voice_id\": \"ZUrEGyu8GFMwnHbvLhv2\",\n \"provider_name\": \"elevenlabs\",\n \"model_name\": \"eleven_multilingual_v2\",\n \"script\": \"Welcome to Trugen AI. This is a demonstration of our text to video generation capability.\",\n \"callback_url\": \"https://your-app.com/webhook/video-ready\"\n}"
response = http.request(request)
puts response.read_body{
"estimated_duration": 2.09,
"generation_id": "529fb61c-da5d-4b2d-9d49-b612deede60f",
"status": "processing"
}{
"error": "Unauthorized: not a valid authorization api key"
}{
"error": "Failed to initiate video generation"
}Authorizations
Body
The unique identifier of the avatar to use for video generation.
"avatar_abc123"
The unique identifier of the voice to use for the audio narration.
"ZUrEGyu8GFMwnHbvLhv2"
The name of the TTS provider to use for audio synthesis.
"elevenlabs"
The model name within the provider to use for audio synthesis.
"eleven_multilingual_v2"
The text script that the avatar will speak in the generated video.
"Welcome to Trugen AI. This is a demonstration of our text to video generation capability."
An optional URL that will receive a POST request when the video generation is complete.
"https://your-app.com/webhook/video-ready"
Response
Video generation successfully initiated.
Estimated duration of the generated video in seconds.
2.09
Unique identifier for this video generation job. Use this to track or retrieve the result.
"529fb61c-da5d-4b2d-9d49-b612deede60f"
Current status of the video generation job.
"processing"
Was this page helpful?