Skip to main content
POST
/
v1
/
project
/
create
curl -X POST "https://api.slidevid.ai/v1/project/create" \
  -H "Content-Type: application/json" \
  -H "x-api-key: your_api_key_here" \
  -d '{
    "type": "class",
    "templateId": "cmha385y900012yhv17qfmase",
    "title": "My Video from Template",
    "scenes": [
      {
        "script": "Welcome to our presentation. Today we'\''ll discuss the key features of our product.",
        "avatar": {
          "id": "1",
          "topLeft": {
            "x": 0,
            "y": 0
          },
          "bottomRight": {
            "x": 100,
            "y": 100
          }
        }
        "variables": [
          {"key": "name", "type": "text", "value": "Juan Montiel"},
          {"key": "description_small", "type": "text", "value": "Welcome to our presentation. Today we'\''ll discuss the key features of our product."}
          {"key": "background", "type": "media", "value": "https://www.pexels.com/es-es/foto/mujer-sentada-junto-a-la-ventana-con-vista-al-paisaje-urbano-de-tokio-29531015"},
        ]
      },
      {
        "script": "Our platform offers seamless integration with your existing tools and workflows.",
        "variables": [
          {"key": "module_number", "value": "1"}
        ]
      }
    ],
    "aspectRatio": "ratio_16_9",
    "caption": true,
    "webhook": "https://yoursite.com/webhook",
    "language": "en"
  }'
{
  "success": true,
  "message": "Project created successfully",
  "data": {
    "projectId": "proj_new_xyz789",
    "status": "processing",
  }
}

Overview

Generate videos from templates by providing variable values for each scene. This is perfect for creating personalized video content at scale.

How Templates Work

Templates in SlideVid use scenes - each scene has a script with {{variables}} that you replace:
  1. Get template details to see scenes and variables
  2. Prepare your data with values for each variable per scene
  3. Generate video with the templateId and scenes array

Request Body

type
string
required
Video type (must match template type)
templateId
string
required
The template ID to use
title
string
Optional video title
aspectRatio
string
required
Override template aspect ratio: ratio_9_16, ratio_16_9, or ratio_1_1
caption
boolean
required
Enable auto-generated captions
scenes
array
required
Array of scenes with script and variables for each
[
  {
    "script": "Welcome {{name}}!",
    "avatar": {
      "id": "1",
      "topLeft": {
        "x": 0,
        "y": 0
      },
      "bottomRight": {
        "x": 100,
        "y": 100
      }
    },
    "variables": [
      {"key": "name", "type": "text", "value": "John"},
      {"key": "background", "type": "media", "value": "https://www.pexels.com/es-es/foto/mujer-sentada-junto-a-la-ventana-con-vista-al-paisaje-urbano-de-tokio-29531015"},
    ]
  }
]
webhook
string
URL to receive completion notification
language
string
required
Set the language for the generated video. Supported values: en (English), es (Spanish)

Scene Structure

Each scene in the scenes array must include:
script
string
required
The script for this scene (can include {{variables}})
variables
array
required
Array of {key, type, value} pairs to replace in the script
[
  {"key": "name", "type": "text", "value": "John Doe"},
  {"key": "product", "type": "text", "value": "AI Video Tool"}
]
curl -X POST "https://api.slidevid.ai/v1/project/create" \
  -H "Content-Type: application/json" \
  -H "x-api-key: your_api_key_here" \
  -d '{
    "type": "class",
    "templateId": "cmha385y900012yhv17qfmase",
    "title": "My Video from Template",
    "scenes": [
      {
        "script": "Welcome to our presentation. Today we'\''ll discuss the key features of our product.",
        "avatar": {
          "id": "1",
          "topLeft": {
            "x": 0,
            "y": 0
          },
          "bottomRight": {
            "x": 100,
            "y": 100
          }
        }
        "variables": [
          {"key": "name", "type": "text", "value": "Juan Montiel"},
          {"key": "description_small", "type": "text", "value": "Welcome to our presentation. Today we'\''ll discuss the key features of our product."}
          {"key": "background", "type": "media", "value": "https://www.pexels.com/es-es/foto/mujer-sentada-junto-a-la-ventana-con-vista-al-paisaje-urbano-de-tokio-29531015"},
        ]
      },
      {
        "script": "Our platform offers seamless integration with your existing tools and workflows.",
        "variables": [
          {"key": "module_number", "value": "1"}
        ]
      }
    ],
    "aspectRatio": "ratio_16_9",
    "caption": true,
    "webhook": "https://yoursite.com/webhook",
    "language": "en"
  }'
{
  "success": true,
  "message": "Project created successfully",
  "data": {
    "projectId": "proj_new_xyz789",
    "status": "processing",
  }
}

