Index content

The IndexesClient.IndexedAssetsClient class provides methods to manage indexed assets within an index.

Workflow

Before you begin, create an index if you don’t have one.

1

Upload your content using direct or multipart uploads. The platform creates an asset and return its unique identifier.

2

Index your content using the indexes.indexed_assets.create method.

3

Monitor the indexing status until it shows ready using the indexes.indexed_assets.retrieve method.

4

Search or analyze your content.

Methods

Index an asset

Description: This method indexes an uploaded asset to make it searchable and analyzable. Indexing processes your content and extracts information that enables the platform to search and analyze your videos.

This operation is asynchronous. The platform returns an indexed asset ID immediately and processes your content in the background. Monitor the indexing status to know when your content is ready to use.

Your asset must meet the requirements based on your workflow:

If you want to both search and analyze your videos, the most restrictive requirements apply.

Function signature and example:

1def create(
2 self,
3 index_id: str,
4 *,
5 asset_id: str,
6 enable_video_stream: typing.Optional[bool] = OMIT,
7 request_options: typing.Optional[RequestOptions] = None,
8) -> IndexedAssetsCreateResponse

Parameters:

NameTypeRequiredDescription
index_idstrYesThe unique identifier of the index to which the asset will be indexed.
asset_idstrYesThe unique identifier of the asset to index.
enable_video_streamboolNoThis parameter indicates if the platform stores the video for streaming. When set to true, the platform stores the video, and you can retrieve its URL to access the stream over the HLS protocol.
request_optionsRequestOptionsNoRequest-specific configuration.

Return value: Returns an IndexedAssetsCreateResponse object containing the unique identifier of the indexed asset.

The IndexedAssetsCreateResponse class contains the following properties:

NameTypeDescription
idOptional[str]The unique identifier of the indexed asset. Use it to monitor the indexing progress.

API Reference: Index an asset

Retrieve an indexed asset

Description: This method retrieves information about an indexed asset, including its status, metadata, and optional embeddings or transcription.

Use this method to:

  • Monitor the indexing progress:

    • Call this endpoint after creating an indexed asset
    • Check the status field until it shows ready
    • Once ready, your content is available for search and analysis
  • Retrieve the asset metadata:

    • Retrieve system metadata (duration, resolution, filename)
    • Access user-defined metadata
  • Retrieve the embeddings:

    • Include the embeddingOption parameter to retrieve video embeddings
    • Requires the Marengo video understanding model to be enabled in your index
  • Retrieve transcriptions:

    • Set the transcription parameter to true to retrieve spoken words from your video Function signature and example:
1def retrieve(
2 self,
3 index_id: str,
4 indexed_asset_id: str,
5 *,
6 embedding_option: typing.Optional[
7 typing.Union[
8 IndexedAssetsRetrieveRequestEmbeddingOptionItem,
9 typing.Sequence[IndexedAssetsRetrieveRequestEmbeddingOptionItem],
10 ]
11 ] = None,
12 transcription: typing.Optional[bool] = None,
13 request_options: typing.Optional[RequestOptions] = None,
14) -> IndexedAssetDetailed

Parameters:

NameTypeRequiredDescription
index_idstrYesThe unique identifier of the index to which the indexed asset has been uploaded.
indexed_asset_idstrYesThe unique identifier of the indexed asset to retrieve.
embedding_optionUnion
[IndexedAssetsRetrieveRequestEmbeddingOptionItem,
Sequence
[IndexedAssetsRetrieveRequestEmbeddingOptionItem]]
NoSpecifies which types of embeddings to retrieve. Values vary by model version:
- Marengo 3.0: visual, audio, transcription
- Marengo 2.7: visual-text, audio

To retrieve embeddings, the video must be indexed using the Marengo model.
transcriptionboolNoIndicates whether to retrieve a transcription of the spoken words for the indexed asset.
request_optionsRequestOptionsNoRequest-specific configuration.

Return value: Returns an IndexedAssetDetailed object containing detailed information about the indexed asset.

