Skip to content

Managing Templates

This API guide provides an overview of using templates for bulk request generation.


Templates allow you to add and customize text, images, videos, audio, voices, and avatars. If you want to save your video configurations for future use, creating a template is a better option than generating the video directly. 🦊

Quick Start

Let’s dive in and explore how to create a template and list your templates, so you can efficiently generate bulk videos using them later.

Creating Template

To create a bulk video template, use the following API request. It lets you define various settings, including audio text, avatar, and background, to generate a reusable video template efficiently. Customize the parameters to fit your needs. Once created, you can use the 'id' from the response as 'template_id' in create bulk requests to generate bulk request using this template.

You can obtain the 'audio_id' and 'audio_service' from the audio listing API and the "csv_id" from the csv listing API.

You can use macros in the format '{{}}' within the 'audio_text', which will be dynamically replaced by values from the CSV file you provided. For example, if you include '{{First Name}}' in your text, it will be replaced by names like "John" and "Smith" for each corresponding entry in the CSV, creating personalized audio for each video in the list. We support up to 20 template variables per request. Ensure that the number and names of these variables match exactly between your text and the CSV file. Template variable names are case insensitive. If any template variables are missing from the CSV, an error will be returned.

curl --request POST  \
     --url 'https://api.immersive-fox.com/v1/template/create_bulk_template/'  \
     --header 'X-Api-Key: <your-api-key>'  \
     --header 'Content-Type: application/json'  \
     --data { \
         "csv_id": 45, \
         "template_name": "My new template", \
         "configurations": [ \
             { \
                 "audio_text": "Hi, My name is {{First Name}}", \
                 "avatar": 102, \
                 "avatar_size": 76, \
                 "background_color": "#ffffff", \
                 "background_music_is_personalized": "system", \
                 "background_music_volume": 0.1, \
                 "frame_height": 1080, \
                 "frame_width": 1920, \
                 "is_personalized_audio": false, \
                 "scene_number": 1, \
                 "scene_transition": "none", \
                 "audio_id": 2, \
                 "audio_service": "google_audio", \
                 "user_voice_speed": 1, \
                 "x_position": 0.604931, \
                 "y_position": 0.43101 \
             } \
         ] \
     }
{
    "id": 1142,
    "project_name": "My new template",
    "csv_id": 45,
    "user": 31,
}

Generating Templates with AI

Immersive Fox offers a powerful feature that automates the creation of templates. Instead of manually designing each template, you can leverage our AI models to generate them for you. Simply provide a descriptive text prompt, and our algorithms will craft a comprehensive template that includes scenes, text, backgrounds, and voices.

Our AI will also utilize the data from the specified CSV file during bulk video generation. This allows you to effortlessly create marketing campaigns tailored to your clients. You can specify which fields from the CSV will be used in the video, by providing the optional_params_for_scripts field in the payload.

Use the following curl command to request an AI-generated template:

curl --request POST  \
     --url 'https://api.immersive-fox.com/v1/template/generate_bulk_template_with_ai/'  \
     --header 'X-Api-Key: <your-api-key>'  \
     --header 'Content-Type: application/json'  \
     --data { \
         "avatar_gender": "female", # male / female \
         "template_name": "Project_01", \
         "target_audience" : "Subscribers of Spotify", \
         "description" : "Tell our users that their subscription is going to finish soon", \
         "main_language" : "English", \
         "goal" : "Renew Subscription", \
         "allow_third_party_ml_models": true, \
         "length": "long", # short / medium / long \
         "optional_params_for_scripts": ["person_name", "subscription_type", "subscription_charges"] \
     }
{
    "id": 1142,
    "project_name": "Project_01",
    "user": 31,
}

Listing Template

To list all templates created by the user, use the following API request. It returns details of all templates, allowing you to review and manage them. Once you have the templates, you can use the 'id' from from any of these templates as 'template_id' in create bulk requests to generate bulk request using this template.

curl --request GET  \
     --url 'https://api.immersive-fox.com/v1/template/bulk_templates'  \
     --header 'X-Api-Key: <your-api-key>'  \
     --header 'Content-Type: application/json' 
[
    {
        "id": 1112,
        "project_name": "My old template",
        "csv_id": 41,
        "user": 31
    },
    {
        "id": 1142,
        "project_name": "My new template",
        "csv_id": 45,
        "user": 31
    }
]

Get Template Detail

To get details of a specific template, use the following API request. It provides information about the selected template, allowing you to view the configurations before bulk request generation. Once you have the template details, you can use the 'id' as 'template_id' in create bulk requests to generate bulk request using this template.

curl --request GET  \
     --url 'https://api.immersive-fox.com/v1/template/bulk_template/<template_id>'  \
     --header 'X-Api-Key: <your-api-key>'  \
     --header 'Content-Type: application/json' 
{
    "csv_id": 47,
    "template_name": "My new template",
    "configurations": [ {
    "audio_text": "Hi, My name is {{First Name}}",
    "avatar": 223,
    "avatar_size": 75,
    "background_color": "#ffffff",
    "background_music_is_personalized": "system",
    "background_music_volume": 0.1,
    "frame_height": 1080,
    "frame_width": 1920,
    "is_personalized_audio": false,
    "scene_number": 1,
    "scene_transition": "none",
    "audio_id": 2,
    "audio_service": "google_audio",
    "user_voice_speed": 1,
    "x_position": 0.604931,
    "y_position": 0.431010,
}