Bulk Generation Example

Generate personalized videos for multiple customers:
Bulk Generation
const template = await getTemplateDetails(templateId);

const customers = [
  { name: 'John Doe', "type": "text", company: 'Acme Corp', plan: 'Pro' },
  { name: 'Jane Smith', "type": "text", company: 'TechStart', plan: 'Enterprise' },
  { name: 'Bob Wilson', "type": "text", company: 'Digital Inc', plan: 'Starter' }
];

for (const customer of customers) {
  // Map template scenes with customer data
  const scenes = template.scenes.map(scene => ({
    script: scene.script,
    avatar: {
      id: "1"
    },
    variables: scene.variables.map(varName => ({
      key: varName.key,
      type: varName.type,
      value: customer[varName.key] || ''
    }))
  }));
  
  // Generate video
  const response = await fetch('https://api.slidevid.ai/v1/project/create', {
    method: 'POST',
    headers: {
      'x-api-key': API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      type: template.type,
      templateId: templateId,
      title: `Video for ${customer.name}`,
      scenes: scenes,
      webhook: `https://yoursite.com/webhook/${customer.id}`,
      caption: true,
      language: "en"
    })
  });
  
  console.log(`✅ Video created for ${customer.name}`);
  
  // Rate limiting - wait 1 second between requests
  await new Promise(resolve => setTimeout(resolve, 1000));
}

Variable Replacement Rules

Variables in scripts use double curly brackets: {{variable_name}}
"Hello {{first_name}}! Welcome to {{company_name}}."
Variable names are case-sensitive:
  • {{name}}{{Name}}
  • {{firstName}}{{firstname}}
You must provide values for all variables in each scene:
// ❌ Will fail if scene has {{name}} and {{product}}
"variables": [
  {"key": "name", "value": "John"}
]

// ✅ Correct
"variables": [
  {"key": "name", "value": "John"},
  {"key": "product", "value": "AI Tool"}
]
Empty string values are allowed:
{"key": "optional_field", "value": ""}
This replaces {{optional_field}} with an empty string.

Overriding Template Settings

You can override some template settings:
{
  "templateId": "...",
  "aspectRatio": "ratio_9_16",  // Override to vertical
  "scenes": [...]
}

Best Practices

Validate First

Get template details and validate your data before generating

Use Webhooks

Always provide webhook URLs for async notification

Rate Limiting

Add delays between bulk requests (1 second recommended)

Error Handling

Check for missing variables before generation
Missing Variables: If any required variable is missing, the video generation will fail. Always validate your data against the template’s variable requirements first.

Authorizations

x-api-key
string
header
required

Body

application/json
type
enum<string>
default:class
required

Video type

Available options:
class
templateId
string
required

Template ID (for template-based videos)

scenes
object[]
required

Array of scenes with script and variables (for template-based videos)

aspectRatio
enum<string>
default:ratio_16_9
required

Video aspect ratio

Available options:
ratio_9_16,
ratio_16_9,
ratio_1_1
caption
boolean
default:false
required

Enable/disable captions

language
enum<string>
default:en
required

Language for the video

Available options:
en,
es
title
string

Video title/name

webhook
string

Webhook URL for completion notification

Response

200

Success