The IndexedAssetDetailed class extends IndexedAsset and contains the following additional properties:

NameTypeDescription
user_metadataOptional[Dict[str, Optional[Any]]]User-generated metadata about the indexed asset.
hlsOptional[HlsObject]The platform returns this object only for videos uploaded with the enable_video_stream parameter set to true.
embeddingOptional[IndexedAssetDetailedEmbedding]Contains the embedding and the associated information. The platform returns this field when the embedding_option parameter is specified in the request.
transcriptionOptional[List[TranscriptionDataItem]]A list of transcription segments. The platform returns this field when the transcription parameter is set to true.

The IndexedAssetDetailed class also inherits all properties from IndexedAsset:

NameTypeDescription
idOptional[str]The unique identifier of the indexed asset.
created_atOptional[str]The date and time, in RFC 3339 format, when the indexing task was created.
updated_atOptional[str]The date and time, in RFC 3339 format, when the indexing task was last updated.
indexed_atOptional[str]The date and time, in RFC 3339 format, when the indexing task was completed.
statusOptional[IndexedAssetStatus]The status of the indexing task. Values: ready, pending, queued, indexing, failed.
system_metadataOptional[IndexedAssetSystemMetadata]System-generated metadata about the indexed asset.

The IndexedAssetSystemMetadata class contains the following properties:

NameTypeDescription
filenameOptional[str]The filename of the indexed asset.
durationOptional[float]The duration of the video in seconds.
fpsOptional[float]The frames per second of the video.
widthOptional[int]The width of the video in pixels.
heightOptional[int]The height of the video in pixels.
sizeOptional[float]The size of the file in bytes.

The HlsObject class contains the following properties:

NameTypeDescription
video_urlOptional[str]The URL of the video. You can use this URL to access the stream over the HLS protocol.
thumbnail_urlsOptional[List[str]]An array containing the URLs of thumbnails.
statusOptional[HlsObjectStatus]The encoding status of the video file. Values: PROCESSING (video is being encoded), COMPLETE (encoding finished), CANCELED (encoding was canceled), ERROR (encoding error occurred).
updated_atOptional[str]The date and time, in RFC 3339 format, when the encoding status was last updated.

The TranscriptionDataItem class contains the following properties:

NameTypeDescription
startOptional[float]The start of the time range, expressed in seconds.
endOptional[float]The end of the time range, expressed in seconds.
valueOptional[str]Text representing the spoken words within this time range.

API Reference: Retrieve an indexed asset

Update an indexed asset

Description: This method updates one or more fields of the metadata of an indexed asset. You can also delete a field by setting it to null.

Function signature and example:

1def update(
2 self,
3 index_id: str,
4 indexed_asset_id: str,
5 *,
6 user_metadata: typing.Optional[UserMetadata] = OMIT,
7 request_options: typing.Optional[RequestOptions] = None,
8) -> None

Parameters:

NameTypeRequiredDescription
index_idstrYesThe unique identifier of the index to which the indexed asset has been uploaded.
indexed_asset_idstrYesThe unique identifier of the indexed asset to update.
user_metadataUserMetadataNoUser-defined metadata to associate with the indexed asset. You can use strings, integers, floats, and booleans as values.
request_optionsRequestOptionsNoRequest-specific configuration.

Return value: Returns None.

API Reference: Update indexed asset

List indexed assets

Description: This method returns a list of the indexed assets in the specified index. By default, the platform returns your indexed assets sorted by creation date, with the newest at the top of the list.

Function signature and example:

