Get Template by ID
curl --request GET \
--url https://api.pictory.ai/pictoryapis/v1/templates/{templateId} \
--header 'Authorization: <authorization>'import requests
url = "https://api.pictory.ai/pictoryapis/v1/templates/{templateId}"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.pictory.ai/pictoryapis/v1/templates/{templateId}', 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.pictory.ai/pictoryapis/v1/templates/{templateId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pictory.ai/pictoryapis/v1/templates/{templateId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.pictory.ai/pictoryapis/v1/templates/{templateId}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pictory.ai/pictoryapis/v1/templates/{templateId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"templateId": "202512230204424435786014d42904bbc95813430789fe736",
"name": "Hello World Template",
"language": "en",
"published": true,
"depricated": false,
"backgroundMusic": {
"enabled": true,
"musicUrl": "https://tracks.melod.ie/track_versions/71/MEL106_09_1_Raw_Power_%28Full%29_Stefano_Mastronardi_stream.mp3",
"volume": 0.1
},
"voiceOver": {
"enabled": true,
"aiVoices": [
{
"speaker": "3108",
"speed": 100,
"amplificationLevel": 0
}
]
},
"scenes": [
{
"sceneId": "20251222191719950af11290d66804b7f97cad70cde355bcc",
"subtitles": [
{
"text": "Hi {{Name}}, how are you doing today?"
}
],
"layers": [
[
{
"layerId": "2025122211203035206c45618d2c74013a7022de479df95f2",
"type": "text",
"text": "Hello"
}
]
]
}
],
"variables": {
"Name": "NAME"
},
"schemaVersion": "v3",
"project": "https://projects-prod.s3.us-east-2.amazonaws.com/project_templates/teams/aa46778d-7965-46e0-967d-b48ee5d6ead9/202512230204424435786014d42904bbc95813430789fe736.json",
"structure": "https://projects-prod.s3.us-east-2.amazonaws.com/project_template_structures/teams/aa46778d-7965-46e0-967d-b48ee5d6ead9/202512230204424435786014d42904bbc95813430789fe736.json"
}
{
"message": "Unauthorized"
}
{
"message": "Template not found"
}
{
"code": "INVALID_REQUEST",
"message": "Invalid template ID"
}
Video Templates
Get Template by ID
Retrieve detailed information about a specific video template using its unique identifier
GET
/
pictoryapis
/
v1
/
templates
/
{templateId}
Get Template by ID
curl --request GET \
--url https://api.pictory.ai/pictoryapis/v1/templates/{templateId} \
--header 'Authorization: <authorization>'import requests
url = "https://api.pictory.ai/pictoryapis/v1/templates/{templateId}"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.pictory.ai/pictoryapis/v1/templates/{templateId}', 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.pictory.ai/pictoryapis/v1/templates/{templateId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pictory.ai/pictoryapis/v1/templates/{templateId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.pictory.ai/pictoryapis/v1/templates/{templateId}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pictory.ai/pictoryapis/v1/templates/{templateId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"templateId": "202512230204424435786014d42904bbc95813430789fe736",
"name": "Hello World Template",
"language": "en",
"published": true,
"depricated": false,
"backgroundMusic": {
"enabled": true,
"musicUrl": "https://tracks.melod.ie/track_versions/71/MEL106_09_1_Raw_Power_%28Full%29_Stefano_Mastronardi_stream.mp3",
"volume": 0.1
},
"voiceOver": {
"enabled": true,
"aiVoices": [
{
"speaker": "3108",
"speed": 100,
"amplificationLevel": 0
}
]
},
"scenes": [
{
"sceneId": "20251222191719950af11290d66804b7f97cad70cde355bcc",
"subtitles": [
{
"text": "Hi {{Name}}, how are you doing today?"
}
],
"layers": [
[
{
"layerId": "2025122211203035206c45618d2c74013a7022de479df95f2",
"type": "text",
"text": "Hello"
}
]
]
}
],
"variables": {
"Name": "NAME"
},
"schemaVersion": "v3",
"project": "https://projects-prod.s3.us-east-2.amazonaws.com/project_templates/teams/aa46778d-7965-46e0-967d-b48ee5d6ead9/202512230204424435786014d42904bbc95813430789fe736.json",
"structure": "https://projects-prod.s3.us-east-2.amazonaws.com/project_template_structures/teams/aa46778d-7965-46e0-967d-b48ee5d6ead9/202512230204424435786014d42904bbc95813430789fe736.json"
}
{
"message": "Unauthorized"
}
{
"message": "Template not found"
}
{
"code": "INVALID_REQUEST",
"message": "Invalid template ID"
}
Overview
Retrieve comprehensive details about a specific video template using its unique identifier. This endpoint returns the complete template configuration, including scene structure, variables, voice-over settings, background music, and S3 storage URLs for project files.You need a valid API key to use this endpoint. Get your API key from the API Access page in your Pictory dashboard.
API Endpoint
GET https://api.pictory.ai/pictoryapis/v1/templates/{templateId}
Request Parameters
Path Parameters
string
required
The unique identifier of the template to retrieveExample:
202512230204424435786014d42904bbc95813430789fe736Headers
string
required
API key for authentication (starts with
pictai_)Authorization: YOUR_API_KEY
Response
The response contains detailed template information including configuration, scenes, variables, and media settings.string
Unique identifier for the template
string
Name of the template
string
Language code of the template (e.g.,
en for English)boolean
Indicates whether the template is published and available for use
boolean
Indicates whether the template has been deprecated (note: API uses “depricated” spelling)
object
object
array of objects
Array of scene objects that define the template structure
Show scene object
Show scene object
string
Unique identifier for the scene
array of objects
Subtitle configurations for the scene
Show subtitle object
Show subtitle object
string
Subtitle text, may include template variables in
{{variableName}} formatobject
Template variables that can be customized when creating videos from this template. Keys are variable names, values are default values or placeholders.Example:
{"Name": "NAME", "Company": "COMPANY_NAME"}string
Template schema version (e.g.,
v2, v3)string
S3 URL to the complete project template JSON file
string
S3 URL to the project template structure JSON file
Response Examples
{
"templateId": "202512230204424435786014d42904bbc95813430789fe736",
"name": "Hello World Template",
"language": "en",
"published": true,
"depricated": false,
"backgroundMusic": {
"enabled": true,
"musicUrl": "https://tracks.melod.ie/track_versions/71/MEL106_09_1_Raw_Power_%28Full%29_Stefano_Mastronardi_stream.mp3",
"volume": 0.1
},
"voiceOver": {
"enabled": true,
"aiVoices": [
{
"speaker": "3108",
"speed": 100,
"amplificationLevel": 0
}
]
},
"scenes": [
{
"sceneId": "20251222191719950af11290d66804b7f97cad70cde355bcc",
"subtitles": [
{
"text": "Hi {{Name}}, how are you doing today?"
}
],
"layers": [
[
{
"layerId": "2025122211203035206c45618d2c74013a7022de479df95f2",
"type": "text",
"text": "Hello"
}
]
]
}
],
"variables": {
"Name": "NAME"
},
"schemaVersion": "v3",
"project": "https://projects-prod.s3.us-east-2.amazonaws.com/project_templates/teams/aa46778d-7965-46e0-967d-b48ee5d6ead9/202512230204424435786014d42904bbc95813430789fe736.json",
"structure": "https://projects-prod.s3.us-east-2.amazonaws.com/project_template_structures/teams/aa46778d-7965-46e0-967d-b48ee5d6ead9/202512230204424435786014d42904bbc95813430789fe736.json"
}
{
"message": "Unauthorized"
}
{
"message": "Template not found"
}
{
"code": "INVALID_REQUEST",
"message": "Invalid template ID"
}
Code Examples
Replace
YOUR_API_KEY with your actual API key that starts with pictai_curl --request GET \
--url 'https://api.pictory.ai/pictoryapis/v1/templates/YOUR_TEMPLATE_ID' \
--header 'Authorization: YOUR_API_KEY' \
--header 'accept: application/json' | python -m json.tool
import requests
template_id = "202512230204424435786014d42904bbc95813430789fe736"
url = f"https://api.pictory.ai/pictoryapis/v1/templates/{template_id}"
headers = {
"Authorization": "YOUR_API_KEY",
"accept": "application/json"
}
response = requests.get(url, headers=headers)
template = response.json()
# Print template information
print(f"Template: {template['name']}")
print(f" ID: {template['templateId']}")
print(f" Language: {template['language']}")
print(f" Published: {template['published']}")
print(f" Schema Version: {template['schemaVersion']}")
print(f" Variables: {list(template.get('variables', {}).keys())}")
print(f" Scenes: {len(template['scenes'])}")
const templateId = '202512230204424435786014d42904bbc95813430789fe736';
const response = await fetch(
`https://api.pictory.ai/pictoryapis/v1/templates/${templateId}`,
{
method: 'GET',
headers: {
'Authorization': 'YOUR_API_KEY',
'accept': 'application/json'
}
}
);
const template = await response.json();
// Print template information
console.log(`Template: ${template.name}`);
console.log(` ID: ${template.templateId}`);
console.log(` Language: ${template.language}`);
console.log(` Published: ${template.published}`);
console.log(` Schema Version: ${template.schemaVersion}`);
console.log(` Variables: ${Object.keys(template.variables || {}).join(', ')}`);
console.log(` Scenes: ${template.scenes.length}`);
Usage Notes
Use this endpoint to retrieve template details before using it to create videos or before updating the template configuration.
Template Variables: The
variables object shows all customizable placeholders in the template. These can be replaced with actual values when creating videos from the template.S3 URLs: The
project and structure URLs point to S3 storage containing the complete template configuration and structure data.Common Use Cases
1. Retrieve Template Details
Get complete information about a specific template:import requests
def get_template_details(template_id, api_key):
"""
Retrieve detailed information about a template
"""
url = f"https://api.pictory.ai/pictoryapis/v1/templates/{template_id}"
headers = {"Authorization": api_key}
response = requests.get(url, headers=headers)
if response.status_code == 200:
template = response.json()
print(f"Template: {template['name']}")
print(f"Language: {template['language']}")
print(f"Schema: {template['schemaVersion']}")
print(f"\nSettings:")
print(f" Background Music: {'Enabled' if template.get('backgroundMusic', {}).get('enabled') else 'Disabled'}")
print(f" Voice Over: {'Enabled' if template.get('voiceOver', {}).get('enabled') else 'Disabled'}")
print(f"\nStructure:")
print(f" Scenes: {len(template['scenes'])}")
print(f" Variables: {', '.join(template.get('variables', {}).keys())}")
return template
else:
print(f"Error: {response.status_code}")
return None
# Example usage
template = get_template_details("YOUR_TEMPLATE_ID", "YOUR_API_KEY")
2. Extract Template Variables
Identify all customizable variables in a template:async function getTemplateVariables(templateId, apiKey) {
const response = await fetch(
`https://api.pictory.ai/pictoryapis/v1/templates/${templateId}`,
{
headers: { 'Authorization': `${apiKey}` }
}
);
const template = await response.json();
// Extract variables from template
const variables = template.variables || {};
console.log(`Template: ${template.name}`);
console.log(`\nCustomizable Variables:`);
Object.entries(variables).forEach(([key, defaultValue]) => {
console.log(` - ${key}: ${defaultValue}`);
});
// Also check for variables in subtitles
const subtitleVariables = new Set();
template.scenes.forEach(scene => {
scene.subtitles?.forEach(subtitle => {
const matches = subtitle.text.match(/\{\{(\w+)\}\}/g);
if (matches) {
matches.forEach(match => {
const varName = match.replace(/\{\{|\}\}/g, '');
subtitleVariables.add(varName);
});
}
});
});
console.log(`\nVariables used in subtitles:`);
subtitleVariables.forEach(v => console.log(` - ${v}`));
return {
defined: variables,
usedInSubtitles: Array.from(subtitleVariables)
};
}
// Example usage
const vars = await getTemplateVariables('YOUR_TEMPLATE_ID', 'YOUR_API_KEY');
3. Analyze Template Structure
Analyze and report on template structure:import requests
def analyze_template_structure(template_id, api_key):
"""
Analyze template structure and generate report
"""
url = f"https://api.pictory.ai/pictoryapis/v1/templates/{template_id}"
headers = {"Authorization": api_key}
response = requests.get(url, headers=headers)
template = response.json()
# Analyze structure
analysis = {
'name': template['name'],
'language': template['language'],
'schema_version': template['schemaVersion'],
'total_scenes': len(template['scenes']),
'has_background_music': template.get('backgroundMusic', {}).get('enabled', False),
'has_voice_over': template.get('voiceOver', {}).get('enabled', False),
'variables': list(template.get('variables', {}).keys()),
'scene_details': []
}
# Analyze each scene
for i, scene in enumerate(template['scenes'], 1):
scene_info = {
'scene_number': i,
'scene_id': scene['sceneId'],
'subtitle_count': len(scene.get('subtitles', [])),
'layer_count': sum(len(layer_group) for layer_group in scene.get('layers', []))
}
analysis['scene_details'].append(scene_info)
# Print report
print(f"=== Template Analysis: {analysis['name']} ===\n")
print(f"Language: {analysis['language']}")
print(f"Schema: {analysis['schema_version']}")
print(f"Total Scenes: {analysis['total_scenes']}")
print(f"Background Music: {'Yes' if analysis['has_background_music'] else 'No'}")
print(f"Voice Over: {'Yes' if analysis['has_voice_over'] else 'No'}")
print(f"Variables: {', '.join(analysis['variables']) if analysis['variables'] else 'None'}")
print(f"\nScene Breakdown:")
for scene in analysis['scene_details']:
print(f" Scene {scene['scene_number']}:")
print(f" Subtitles: {scene['subtitle_count']}")
print(f" Layers: {scene['layer_count']}")
return analysis
# Example usage
analysis = analyze_template_structure("YOUR_TEMPLATE_ID", "YOUR_API_KEY")
4. Compare Template Versions
Compare two template versions:import requests
def compare_templates(template_id_1, template_id_2, api_key):
"""
Compare two templates and identify differences
"""
headers = {"Authorization": api_key}
url = "https://api.pictory.ai/pictoryapis/v1/templates/"
# Fetch both templates
template1 = requests.get(f"{url}{template_id_1}", headers=headers).json()
template2 = requests.get(f"{url}{template_id_2}", headers=headers).json()
differences = []
# Compare basic properties
if template1['name'] != template2['name']:
differences.append(f"Name: '{template1['name']}' vs '{template2['name']}'")
if template1['language'] != template2['language']:
differences.append(f"Language: '{template1['language']}' vs '{template2['language']}'")
if len(template1['scenes']) != len(template2['scenes']):
differences.append(f"Scene count: {len(template1['scenes'])} vs {len(template2['scenes'])}")
# Compare variables
vars1 = set(template1.get('variables', {}).keys())
vars2 = set(template2.get('variables', {}).keys())
if vars1 != vars2:
added = vars2 - vars1
removed = vars1 - vars2
if added:
differences.append(f"Variables added: {', '.join(added)}")
if removed:
differences.append(f"Variables removed: {', '.join(removed)}")
# Print comparison
print(f"=== Template Comparison ===")
print(f"Template 1: {template1['name']} ({template_id_1})")
print(f"Template 2: {template2['name']} ({template_id_2})")
if differences:
print(f"\nDifferences found:")
for diff in differences:
print(f" - {diff}")
else:
print("\nNo significant differences found")
return differences
# Example usage
compare_templates("TEMPLATE_ID_1", "TEMPLATE_ID_2", "YOUR_API_KEY")
5. Download Template Configuration
Download and save complete template configuration:async function downloadTemplateConfiguration(templateId, apiKey) {
const response = await fetch(
`https://api.pictory.ai/pictoryapis/v1/templates/${templateId}`,
{
headers: { 'Authorization': `${apiKey}` }
}
);
const template = await response.json();
// Create backup object
const backup = {
exportDate: new Date().toISOString(),
templateData: template
};
// In Node.js, save to file
const fs = require('fs');
const filename = `template_${templateId}_${Date.now()}.json`;
fs.writeFileSync(filename, JSON.stringify(backup, null, 2));
console.log(`Template configuration saved to ${filename}`);
// Also download project and structure files if needed
if (template.project) {
console.log(`Project URL: ${template.project}`);
}
if (template.structure) {
console.log(`Structure URL: ${template.structure}`);
}
return backup;
}
// Example usage
await downloadTemplateConfiguration('YOUR_TEMPLATE_ID', 'YOUR_API_KEY');
6. Validate Template Before Use
Validate template configuration before creating videos:import requests
def validate_template(template_id, api_key):
"""
Validate template before using it to create videos
"""
url = f"https://api.pictory.ai/pictoryapis/v1/templates/{template_id}"
headers = {"Authorization": api_key}
try:
response = requests.get(url, headers=headers)
if response.status_code != 200:
return False, f"Failed to fetch template: {response.status_code}"
template = response.json()
# Validation checks
issues = []
# Check if published
if not template.get('published'):
issues.append("Template is not published")
# Check if deprecated
if template.get('depricated'):
issues.append("Template is deprecated")
# Check for scenes
if not template.get('scenes'):
issues.append("Template has no scenes")
# Check for empty variables
variables = template.get('variables', {})
if variables and any(not v for v in variables.values()):
issues.append("Template has empty variable placeholders")
# Report results
if issues:
print(f"Template validation failed:")
for issue in issues:
print(f" ✗ {issue}")
return False, issues
else:
print(f"✓ Template '{template['name']}' is valid and ready to use")
return True, None
except Exception as e:
return False, f"Error validating template: {str(e)}"
# Example usage
is_valid, issues = validate_template("YOUR_TEMPLATE_ID", "YOUR_API_KEY")
Best Practices
Template Inspection
- Retrieve Before Update: Always fetch the template details before updating to understand the current structure
- Validate Configuration: Check that the template is published and not deprecated before using it
- Understand Variables: Review all variables and their default values before creating videos
- Check Schema Version: Be aware of the schema version as it affects available features
Performance Tips
- Cache template details locally to reduce API calls
- Only fetch template details when needed (e.g., before creating videos or updating)
- Use the template list endpoint to get basic info, then fetch details only for selected templates
- Store frequently used template configurations locally
Related Endpoints
- Get Templates - List all available templates
- Update Template - Modify template configuration
- Create Template - Create a new template
Was this page helpful?
