URL to Video Pipeline
FreshOverview
The complete end-to-end pipeline for converting a webpage URL into a finished video ad. This is the most common Creatify workflow.
Full Pipeline Diagram
Phase Breakdown
Phase 1: Create Link (0 credits)
The link object scrapes the target URL and extracts:
- Page title
- Meta description
- Product images
- Price information (if available)
python
import requests
headers = {
"X-API-ID": API_ID,
"X-API-KEY": API_KEY,
"Content-Type": "application/json"
}
# Create link
link = requests.post(
"https://api.creatify.ai/api/links/",
headers=headers,
json={"url": "https://example.com/product"}
).json()
link_id = link["id"]
print(f"Link created: {link_id}")
print(f"Title: {link['title']}")
print(f"Media: {len(link['media'])} images found")TIP
If the scraped data is incomplete, use POST /api/links/with_params/ to manually provide title, description, and media URLs.
Phase 2: Create Video Task (5 credits/30s or 1 credit/30s preview)
python
# Create URL-to-video task
task = requests.post(
"https://api.creatify.ai/api/url_to_videos/",
headers=headers,
json={
"link_id": link_id,
"aspect_ratio": "9:16"
}
).json()
task_id = task["id"]
print(f"Task created: {task_id}")Phase 3: Poll for Completion
python
import time
def poll_task(task_id, max_wait=600, interval=10):
"""Poll a task until done or failed. Max wait: 10 minutes."""
elapsed = 0
while elapsed < max_wait:
result = requests.get(
f"https://api.creatify.ai/api/url_to_videos/{task_id}/",
headers=headers
).json()
status = result["status"]
print(f" Status: {status} ({elapsed}s elapsed)")
if status == "done":
return result
elif status == "failed":
raise Exception(f"Task failed: {result.get('failed_reason')}")
time.sleep(interval)
elapsed += interval
raise TimeoutError(f"Task {task_id} did not complete within {max_wait}s")
result = poll_task(task_id)Phase 4-5: Preview Selection and Render (4 credits/30s)
python
# Get previews
previews = result.get("previews", [])
if previews:
selected_preview = previews[0]["id"]
# Render selected preview
render = requests.post(
f"https://api.creatify.ai/api/url_to_videos/{task_id}/render/",
headers=headers,
json={"preview_id": selected_preview}
).json()
# Poll render
final = poll_task(task_id)
print(f"Final video: {final['output']}")Phase 6-7: Download Output
python
# Download the final video
video_url = final["output"]
video_data = requests.get(video_url).content
with open("output.mp4", "wb") as f:
f.write(video_data)
print("Video saved to output.mp4")Error Handling at Each Phase
| Phase | Error | Recovery |
|---|---|---|
| Link creation | URL not accessible | Verify URL is public, try with_params |
| Task creation | Insufficient credits | Check credits first, purchase more |
| Polling | Timeout | Increase timeout, check task status later |
| Polling | failed status | Read failed_reason, adjust parameters |
| Render | Preview ID invalid | Re-fetch task to get valid preview IDs |
| Download | URL expired | Re-fetch task to get fresh output URL |
Credit Cost Summary
| Phase | Cost |
|---|---|
| Create link | 0 |
| Create task (direct) | 5/30s |
| Create task (preview) | 1/30s |
| Render | 4/30s |
| Total (preview + render) | 5/30s |
See Also
- URL to Video SOP -- Step-by-step procedure
- Preview and Render Flow -- The preview pattern in detail
- Batch Production -- Run multiple pipelines in parallel