Skip to main content
POST
/
create_video_with_template
Create video with template
curl --request POST \
  --url https://api.jogg.ai/v1/create_video_with_template \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "template_id": 1234,
  "lang": "english",
  "template_type": "common",
  "variables": [
    {
      "name": "<string>",
      "properties": {
        "content": "<string>",
        "url": "<string>",
        "asset_id": 123
      }
    }
  ],
  "avatar_id": 1,
  "avatar_type": 0,
  "voice_id": "en-US-ChristopherNeural",
  "caption": true,
  "music_id": 1,
  "video_name": "My Video"
}
'
import requests

url = "https://api.jogg.ai/v1/create_video_with_template"

payload = {
"template_id": 1234,
"lang": "english",
"template_type": "common",
"variables": [
{
"name": "<string>",
"properties": {
"content": "<string>",
"url": "<string>",
"asset_id": 123
}
}
],
"avatar_id": 1,
"avatar_type": 0,
"voice_id": "en-US-ChristopherNeural",
"caption": True,
"music_id": 1,
"video_name": "My Video"
}
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({
template_id: 1234,
lang: 'english',
template_type: 'common',
variables: [
{
name: '<string>',
properties: {content: '<string>', url: '<string>', asset_id: 123}
}
],
avatar_id: 1,
avatar_type: 0,
voice_id: 'en-US-ChristopherNeural',
caption: true,
music_id: 1,
video_name: 'My Video'
})
};

fetch('https://api.jogg.ai/v1/create_video_with_template', 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.jogg.ai/v1/create_video_with_template",
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([
'template_id' => 1234,
'lang' => 'english',
'template_type' => 'common',
'variables' => [
[
'name' => '<string>',
'properties' => [
'content' => '<string>',
'url' => '<string>',
'asset_id' => 123
]
]
],
'avatar_id' => 1,
'avatar_type' => 0,
'voice_id' => 'en-US-ChristopherNeural',
'caption' => true,
'music_id' => 1,
'video_name' => 'My Video'
]),
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.jogg.ai/v1/create_video_with_template"

payload := strings.NewReader("{\n \"template_id\": 1234,\n \"lang\": \"english\",\n \"template_type\": \"common\",\n \"variables\": [\n {\n \"name\": \"<string>\",\n \"properties\": {\n \"content\": \"<string>\",\n \"url\": \"<string>\",\n \"asset_id\": 123\n }\n }\n ],\n \"avatar_id\": 1,\n \"avatar_type\": 0,\n \"voice_id\": \"en-US-ChristopherNeural\",\n \"caption\": true,\n \"music_id\": 1,\n \"video_name\": \"My Video\"\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.jogg.ai/v1/create_video_with_template")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"template_id\": 1234,\n \"lang\": \"english\",\n \"template_type\": \"common\",\n \"variables\": [\n {\n \"name\": \"<string>\",\n \"properties\": {\n \"content\": \"<string>\",\n \"url\": \"<string>\",\n \"asset_id\": 123\n }\n }\n ],\n \"avatar_id\": 1,\n \"avatar_type\": 0,\n \"voice_id\": \"en-US-ChristopherNeural\",\n \"caption\": true,\n \"music_id\": 1,\n \"video_name\": \"My Video\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.jogg.ai/v1/create_video_with_template")

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 \"template_id\": 1234,\n \"lang\": \"english\",\n \"template_type\": \"common\",\n \"variables\": [\n {\n \"name\": \"<string>\",\n \"properties\": {\n \"content\": \"<string>\",\n \"url\": \"<string>\",\n \"asset_id\": 123\n }\n }\n ],\n \"avatar_id\": 1,\n \"avatar_type\": 0,\n \"voice_id\": \"en-US-ChristopherNeural\",\n \"caption\": true,\n \"music_id\": 1,\n \"video_name\": \"My Video\"\n}"

response = http.request(request)
puts response.read_body
{
  "code": 123,
  "msg": "<string>",
  "data": {
    "project_id": "12345"
  }
}

Authorizations

x-api-key
string
header
required

Body

application/json
template_id
integer
required

Template ID

Example:

1234

lang
string
required

Language for text-to-speech conversion

Example:

"english"

template_type
enum<string>
required

Template source type:

  • common - Template from template library

  • user - Template from user templates

Available options:
common,
user
Example:

"common"

variables
object[]
required

Variables to replace in the template

avatar_id
integer

Digital person ID

Example:

1

avatar_type
enum<integer>

Avatar source type:

  • 0 - Public avatars

  • 1 - Custom avatars

Available options:
0,
1
Example:

0

voice_id
string

Voice ID for text-to-speech

Example:

"en-US-ChristopherNeural"

caption
boolean

Whether to enable captions

Example:

true

music_id
integer

Background music ID

Example:

1

video_name
string

If you want to specify the name of the generated video, please use this parameter.

Example:

"My Video"

Response

200 - application/json

Success

code
integer
required

Business status code:

  • 0 - Success

  • 10104 - Record not found

  • 10105 - Invalid API key

  • 18020 - Insufficient credit

  • 18025 - No permission to call APIs.

  • 40000 - Parameter error

  • 50000 - System error

msg
string
required

Response message

data
object