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.
For URL uploads larger than 200 MB, check the asset status using the assets.retrieve method until status 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.
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 5 MB
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:
API Reference
List assets
Description: This method returns a list of assets in your account.
The platform returns your assets sorted by creation date, with the newest at the top of the list.
Function signature and example:
Parameters
The TwelvelabsApi.AssetsListRequest interface has the following properties:
Return value
Returns a Promise that resolves to a Page<TwelvelabsApi.AssetDetail> object that allows you to iterate through the paginated asset results. The AssetDetail interface extends Asset with additional fields for HLS streaming and thumbnail details. For details about the TwelvelabsApi.AssetDetail interface, see the Retrieve an asset section below.
The Page<T> interface contains the following properties and methods:
API Reference
Retrieve an asset
Description: This method retrieves details about the specified asset.
Function signature and example:
Parameters
Return value
Returns an HttpResponsePromise that resolves to a TwelvelabsApi.AssetDetail object containing details about the specified asset.
The TwelvelabsApi.AssetDetail interface extends TwelvelabsApi.Asset (documented in the Create an asset section above) with the following additional properties:
The TwelvelabsApi.AssetHls interface contains the following properties:
The TwelvelabsApi.AssetThumbnail interface contains the following properties:
API Reference
Delete an asset
Description: This method deletes the specified asset. This action cannot be undone. By default, the platform checks whether any indexed assets reference the asset. If references exist, the request fails with a 409 Conflict error. Set the force parameter to true to delete the asset regardless.
Function signature and example:
Parameters
The TwelvelabsApi.AssetsDeleteRequest interface has the following properties:
Return value
Returns an HttpResponsePromise that resolves to void.