Direct uploads
The Assets class provides methods to upload your media files to the platform. This method creates an asset that you can use in different workflows.
Workflow
Upload your file using the assets.create method. You receive the asset ID in the response.
Asset processing is asynchronous. Poll the assets.retrieve method until the status field is ready before proceeding.
What you do next depends on your use case:
- For creating embeddings (videos, audio, images): Use the asset ID with the Embed API v2.
- For entity search (images): Use the asset ID to create entities.
- For search and analysis (videos): Index your asset using the asset ID.
Methods
Create an asset
Description: This method creates an asset by uploading a file to the platform. Assets are media files that you can use in downstream workflows, including indexing, analyzing video content, and creating entities.
The platform processes uploads asynchronously. This method returns immediately with the asset in the processing status, which then transitions to ready on success or to failed when the file is invalid or corrupt, typically within a few seconds to a few minutes. Poll the assets.retrieve method until the status field is ready before you use the asset. This applies to every upload, including small files.
Supported content: Video, audio, and images.
Upload methods:
- Local file: Set the
methodparameter todirectand use thefileparameter to specify the file. - Publicly accessible URL: Set the
methodparameter tourland use theurlparameter to specify the URL of your file.
Upload limits:
- Video and audio, local files: Up to 200 MB
- Video and audio, public URLs: Up to 4 GB
- Images: Up to 32 MB
Asset creation does not enforce a maximum duration. Each model applies its own file size and duration limits. For details, see the requirements below.
Additional requirements depend on your workflow:
- Search: Marengo requirements
- Video analysis: Pegasus requirements
- Entity search: Marengo image requirements
- Create embeddings: Marengo requirements
Note
This method is rate-limited. For details, see the Rate limits page.
Function signature and example:
Parameters
The TwelvelabsApi.AssetsCreateRequest interface has the following properties:
Return value
Returns an HttpResponsePromise that resolves to a TwelvelabsApi.Asset object representing the created asset.
The TwelvelabsApi.Asset interface contains the following properties:
The TwelvelabsApi.AssetError interface contains the following properties: