tasks

Create a video indexing task

Changed on

<Info>This method will be removed in a future version. New implementations should use direct or multipart uploads followed by separate indexing.</Info>

This method creates a video indexing task that uploads and indexes a video in a single operation.

<Note title="Adding videos to existing indexes"> You can no longer add videos to an index that has only Pegasus 1.2 enabled. When you add videos to an index that has both Marengo and Pegasus 1.2 enabled, the platform indexes them with Marengo only. </Note>

Upload options:

  • Local file: Use the video_file parameter.
  • Publicly accessible URL: Use the video_url parameter.

Your videos must meet requirements based on your workflow:

  • Search: Marengo requirements.
  • Video analysis: Pegasus requirements.
  • If you want to both search and analyze your videos, the most restrictive requirements apply.
  • This method allows you to upload files up to 2 GB in size. To upload larger files, use the Multipart Upload API

Indexes have limits on video hours and video count. For details, see the Video hours and video count limits section.

<Note title="Note"> This endpoint is rate-limited. For details, see the [Rate limits](/v1.3/docs/get-started/rate-limits) page. </Note>
post/tasks

Request

  • Base URL: https://api.twelvelabs.io/v1.3
  • URL: https://api.twelvelabs.io/v1.3/tasks
  • Auth: API key in header x-api-key

Request body multipart/form-data

index_idstring required

The unique identifier of the index to which the video is being uploaded.

video_filestring binary

Specify this parameter to upload a video from your local file system.

video_urlstring

Specify this parameter to upload a video from a publicly accessible URL.

enable_video_streamboolean

This parameter indicates if the platform stores the video for streaming. When set to true, the platform stores the video, and you can retrieve its URL by calling the GET method of the /indexes/{index-id}/videos/{video-id} endpoint. You can then use this URL to access the stream over the <a href="https://en.wikipedia.org/wiki/HTTP_Live_Streaming" target="_blank">HLS</a> protocol.

user_metadatastring

Metadata that helps you categorize your videos. You can specify a list of keys and values. Keys are strings, and values can be a string, a number, a boolean, or an array of strings. Send an integer wider than 53 bits (-9007199254740991 to 9007199254740991), and any identifier you want preserved verbatim, as a string. Send this value as a JSON-encoded string.

Response

A video indexing task has successfully been created.

_idstring

A string representing the unique identifier of your video indexing task.

video_idstring

A string representing the unique identifier of the video associated with the specified video indexing task.

Changes