Manage assets
The AssetsClient class provides methods to work with assets after you upload them. Use these methods to retrieve and list assets, manage their user-defined metadata, retrieve transcriptions, and delete assets you no longer need.
To create an asset, see the Direct uploads or Multipart uploads page.
Methods
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
Return value
Returns a SyncPager[AssetDetail] object containing a paginated list of AssetDetail objects. The AssetDetail class extends Asset with additional fields for HLS streaming and thumbnail details. For details about the AssetDetail class, see the Retrieve an asset section below.
The SyncPager[T] class 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 AssetDetail object containing details about the specified asset.
The AssetDetail class extends Asset (documented in the Create an asset section above) with the following additional properties:
The AssetHls class contains the following properties:
The AssetThumbnail class contains the following properties:
The TechnicalMetadata class contains the following properties:
The VideoStream class contains the following properties:
The AudioStream class contains the following properties:
The AssetError class 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
Return value
Returns None.
API Reference
Delete the user-defined metadata of an asset
Description: This method deletes the user-defined metadata of the specified asset. To achieve the same result, you can also send an empty object ({}) in the user_metadata field of the replace_user_metadata method.
This action cannot be undone.
Function signature and example:
Parameters
Return value
Returns None.
API Reference
Delete the user-defined metadata of an asset
Update the user-defined metadata of an asset
Description: This method updates the user-defined metadata of the specified asset. The platform merges your changes with the existing metadata:
- A key with a value creates or replaces that key.
- A key set to
nulldeletes that key. - A key set to an empty string (
"") is ignored. - A key you omit from the request keeps its current value.
To replace all metadata in a single call, use the replace_user_metadata method instead.
Function signature and example:
Parameters
Return value
Returns None.
API Reference
Update the user-defined metadata of an asset
Replace the user-defined metadata of an asset
Description: This method replaces the entire user-defined metadata of the specified asset. Unlike the update_user_metadata method, which merges your changes with the existing metadata, this method overwrites the stored value in full:
- A key with a value creates or replaces that key.
- A key set to an empty string (
"") ornullis ignored. - A key you omit from the request body is removed.
To clear all metadata, send an empty object ({}) in the user_metadata field. This produces the same result as the delete_user_metadata method.
Function signature and example:
Parameters
Return value
Returns None.
API Reference
Replace the user-defined metadata of an asset
Enable storage accounting for an asset
Description: This method enables storage accounting for the specified asset. Storage accounting makes an asset count toward your Managed Intelligence allowance.
When to use this method: Call it once for each asset that you uploaded before your plan moved to the new billing (a pre-migration asset). Enable storage accounting before you do either of the following:
- Add the asset to a knowledge store.
- Index the asset in an index for which Marengo is enabled.
An asset that you upload after your plan moves already counts toward your Managed Intelligence allowance. You do not need to call this method for it.
Before you call this method:
- Your plan must have moved to the new billing.
- The asset must have the
readystatus and a recorded size. To check, use theretrievemethod and read thestatusandsizefields. - The asset must fit in your Managed Intelligence allowance.
After you call this method:
- The asset counts toward your Managed Intelligence allowance from the moment of the call.
- Enabling storage accounting is permanent. You cannot turn it off.
- If storage accounting is already on, the method returns the same response and changes nothing.
Function signature and example:
Parameters
Return value
Returns an AssetStorageAccounting object containing the storage accounting setting of the asset.
The AssetStorageAccounting class contains the following properties:
API Reference
Enable storage accounting for an asset
Error codes
This section lists the most common error messages you may encounter while uploading assets.
content_type_invalid- The content type
{content_type}is not supported. Please usemultipart/form-data.
- The content type
multipart_boundary_missing- Multipart boundary is missing. Please provide the boundary in the
Content-Typeheader.
- Multipart boundary is missing. Please provide the boundary in the
invalid_multipart- Invalid multipart form. Please check your implementation and try again.
- echo bind error
- (Returns the raw bind error message)
- echo validate error
- (Returns a validator-generated message, for example:
Key: 'CreateAssetRequest.Method' Error:Field validation for 'Method' failed on the 'oneof' tag)
- (Returns a validator-generated message, for example:
parameter_not_provided- The
fileparameter is required but was not provided.fileis required whenmethodisdirect. - The
urlparameter is required but was not provided.urlis required whenmethodisurl.
- The
parameter_invalid- The
enabledparameter is invalid. Storage accounting cannot be turned off once an asset is billable. - The
methodparameter is invalid. To upload in parts, use the/assets/multipart-uploadsendpoint. - The
fileparameter is invalid. Unable to process the uploaded file. Please try uploading again. - The
fileparameter is invalid. Unsupported asset type:{asset_type}. - The
imageparameter is invalid. Image dimensions{current_dimensions}are below the minimum{minimum_dimensions}. - The
imageparameter is invalid. Invalid image file. Please check the format and dimensions.
- The
media_url_unsupported_format- The file at the provided URL is not a supported media format. Detected format:
{detected_format}. Please provide a valid asset file.
- The file at the provided URL is not a supported media format. Detected format:
media_url_not_accessible- Cannot access the media URL
{url}. The server responded with an error. Please verify the URL is correct and publicly accessible.
- Cannot access the media URL
media_url_file_broken- Cannot read the media file at the specified URL. Please verify the file is valid and try again.
media_filesize_too_large- The media file is too large. Please upload a file smaller than
{maximum_size}. The current size is{current_size}.
- The media file is too large. Please upload a file smaller than
video_file_broken- Unable to process video file. Please check if the file is valid and try again.
video_file_live- Live video streams are not supported. Please provide a URL that is not a live stream.
video_resolution_too_low- The resolution of the video is too low. Please upload a video with a resolution between
{minimum_resolution}and{maximum_resolution}. Current resolution is{current_resolution}.
- The resolution of the video is too low. Please upload a video with a resolution between
video_resolution_too_high- The resolution of the video is too high. Please upload a video with a resolution between
{minimum_resolution}and{maximum_resolution}. Current resolution is{current_resolution}.
- The resolution of the video is too high. Please upload a video with a resolution between
video_resolution_invalid_aspect_ratio- The aspect ratio of the video is invalid. Please upload a video with an aspect ratio between 1:1 and
{maximum_aspect_ratio}. Current resolution is{current_resolution}.
- The aspect ratio of the video is invalid. Please upload a video with an aspect ratio between 1:1 and
video_duration_too_short- The video is too short. Please use a video with a duration of at least
{minimum_duration}seconds. Current duration is{current_duration}seconds.
- The video is too short. Please use a video with a duration of at least
video_duration_too_long- The video is too long. Please use a video with a duration between
{minimum_duration}and{maximum_duration}seconds. Current duration is{current_duration}seconds.
- The video is too long. Please use a video with a duration between
video_filesize_too_large- The video is too large. Please use a video with a size less than
{maximum_size}. The current size is{current_size}.
- The video is too large. Please use a video with a size less than
audio_file_broken- Unable to process audio file. Please check if the file is valid and try again.
audio_duration_too_short- The audio is too short. Please use an audio file with a duration of at least
{minimum_duration}seconds. Current duration is{current_duration}seconds.
- The audio is too short. Please use an audio file with a duration of at least
audio_duration_too_long- The audio is too long. Please use an audio file with a duration between
{minimum_duration}and{maximum_duration}seconds. Current duration is{current_duration}seconds.
- The audio is too long. Please use an audio file with a duration between
audio_filesize_too_large- The audio is too large. Please use an audio file with a size less than
{maximum_size}. The current size is{current_size}.
- The audio is too large. Please use an audio file with a size less than
audio_format_unsupported- The audio format
{format}is not supported. Please use one of the following formats:{supported_formats}.
- The audio format
asset_transcription_not_found- Transcription for asset
{asset_id}does not exist.
- Transcription for asset
resource_not_exists- The requested asset with the identifier
{asset_id}does not exist. - Resource with id
{asset_id}does not exist.
- The requested asset with the identifier
asset_not_ready_for_storage_billing- Storage accounting cannot be enabled. Asset
{asset_id}is still being processed; try again once it is ready. - Storage accounting cannot be enabled. Asset
{asset_id}failed to process, so it will never become ready. - Storage accounting cannot be enabled. Asset
{asset_id}is not ready.
- Storage accounting cannot be enabled. Asset
asset_storage_size_unknown- Storage accounting cannot be enabled. Asset
{asset_id}has no recorded size.
- Storage accounting cannot be enabled. Asset
asset_storage_limit_exceeded- Storage capacity exceeded for your plan. Current:
{current_bytes}, Limit:{limit_bytes}, Requested:{requested_bytes}.
- Storage capacity exceeded for your plan. Current:
platform_billing_not_active- This account has no effective Platform billing plan.
asset_storage_accounting_required- Asset
{asset_id}must have storage accounting enabled before indexing or ingestion under the new billing. CallPUT /assets/{asset_id}/storage-accountingwith{"enabled":true}, then retry indexing or ingestion.
- Asset
For a list of general errors that apply to all endpoints, see the Error codes page.
Retrieve the transcription of an asset
Description: This method retrieves the transcription of a video or audio asset. An asset that has a transcription returns 200 with the current transcription status. The endpoint returns 404 when the asset cannot be found or has no transcription.
The platform generates transcriptions asynchronously. Poll this endpoint to monitor the transcription status.
When the status is ready, the response contains the segmentations you requested that the transcription supports. A transcription does not always support every segmentation, so read the segmentations the response returns rather than assuming every requested one is present.
Function signature and example:
Parameters
Return value
Returns an AssetTranscriptionResponse object containing the transcription status and the transcriptions you requested.
The AssetTranscriptionResponse class contains the following properties:
The AssetTranscriptionEntry class contains the following properties:
The AssetTranscriptionUtterance class contains the following properties:
The AssetTranscriptionError class contains the following properties: