Skip to content

Custom Template Pipeline

Fresh

Overview

The custom template pipeline lets you create branded, reusable video templates in the Creatify dashboard, then generate unlimited branded variations via API by swapping variables (product name, images, CTAs, etc.).

Pipeline Diagram

Detailed Sequence

Code Example: Template Video Generation

python
import requests

headers = {
    "X-API-ID": API_ID,
    "X-API-KEY": API_KEY,
    "Content-Type": "application/json"
}
BASE = "https://api.creatify.ai/api/custom_templates"

# Step 1: List templates
templates = requests.get(f"{BASE}/", headers=headers).json()
print(f"Available templates: {len(templates)}")
for t in templates:
    print(f"  {t['id']}: {t['name']}")

# Step 2: Get template details
template_id = templates[0]["id"]
details = requests.get(f"{BASE}/{template_id}/", headers=headers).json()
print(f"Variables: {details.get('variables', [])}")

# Step 3: Create job with variable values
job = requests.post(f"{BASE}/jobs/", headers=headers, json={
    "template_id": template_id,
    "variables": {
        "product_name": "Super Widget Pro",
        "tagline": "The future of productivity",
        "image_url": "https://example.com/product.jpg",
        "cta_text": "Shop Now - 20% Off"
    }
}).json()
print(f"Job created: {job['id']}")

# Step 4: Poll for preview
preview = poll_until_done(f"{BASE}/jobs/{job['id']}/", headers)

# Step 5: Render
requests.post(f"{BASE}/jobs/{job['id']}/render/", headers=headers)

# Step 6: Poll for final
final = poll_until_done(f"{BASE}/jobs/{job['id']}/", headers)
print(f"Final video: {final['output']}")

Batch Template Generation

Generate multiple branded videos from the same template with different variables:

python
products = [
    {"product_name": "Widget A", "tagline": "Fast and reliable", "cta_text": "Buy Now"},
    {"product_name": "Widget B", "tagline": "Smart and elegant", "cta_text": "Learn More"},
    {"product_name": "Widget C", "tagline": "Built to last", "cta_text": "Order Today"},
]

jobs = []
for product in products:
    product["image_url"] = f"https://example.com/{product['product_name'].lower().replace(' ', '-')}.jpg"
    job = requests.post(f"{BASE}/jobs/", headers=headers, json={
        "template_id": template_id,
        "variables": product
    }).json()
    jobs.append(job)
    print(f"Created job {job['id']} for {product['product_name']}")

# Poll all jobs
for job in jobs:
    result = poll_until_done(f"{BASE}/jobs/{job['id']}/", headers)
    print(f"Job {job['id']}: {result['status']}")

Template Variable Best Practices

Variable TypeExampleTips
Product nameproduct_nameKeep under 30 characters
TaglinetaglineShort, punchy, fits the template layout
Image URLimage_urlHigh resolution, publicly accessible
CTA textcta_textAction-oriented, under 20 characters
PricepriceInclude currency symbol
Brand logologo_urlPNG with transparency

Credit Cost

OperationCredits
List templates0
Get template details0
Create preview job1 per 30s
Render final video4 per 30s
Total per video5 per 30s

Error Handling

ErrorCauseRecovery
Template not foundInvalid template IDRe-fetch template list
Missing variableRequired variable not providedCheck template's variable schema
Invalid image URLURL not accessibleVerify URL returns 200
Render failureTemplate incompatible with variablesReview variable values match template expectations

See Also