Workflows
Overview
A workflow defines the sequence of tasks that will be executed. Workflows are used in both Runs (via POST /runs) and Automations (as the workflow array).
Each step in the workflow represents a task — such as transcoding video, generating subtitles, or analyzing content.
Structure
A workflow is an array of task definitions. Each task includes:
| Property | Description |
|---|---|
kind | The type of task (e.g. video, image, summary, subtitles, speech) |
options | Task-specific options (e.g. format, width, height, quality) |
metadata | Optional key-value pairs to attach to the task (e.g. { "ref": "poster" }) |
next | An optional array of tasks to run after this task completes |
Parallel execution
Tasks at the same level in the array run in parallel:
All three tasks start at the same time.
Sequential chaining
Use the next field to run tasks after a parent task completes:
Here the video transcode runs first, then the thumbnail and subtitles are generated from the output in parallel.
Conditional branches
Use the conditions kind to conditionally run tasks based on input file properties:
Conditions evaluate properties of the input file using operator-as-key syntax:
| Operator | Description | Example |
|---|---|---|
eq | Equal to | { "kind": { "eq": "video" } } |
not | Not equal to | { "kind": { "not": "audio" } } |
gt | Greater than | { "width": { "gt": 1920 } } |
gte | Greater than or equal | { "duration": { "gte": 60 } } |
lt | Less than | { "filesize": { "lt": 10000000 } } |
lte | Less than or equal | { "height": { "lte": 720 } } |
in | Value is in array | { "format": { "in": ["mp4", "webm"] } } |
startsWith | String starts with | { "mimetype": { "startsWith": "video/" } } |
endsWith | String ends with | { "filename": { "endsWith": ".mp4" } } |
Complete example
This automation:
- Generates a summary and transcribes speech for all uploads (in parallel)
- For video files only: creates a 720p version, then extracts a thumbnail from it
- For video files only: generates subtitles, chapters, and thumbnails in parallel