Tasks
Introduction
Tasks let you do powerful things with your media files, in just a few lines of code.
The input to a task can be:
- Any of the Files in your ittybit project
- Any publicly-accessible (or signed) URL, no matter where it's hosted
Tasks output new files, which can be:
How tasks work
Tasks take either a file_id
or a url
as input, plus a kind
prop to describe which output file will be created.
That's all that's needed for some tasks!
e.g. to transcribe a video:
Task objects
When a task is created, it returns a 201 Created
response containing a task
object.
This object contains information about the task, including the id
, status
, and created
timestamp.
Task progress
Tasks are sent to a queue and processed asynchronously.
You can use the task's id
to poll the task endpoint for updates until the task is complete:
A completed task will have a status
of completed
, and a output
object containing the details of the created file.
See the Task API docs for complete examples, and to try the API yourself.
In production apps with many tasks, it's recommended you use Webhooks to get notified when a task is complete. Polling for updates may hit API rate limits.
Required props
All tasks require:
- either a
file_id
orurl
to use as the input file - the
kind
of task to create
File ID
The file_id
should be the unique ID of a file in your project's Files collection.
e.g. "file_id": "file_abcdefgh1234"
URL
The url
should be the URL of the video file to process.
This should be a publicly accessible or signed URL.
e.g. "url": "https://example.com/video.mp4"
Kind
The kind of file to create. This should be one of ittybit's available task kinds.
e.g. "kind": "video"
Shared options
All tasks support the following (optional) props:
ref
folder
filename
Ref
The reference name for the file.
When set, the output file will be included in the Media Object's urls
object, with the ref
as the key.
e.g. "ref": "avatar"
Folder
The folder to save the output file to.
When set, the output file will be added to the specified folder and the delivery URL will include the folder in the path.
e.g. "folder": "uploads/user123"
Filename
The filename to save the output file to.
When set, the output file will be saved with the specified filename and the delivery URL will include the filename in the path.
e.g. "filename": "user123-profile-20250101.jpg"
You can also use the filename
option in combination with the folder
option to save the output file to a specific path.
If multiple files have the same path, only the most recently updated file will be returned by the delivery URL.
Task options
Different task kinds have different (optional) props that can be used to control the output.
For example, the speech
task kind has a speakers
(boolean
) prop that can be used to control whether the output should identify and label separate speakers (known as "diarization").
The video
task kind has width
and height
(and many other) props that can be used to control the output video size.
See the individual task kind docs (below) for more information on the available options.
Task kinds
Sources
Sources are files that contain actual content, such as video, audio, or image data.
Video
Image
Audio
Tracks
Tracks provide additional information about your media, such as subtitles, chapters, and thumbnails.
Subtitles
Chapters
Thumbnails
Intelligence
Intelligence files contain rich data about your media, such as transcripts, descriptions, and NSFW detection.