Workflow

Overview

The Workflow API enables you to create sophisticated video transformations by applying multi-step processing pipelines to your images. Workflows automate complex video production tasks through predefined templates that handle multiple processing steps automatically.

How Workflows Work

  1. Upload Images - Provide one or more images as input
  2. Select Template - Choose a workflow template that defines the processing steps
  3. Configure Options - Customize template-specific options (backgrounds, prompts, motion types)
  4. Process - The workflow automatically executes all steps in sequence
  5. Get Results - Retrieve the final processed video and intermediate step results

Available Templates

Overlay Templates

overlay_gray_5443 (Recommended)

  • Creates overlay videos with grayscale background replacement
  • Includes upscaling for higher quality output
  • Best for: Professional product showcases, marketing videos

overlay_gray_5442

  • Basic overlay with grayscale background
  • Faster processing, lower quality than 5443
  • Best for: Quick previews, simple overlays

overlay_only_1025

  • Simple overlay without background processing
  • Requires pre-animated video input
  • Best for: Combining existing animations with backgrounds

Specialized Templates

vim_new_year_2026 - Transforms person into astronaut in microgravity scene vim_dancing_santa - Creates space jump scene with astronaut suit transformation vim_birthday - Simulates moonwalk on lunar surface with astronaut suit vim_instagramframeescape_0226 - Ceremonial flag planting on lunar surface vim_dreamcareer_0226 - Career transformation scenes vim_ces_show - Trade show presentations vim_amazonia - Nature and adventure scenes vim_arctic - Arctic exploration themes vim_sketch_me - Artistic sketch transformations vim_product_showcase - Product demonstration videos each_explodedloop_0226 - Exploded view animations each_ugcproduct_0226 - User-generated content product videos

Workflow Processing Steps

Each template follows a specific processing pipeline that may include:

  • Content cropping and alpha channel replacement
  • Image-to-image transformation
  • Background replacement
  • Face swapping
  • Video animation creation
  • Upscaling and enhancement
  • Video composition

Quick Start Example

import requests
import json
import time

BASE_URL = "https://api.vimmerse.net"
API_KEY = "YOUR_API_KEY"

# Step 1: Create workflow
url = f"{BASE_URL}/workflow"
headers = {"X-Api-Key": API_KEY}

# Prepare options for overlay video template
options = {
    "background_urls": "https://example.com/background1.mp4,https://example.com/background2.mp4",
    "prompt": "Person is joyfully smiling and walking backward while still looking forward.",
    "motion_type": "Auto"
}

payload = {
    "title": "My Workflow Video",
    "description": "Animated overlay video",
    "template_id": "overlay_gray_5443",
    "options": json.dumps(options),
    "visibility_status": "1",
    "image_urls": ["https://example.com/image.png"]
}

try:
    response = requests.post(url, headers=headers, data=payload, timeout=60)
    response.raise_for_status()

    result = response.json()
    workflow_data = result["data"]
    workflow_id = workflow_data["id"]

    print(f"✓ Workflow created! ID: {workflow_id}")
    print(f"  Status: {workflow_data['processing_status']}")

except requests.exceptions.RequestException as e:
    print(f"✗ Error creating workflow: {e}")
    exit(1)

# Step 2: Poll for completion
print("\nPolling for workflow completion...")
max_attempts = 120  # Maximum 60 minutes
attempt = 0
poll_interval = 30  # Check every 30 seconds

def get_workflow_status(workflow_id):
    """Retrieve the current status of a workflow."""
    url = f"{BASE_URL}/workflow/{workflow_id}"
    headers = {"X-Api-Key": API_KEY}

    try:
        response = requests.get(url, headers=headers, timeout=30)
        response.raise_for_status()
        return response.json()["data"]
    except requests.exceptions.RequestException as e:
        print(f"  Warning: Error retrieving status: {e}")
        return None

