Skip to content

URL to Video Pipeline

Fresh

Overview

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

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

PhaseErrorRecovery
Link creationURL not accessibleVerify URL is public, try with_params
Task creationInsufficient creditsCheck credits first, purchase more
PollingTimeoutIncrease timeout, check task status later
Pollingfailed statusRead failed_reason, adjust parameters
RenderPreview ID invalidRe-fetch task to get valid preview IDs
DownloadURL expiredRe-fetch task to get fresh output URL

Credit Cost Summary

PhaseCost
Create link0
Create task (direct)5/30s
Create task (preview)1/30s
Render4/30s
Total (preview + render)5/30s

See Also