Direct uploads

The AssetsClient class provides methods to upload your media files to the platform. This method creates an asset that you can use in different workflows.

Workflow

1

Upload your file using the assets.create method. You receive the asset ID in the response.

2

Monitor the indexing status using the assets.retrieve method until it’s ready.

3

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 method parameter to direct and use the file parameter to specify the file.
  • Publicly accessible URL: Set the method parameter to url and use the url parameter to specify the URL of your file.

File size: 200MB maximum for local file uploads, 4GB maximum for URL uploads.

Additional requirements depend on your workflow:

Function signature and example:

1def create(
2 self,
3 *,
4 method: AssetsCreateRequestMethod,
5 file: typing.Optional[core.File] = OMIT,
6 url: typing.Optional[str] = OMIT,
7 filename: typing.Optional[str] = OMIT,
8 request_options: typing.Optional[RequestOptions] = None,
9) -> Asset

Parameters:

NameTypeRequiredDescription
methodAssetsCreateRequestMethodYesSpecifies the upload method for the asset. Use direct to upload a local file or url for a publicly accessible URL.
filecore.FileNoThe local file to upload. This parameter is required when method is set to direct.
urlstrNoThe publicly accessible URL of a media file to upload. This parameter is required when method is set to url.

URL uploads have a maximum limit of 4GB.
filenamestrNoThe optional filename of the asset. If not provided, the platform determines the filename from the file or URL.
request_optionsRequestOptionsNoRequest-specific configuration.

Return value: Returns an object of type Asset representing the created asset.

The Asset class contains the following properties:

NameTypeDescription
idOptional[str]The unique identifier of the asset.
methodOptional[AssetMethod]Indicates how you uploaded the asset. Values: direct (uploaded from your local file system), url (uploaded from a publicly accessible URL).
statusOptional[AssetStatus]Indicates the current status of the asset. Values: waiting (the platform is preparing to process the upload), processing (the platform is processing the uploaded file), ready (the asset is ready to use).
filenameOptional[str]The name of the file used to create the asset.
file_typeOptional[str]The MIME type of the asset file.
urlOptional[str]The URL to access your asset. Use this URL to preview or download the asset.

This URL expires after the time specified in the url_expires_at field. After expiration, you must retrieve the asset again to obtain a new URL.
url_expires_atOptional[datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the URL expires. After this time, the URL in the url field becomes invalid. Retrieve the asset again to obtain a new URL.
created_atOptional[datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the asset was created.

API Reference: Create an asset

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:

1def list(
2 self,
3 *,
4 page: typing.Optional[int] = None,
5 page_limit: typing.Optional[int] = None,
6 asset_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
7 asset_types: typing.Optional[
8 typing.Union[AssetsListRequestAssetTypesItem, typing.Sequence[AssetsListRequestAssetTypesItem]]
9 ] = None,
10 request_options: typing.Optional[RequestOptions] = None,
11) -> SyncPager[Asset]

Parameters:

NameTypeRequiredDescription
pageintNoA number that identifies the page to retrieve. Default: 1.
page_limitintNoThe number of items to return on each page. Default: 10. Max: 50.
asset_idsUnion[str, Sequence[str]]NoFilters the response to include only assets with the specified IDs. Provide one or more asset IDs. When you specify multiple IDs, the platform returns all matching assets.
asset_typesUnion
[AssetsListRequestAssetTypesItem, Sequence[AssetsListRequestAssetTypesItem]]
NoFilters the response to include only assets of the specified types. Provide one or more asset types. When you specify multiple types, the platform returns all matching assets. Values: image, video, audio.
request_optionsRequestOptionsNoRequest-specific configuration.

Return value: Returns a SyncPager[Asset] object containing a paginated list of Asset objects, representing the assets that match the specified criteria. For details about the Asset class see the Create an asset section above.

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.

API Reference: List assets

Retrieve an asset

Description: This method retrieves details about the specified asset.

Function signature and example:

1def retrieve(
2 self,
3 asset_id: str,
4 *,
5 request_options: typing.Optional[RequestOptions] = None
6) -> Asset

Parameters:

NameTypeRequiredDescription
asset_idstrYesThe unique identifier of the asset to retrieve.
request_optionsRequestOptionsNoRequest-specific configuration.

Return value: Returns an Asset object containing details about the specified asset. For details about the Asset class, see the Create an asset section above.

API Reference: Retrieve an asset

Delete an asset

Description: This method deletes the specified asset. This action cannot be undone.

Function signature and example:

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

Parameters:

NameTypeRequiredDescription
asset_idstrYesThe unique identifier of the asset to delete.
request_optionsRequestOptionsNoRequest-specific configuration.

Return value: Returns None.

API Reference: Delete asset