while attempt < max_attempts:
    workflow_data = get_workflow_status(workflow_id)

    if not workflow_data:
        print(f"  Attempt {attempt + 1}/{max_attempts}: Failed to retrieve status, retrying...")
        time.sleep(poll_interval)
        attempt += 1
        continue

    status = workflow_data.get("processing_status")
    progress = workflow_data.get("progress_percentage", 0)

    print(f"  Attempt {attempt + 1}/{max_attempts}: Status={status}, Progress={progress}%")

    if status == "success":
        results = workflow_data.get("result", [])
        if results:
            print(f"\n✓ Workflow completed successfully!")
            for result_item in results:
                video_url = result_item.get("url")
                content_type = result_item.get("content_type")
                print(f"  Result: {content_type} - {video_url}")
        break
    elif status == "fail":
        print(f"\n✗ Workflow processing failed.")
        print(f"  Workflow ID: {workflow_id}")
        exit(1)

    time.sleep(poll_interval)
    attempt += 1

if attempt >= max_attempts:
    print(f"\n⚠ Timeout: Workflow processing is taking longer than expected.")
    print(f"  Workflow ID: {workflow_id}")
    print(f"  Please check the status later using: GET {BASE_URL}/workflow/{workflow_id}")

Webhook Integration

Instead of polling, you can configure a webhook URL to receive notifications when workflow processing completes.

Setting Up Webhooks

Include the webhook_url parameter when creating a workflow (if supported by the template):

payload = {
    "template_id": "overlay_gray_5443",
    "options": json.dumps(options),
    "webhook_url": "https://your-domain.com/api/webhooks/workflow-complete",
    # ... other parameters
}

Note: Webhook support varies by template. Check template-specific documentation for webhook availability.

Create Workflow

SecurityAPIKeyHeader
Request
Request Body schema: multipart/form-data
title
string (Title)
Default: ""
description
string (Description)
Default: ""
visibility_status
string (Visibility Status)
Default: "1"

Visibility Status:

Value Status
"0" Private
"1" Unlisted
"2" Public
image_files
Array of strings <binary> (Image Files)
Default: []

Images to upload. ...

image_urls
Array of strings (Image URLs)
Default: []

If you upload image files, this field will be ignored.

template_id
string (Template ID)
Default: "overlay_gray_5443"

Template ID of the workflow. ...

options
string (Options)
Default: "{}"

Json string of options

event_id
string (Event ID)
Default: "no_event"

Event ID of the workflow. ..

Responses
200

New Media

402

Insufficient Credit

404

Not Found

422

Validation Error

post/workflow
Request samples
Response samples
application/json
{}

Get Workflow Status

SecurityAPIKeyHeader
Responses
200

Workflow Object

404

Not Found

422

Validation Error

get/workflow/{workflow_id}
Request samples
Response samples
application/json
{}

Update Workflow

Update a workflow. You can update one or more of the following fields:

  • title: Workflow title
  • description: Workflow description
  • visibility_status: Visibility status ("0" for private, "1" for unlisted, "2" for public)
  • rating: Rating value (string)
  • delivered_at: Timestamp for when workflow was delivered (if None or not provided, current timestamp will be used when setting delivered_at)
SecurityAPIKeyHeader
Request
Request Body schema: application/json
required
property name*
additional property
any
Responses
200

Updated Workflow Object

400

Bad Request

404

Not Found

422

Validation Error

put/workflow/{workflow_id}
Request samples
Response samples
application/json
{}

Delete Workflow

Delete a workflow and its associated S3 files.

SecurityAPIKeyHeader
Responses
200

Deleted Workflow Object

404

Not Found

422

Validation Error

delete/workflow/{workflow_id}
Request samples
Response samples
application/json
{}

Log Customer Script Error

Log customer script errors to S3. Errors are organized by customer_id and weekly period. Logs reset every week, with all errors for a week stored in a single file.

Request body should contain:

  • error_message (required): Error message from customer script
  • context (optional): Additional context information (e.g., workflow_id, script_name, etc.)
SecurityAPIKeyHeader
Request
Request Body schema: application/json
required
property name*
additional property
any
Responses
200

Error logged successfully

400

Bad Request

422

Validation Error

post/workflow/error-log
Request samples
Response samples
application/json
{}