Direct uploads
The Assets class provides methods to upload your media and documents 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 identifier of the asset 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 identifier of the asset with the Embed API v2.
- For entity search (images): Use the identifier of the asset to create entities.
- For search and analysis (videos): Index your asset using the identifier of the asset.
Methods
Create an asset
Description: This method creates an asset by uploading a file to the platform. Assets are reusable files that you can use in different workflows.
The platform processes uploads asynchronously. This method returns immediately with the asset in the processing status, which then transitions to the ready status on success or to the failed status when the file is invalid, corrupt, or unreadable, 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.
- PDF, text, and Markdown files.
Filename extension matching is case-insensitive; for example, notes.MD and notes.md are treated the same. The platform rejects unsupported formats. For documents, it also rejects files whose extensions don’t match the detected content.
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
- Documents, local files: Up to 200 MB
- Documents, public URLs: Up to 512 MB
Asset creation does not enforce a maximum duration for video and audio files. 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
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: