multipartUpload

Create a multipart upload session

Changed on

This method creates a multipart upload session for a local file.

Supported content: Video, audio, and images.

Upload limits:

  • Video and audio: Up to 10 GB
  • Images: Up to 32 MB

Additional requirements depend on your workflow:

  • Search: Marengo requirements
  • Video analysis: Pegasus requirements
  • Entity search: Marengo image requirements
  • Create embeddings: Marengo requirements
post/assets/multipart-uploads

Request

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

Request body

filenamestring required

The original file name of the asset.

type'video' | 'audio' | 'image' required

The type of asset you want to upload.

total_sizeinteger required

The total size of the file in bytes. The platform uses this value to:

  • Calculate the optimal chunk size.
  • Determine the total number of chunks required
  • Generate the initial set of presigned URLs

Upload limits:

  • Video and audio: Up to 10 GB
  • Images: Up to 32 MB
enable_hlsboolean

When set to true, the platform generates an HLS playlist and segments for streaming. Applicable to video and audio assets only. The platform ignores this flag for other asset types.

Default: false.

enable_thumbnailboolean

When set to true, the platform generates thumbnail images from the uploaded content.

Default: false.

user_metadataUserMetadata

Metadata that helps you categorize your assets. The object contains user-defined keys and values, where keys are strings. Each value is 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.

Example:

"user_metadata": {
  "category": "recentlyAdded",
  "batchNumber": 5,
  "rating": 9.3,
  "needsReview": true,
  "hashtags": ["summer", "vlog"]
}

Response

The multipart upload session has been successfully created.

upload_idstring

The unique identifier of this upload session. Store this value, as you'll need it for the following subsequent operations:

  • Reporting completed chunks
  • Requesting additional presigned URLs
  • Retrieving the status of this upload session

This identifier remains valid for 24 hours from the time of creation.

asset_idstring

The unique identifier for the asset being created. Store this value, as you'll need it to reference the asset in other API calls. Note that this identifier is reserved immediately, but the asset becomes available for other operations only after the upload is completed successfully.

upload_headersobject
chunk_sizeinteger

The size in bytes for each chunk, except for the last chunk, which may be smaller. Use this value to divide your file into chunks of this exact size.

total_chunksinteger

The total number of chunks into which your file must be split. Calculated as: ceiling(total_size / chunk_size).

expires_atstring date-time

A string representing the date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the upload URL will expire. Upload URLs expire 24 hours from their creation. After expiration, you cannot resume the upload, and you must create a new upload session.

Changes