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.
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:
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:
method parameter to direct and use the file parameter to specify the file.method parameter to url and use the url parameter to specify the URL of your file.Upload limits:
Additional requirements depend on your workflow:
This method is rate-limited. For details, see the Rate limits page.
Function signature and example:
The TwelvelabsApi.AssetsCreateRequest interface has the following properties:
Returns an HttpResponsePromise that resolves to a TwelvelabsApi.Asset object representing the created asset.
The TwelvelabsApi.Asset interface contains the following properties:
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:
The TwelvelabsApi.AssetsListRequest interface has the following properties:
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:
Description: This method retrieves details about the specified asset.
Function signature and example:
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:
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:
The TwelvelabsApi.AssetsDeleteRequest interface has the following properties:
Returns an HttpResponsePromise that resolves to void.
This section lists the most common error messages you may encounter while performing asset-related operations.
content_type_invalid
{content_type} is not supported. Please use multipart/form-data.multipart_boundary_missing
Content-Type header.invalid_multipart
Key: 'CreateAssetRequest.Method' Error:Field validation for 'Method' failed on the 'oneof' tag)parameter_not_provided
file parameter is required but was not provided. file is required when method is direct.url parameter is required but was not provided. url is required when method is url.parameter_invalid
method parameter is invalid. To upload in parts, use the /assets/multipart-uploads endpoint.file parameter is invalid. Unable to process the uploaded file. Please try uploading again.file parameter is invalid. Unsupported asset type: {asset_type}.image parameter is invalid. Image dimensions {current_dimensions} are below the minimum {minimum_dimensions}.image parameter is invalid. Invalid image file. Please check the format and dimensions.media_url_unsupported_format
{detected_format}. Please provide a valid asset file.media_url_not_accessible
{url}. The server responded with an error. Please verify the URL is correct and publicly accessible.media_url_file_broken
media_filesize_too_large
{maximum_size}. The current size is {current_size}.video_file_broken
video_file_live
video_resolution_too_low
{minimum_resolution} and {maximum_resolution}. Current resolution is {current_resolution}.video_resolution_too_high
{minimum_resolution} and {maximum_resolution}. Current resolution is {current_resolution}.video_resolution_invalid_aspect_ratio
{maximum_aspect_ratio}. Current resolution is {current_resolution}.video_duration_too_short
{minimum_duration} seconds. Current duration is {current_duration} seconds.video_duration_too_long
{minimum_duration} and {maximum_duration} seconds. Current duration is {current_duration} seconds.video_filesize_too_large
{maximum_size}. The current size is {current_size}.audio_file_broken
audio_duration_too_short
{minimum_duration} seconds. Current duration is {current_duration} seconds.audio_duration_too_long
{minimum_duration} and {maximum_duration} seconds. Current duration is {current_duration} seconds.audio_filesize_too_large
{maximum_size}. The current size is {current_size}.audio_format_unsupported
{format} is not supported. Please use one of the following formats: {supported_formats}.For a list of general errors that apply to all endpoints, see the Error codes page.