Skip to main content
This guide shows you how to use an existing Pictory project as a template to generate personalized videos programmatically. Create a project once in the Pictory App with placeholder variables, then use the API to generate unlimited variations by substituting different values.

What You’ll Learn

Template Variables

Add placeholder variables to your project using double curly brackets

Get Project ID

Find the project ID from the Pictory App URL

API Integration

Use the API to render videos with variable substitution

Personalization at Scale

Generate personalized videos for different audiences

Before You Begin

Make sure you have:
  • A Pictory account with an existing project (create one here)
  • A Pictory API key
  • Node.js or Python installed on your machine
  • Basic understanding of API calls

How Template Variables Work

Template variables are placeholders in your project that get replaced with actual values when you render the video. You define them using double curly brackets syntax: {{variableName}}.

Variable Syntax

Variables can be placed in:
  • Scene subtitles/text
  • Any text element in your project

Step-by-Step Guide

Step 1: Create a Template Project in Pictory App

  1. Open the Pictory App and create a new project or open an existing one
  2. In your scene text, add template variables using double curly brackets
  3. Design your video with visuals, transitions, and any other elements you want
Example template text with variables:
Pictory project storyboard showing template variables in scene subtitles
In this example, the project contains two template variables:
  • {{Year}} - Will be replaced with the target year (e.g., “2026”)
  • {{Name}} - Will be replaced with the recipient’s name (e.g., “James Thomas”)
Variable Naming Tips:
  • Use descriptive names like {{CustomerName}} instead of {{n}}
  • Variables are case-sensitive: {{Name}} and {{name}} are different
  • Avoid spaces in variable names: use {{FirstName}} not {{First Name}}

Step 2: Get the Project ID

Once your template project is ready, you need to get its project ID to use with the API.
  1. Open your project in the Pictory App
  2. Look at the browser address bar - the URL will look like:
  3. The project ID is the long string after /story/:
Browser address bar showing the project URL with project ID
The project ID is a unique identifier for your project. Copy this ID exactly as shown; it is case-sensitive and must be complete.

Step 3: Render Video from Template via API

Now use the API to create videos from your template by providing the project ID as templateId and the variable values:

Understanding the API Request

Request Parameters

Variables Object

The variables object contains key-value pairs where:
  • Key: The variable name (without curly brackets) - must match exactly what you used in your template
  • Value: The string to replace the variable with
This will transform:
  • {{Name}}James Thomas
  • {{Year}}2026

Response

Generating Personalized Videos at Scale

The real power of template-based video creation is generating personalized videos for many recipients:

Common Use Cases

Personalized Greetings

Product Promotions

Event Invitations

Customer Onboarding

Best Practices

  • Keep variable names generic and reusable
  • Use placeholders that make sense for your use case
  • Test your template with different variable values to ensure proper text fitting
  • Consider text length limits when designing scenes with variables
  • Document all variables used in your template
  • Use consistent naming conventions across templates
  • Validate variable values before sending to API
  • Handle special characters appropriately in variable values
  • Use webhooks for notification when videos complete
  • Process videos in batches for large campaigns
  • Store job IDs for tracking and retrieval
  • Implement retry logic for failed jobs
  • Create test videos with sample data before mass generation
  • Verify all variables are replaced correctly
  • Check video quality and timing with different text lengths
  • Confirm the output meets your quality standards

Troubleshooting

Problem: Template variable appears as {{Name}} instead of the actual value.Solution:
  • Ensure the variable name in your variables object matches exactly (case-sensitive)
  • Check for typos in the variable name
  • Verify the variable exists in the template project
  • Make sure there are no extra spaces in the variable name
Problem: API returns an error about invalid template ID.Solution:
  • Verify you copied the complete project ID from the URL
  • Check that the project exists in your Pictory account
  • Ensure you are using the correct API key associated with the account
  • Confirm the project is accessible (not deleted or archived)
Problem: Replaced variable text is too long and gets cut off.Solution:
  • Design templates with maximum expected text length in mind
  • Use shorter variable values or abbreviations
  • Adjust font size in the template to accommodate longer text
  • Consider using multiple scenes for longer content
Problem: Video job remains in-progress for extended time.Solution:
  • Check the job status using the Get Job API
  • Verify your API subscription is active
  • Contact support if job is stuck for over 30 minutes
  • Retry with a new request if needed

Next Steps

Enhance your template-based workflows with these features:

Add Voice-Over

Add AI narration to your template videos

Apply Branding

Consistent brand styling across all generated videos

Background Music

Add background music to enhance your videos

Save Projects

Save generated videos as editable projects

API Reference

For complete technical details, see:

Create Storyboard Preview

Create preview from template

Render Storyboard Video

Render video directly from template

Get Job Status

Monitor video creation progress

Get Projects

List your template projects