Workflow

Overview

Workflow APIs allow you to create sophisticated video transformations by applying multi-step processing pipelines to your images.

There are several workflow templates available:

Astronaut/Space Theme Templates:

  • sch_microgravity_1025 - Transforms person into astronaut in microgravity scene
  • sch_spacejump_1025 - Creates space jump scene with astronaut suit transformation
  • sch_moonwalk_1025 - Simulates moonwalk on lunar surface with astronaut suit
  • sch_raiseflag_1025 - Ceremonial flag planting on lunar surface

Each template follows a specific processing pipeline with steps like:

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

Create Workflow

Example: Create Overlay Video

import requests
import json

BASE_URL = 'https://api.vimmerse.net'
url = f"{BASE_URL}/workflow"

headers = {
    'X-Api-Key': 'YOUR_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"
}

# If uploading image files
files = {
    'image_files': ('image.png', open('path/to/image.png', 'rb'), 'image/png')
}

# Or provide image URLs
payload["image_urls"] = ["https://example.com/image.png"]

try:
    response = requests.post(url, headers=headers, data=payload, files=files)
    print(response.text)

    response_data = response.json()
    workflow_data = response_data['data']
    workflow_id = workflow_data.get("id")
    print(f"Workflow created with ID: {workflow_id}")

except Exception as e:
    print(f"Workflow creation failed: {e}")

Poll for Completion

import time

while True:
    response = requests.get(f"{BASE_URL}/workflow/{workflow_id}", headers=headers)
    workflow_data = response.json().get('data')

    processing_status = workflow_data.get("processing_status")
    progress_percentage = workflow_data.get("progress_percentage")

    print(f"Status: {processing_status}, Progress: {progress_percentage}%")

    if processing_status in ['success', 'fail']:
        break

    time.sleep(20)  # Wait before checking again

# Download results when complete
if processing_status == 'success':
    for result_item in workflow_data.get('result', []):
        video_url = result_item['url']
        print(f"Download video from: {video_url}")

Available Templates

Overlay Templates

overlay_gray_5442 - Basic overlay with grayscale background

{
    "template_id": "overlay_gray_5442",
    "options": {
        "background_urls": "video1.mp4,video2.mp4",
        "prompt": "Describe the motion",
        "motion_type": "Auto"
    }
}

overlay_gray_5443 - Overlay with upscaling (recommended)

{
    "template_id": "overlay_gray_5443",
    "options": {
        "background_urls": "video1.mp4",
        "prompt": "Person walking forward smiling",
        "motion_type": "Auto"
    }
}

overlay_only_1025 - Simple overlay

{
    "template_id": "overlay_only_1025",
    "options": {
        "video_urls": "already-animated.mp4",
        "background_urls": "background1.mp4,background2.mp4"
    }
}

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

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
{}

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
{}