Custom Template Pipeline
FreshOverview
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 Type | Example | Tips |
|---|---|---|
| Product name | product_name | Keep under 30 characters |
| Tagline | tagline | Short, punchy, fits the template layout |
| Image URL | image_url | High resolution, publicly accessible |
| CTA text | cta_text | Action-oriented, under 20 characters |
| Price | price | Include currency symbol |
| Brand logo | logo_url | PNG with transparency |
Credit Cost
| Operation | Credits |
|---|---|
| List templates | 0 |
| Get template details | 0 |
| Create preview job | 1 per 30s |
| Render final video | 4 per 30s |
| Total per video | 5 per 30s |
Error Handling
| Error | Cause | Recovery |
|---|---|---|
| Template not found | Invalid template ID | Re-fetch template list |
| Missing variable | Required variable not provided | Check template's variable schema |
| Invalid image URL | URL not accessible | Verify URL returns 200 |
| Render failure | Template incompatible with variables | Review variable values match template expectations |
See Also
- Custom Templates SOP -- Step-by-step procedure
- Batch Production -- Scale template videos
- URL to Video Pipeline -- Alternative without templates