1def list(
2 self,
3 index_id: str,
4 *,
5 page: typing.Optional[int] = None,
6 page_limit: typing.Optional[int] = None,
7 sort_by: typing.Optional[str] = None,
8 sort_option: typing.Optional[str] = None,
9 status: typing.Optional[
10 typing.Union[IndexedAssetsListRequestStatusItem, typing.Sequence[IndexedAssetsListRequestStatusItem]]
11 ] = None,
12 filename: typing.Optional[str] = None,
13 duration: typing.Optional[float] = None,
14 fps: typing.Optional[float] = None,
15 width: typing.Optional[float] = None,
16 height: typing.Optional[int] = None,
17 size: typing.Optional[float] = None,
18 created_at: typing.Optional[str] = None,
19 updated_at: typing.Optional[str] = None,
20 user_metadata: typing.Optional[
21 typing.Dict[str, typing.Optional[IndexedAssetsListRequestUserMetadataValue]]
22 ] = None,
23 request_options: typing.Optional[RequestOptions] = None,
24) -> SyncPager[IndexedAsset]

Parameters:

NameTypeRequiredDescription
index_idstrYesThe unique identifier of the index for which the platform will retrieve the indexed assets.
pageintNoA number that identifies the page to retrieve. Default: 1.
page_limitintNoThe number of items to return on each page. Default: 10. Max: 50.
sort_bystrNoThe field to sort on. Values: updated_at, created_at. Default: created_at.
sort_optionstrNoThe sorting direction. Values: asc, desc. Default: desc.
statusUnion
[IndexedAssetsListRequestStatusItem,
Sequence
[IndexedAssetsListRequestStatusItem]]
NoFilter by one or more indexing task statuses. Values: ready, pending, queued, indexing, failed.
filenamestrNoFilter by filename.
durationfloatNoFilter by duration. Expressed in seconds.
fpsfloatNoFilter by frames per second.
widthfloatNoFilter by width.
heightintNoFilter by height.
sizefloatNoFilter by size. Expressed in bytes.
created_atstrNoFilter indexed assets by the creation date and time of their associated indexing tasks, in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”).
updated_atstrNoFilter indexed assets by the last update date and time, in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”). This filter applies only to indexed assets updated using the update method.
user_metadataDict
[str,
Optional[IndexedAssetsListRequestUserMetadataValue]]
NoFilter by custom user-defined metadata fields. To enable filtering, you must first add user-defined metadata to your video.
request_optionsRequestOptionsNoRequest-specific configuration.

Return value: Returns a SyncPager[IndexedAsset] object that allows you to iterate through the paginated indexed asset results.

The SyncPager[T] class contains the following properties and methods:

NameTypeDescription
itemsOptional[List[T]]A list containing the current page of items. Can be None.
has_nextboolIndicates whether there is a next page to load.
get_nextOptional[Callable[[], Optional[SyncPager[T]]]]A callable function that retrieves the next page. Can be None.
responseOptional[BaseHttpResponse]The HTTP response object. Can be None.
next_page()Optional[SyncPager[T]]Calls get_next() if available and returns the next page object.
__iter__()Iterator[T]Allows iteration through all items across all pages using for loops.
iter_pages()Iterator[SyncPager[T]]Allows iteration through page objects themselves.

The IndexedAsset class contains the following properties:

NameTypeDescription
idOptional[str]A string representing the unique identifier of your indexed asset.
created_atOptional[str]A string indicating the date and time, in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), that the indexing task was created.
updated_atOptional[str]A string indicating the date and time, in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), that the indexing task was last updated.
indexed_atOptional[str]A string indicating the date and time, in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), that the indexing task has been completed.
statusOptional[IndexedAssetStatus]The status of the indexing task. Values: ready, pending, queued, indexing, failed.
system_metadataOptional[IndexedAssetSystemMetadata]System-generated metadata about the indexed asset.

API Reference: List indexed assets

Delete an indexed asset

Description: This method deletes all the information about the specified indexed asset. This action cannot be undone.

Function signature and example:

1def delete(
2 self,
3 index_id: str,
4 indexed_asset_id: str,
5 *,
6 request_options: typing.Optional[RequestOptions] = None
7) -> None

Parameters:

NameTypeRequiredDescription
index_idstrYesThe unique identifier of the index to which the indexed asset has been uploaded.
indexed_asset_idstrYesThe unique identifier of the indexed asset to delete.
request_optionsRequestOptionsNoRequest-specific configuration.

Return value: Returns None.

API Reference: Delete an indexed asset