Manage entities

The Entity Search feature is currently in beta.

The TwelveLabs Python SDK offers methods for managing entities related to video search. It operates with three types of resources:

  • Assets: Reference images of the persons you wish to identify.
  • Entity collections: Logical groupings of related entities, such as players on a team.
  • Entities: Specific persons you want to locate in videos, associated with their reference images.
Note
  • To use the Entity Search feature, the Marengo 3.0 video understanding model must be enabled in your index.
  • The platform automatically creates a sample entity collection when you create your account. Users on the Free plan can have a total of one entity collection with up to fifteen entities. The default collection is included in this limit. To create more entity collections, upgrade to the Developer plan. For instructions, see the Upgrade your plan section.

Assets

Assets are reference images that help identify people in videos. Upload multiple images per person to improve identification accuracy.

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 request_options: typing.Optional[RequestOptions] = None,
8) -> SyncPager[Asset]

Parameters:

NameTypeRequiredDescription
pagetyping.Optional[int]NoA number that identifies the page to retrieve. Default: 1.
page_limittyping.Optional[int]NoThe number of items to return on each page. Default: 10. Max: 50.
asset_idstyping.Optional[typing.Union[str, typing.Sequence[str]]]NoA list of asset IDs to filter the results.
request_optionstyping.Optional[RequestOptions]NoRequest-specific configuration

Return value: Returns a SyncPager[Asset] object containing a paginated list of Asset objects, representing the assets that match the specified criteria.

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 Asset class contains the following properties:

NameTypeDescription
idtyping_extensions.Annotated[typing.Optional[str]The unique identifier for the asset.
methodtyping.Optional[AssetMethod]The method used to create the asset. Values: direct, url.
statustyping.Optional[AssetStatus]The status of the upload process. Values: waiting, processing, ready.
filenametyping.Optional[str]The name of the file used to create the asset.
file_typetyping.Optional[str]The MIME type of the asset file.
urltyping.Optional[str]The URL where the asset can be accessed.
url_expires_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the URL expires.
created_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the asset was created.

API Reference: List assets

Create an asset

Description: This method creates an asset by uploading an image file or providing a publicly accessible URL.

Note the following about creating assets:

  • The platform will automatically delete assets not associated with any entity 72 hours after creation.
  • You can associate a single asset with multiple entities.

Your image files must meet the format requirements.

Ensure URLs point directly to the raw image file without requiring user interaction.

Upload options:

  • Local file: Set the method parameter to direct and use the file parameter to specify the image file.
  • Publicly accessible URL: Set the method parameter to url and use the url parameter to specify the URL of your image file.

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 request_options: typing.Optional[RequestOptions] = None,
8) -> Asset

Parameters:

NameTypeRequiredDescription
methodAssetsCreateRequestMethodYesSpecifies the upload method for the asset. Use direct to upload a local image file or url for a publicly accessible URL.
filetyping.Optional[core.File]NoSpecify this parameter to upload a file from your local file system. This parameter is required when method is set to file.
urltyping.Optional[str]NoSpecify this parameter to upload a file using a publicly accessible URL. This parameter is required when method is set to url.
request_optionstyping.Optional[RequestOptions]NoRequest-specific configuration

Return value: Returns an object of type Asset representing the newly created asset. The Asset class contains the following properties:

NameTypeDescription
idtyping_extensions.Annotated[typing.Optional[str]The unique identifier for the asset.
methodtyping.Optional[AssetMethod]The method used to create the asset. Values: direct, url.
statustyping.Optional[AssetStatus]The status of the upload process. Values: waiting, processing, ready.
filenametyping.Optional[str]The name of the file used to create the asset.
file_typetyping.Optional[str]The MIME type of the asset file.
urltyping.Optional[str]The URL where the asset can be accessed.
url_expires_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the URL expires.
created_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the asset was created.

API Reference: Create an asset

Retrieve an asset

Description: This method retrieves details about the specified asset.

Function signature and example:

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

Parameters:

NameTypeRequiredDescription
asset_idstrYesThe unique identifier of the asset to retrieve.
request_optionstyping.Optional[RequestOptions]NoRequest-specific configuration

Return value: Returns an object of type Asset representing the specified asset. The Asset class contains the following properties:

NameTypeDescription
idtyping_extensions.Annotated[typing.Optional[str]The unique identifier for the asset.
methodtyping.Optional[AssetMethod]The method used to create the asset. Values: direct, url.
statustyping.Optional[AssetStatus]The status of the upload process. Values: waiting, processing, ready.
filenametyping.Optional[str]The name of the file used to create the asset.
file_typetyping.Optional[str]The MIME type of the asset file.
urltyping.Optional[str]The URL where the asset can be accessed.
url_expires_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the URL expires.
created_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the asset was created.

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(self, asset_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None

Parameters:

NameTypeRequiredDescription
asset_idstrYesThe unique identifier of the asset to delete.
request_optionstyping.Optional[RequestOptions]No

Return value: None. This method doesn’t return any data upon successful completion.

API Reference: Delete an asset

Entity collections

Entity collections organize related entities into logical groups.

List entity collections

Description: This method returns a list of the entity collections in your account.

Function signature and example:

1def list(
2 self,
3 *,
4 page: typing.Optional[int] = None,
5 page_limit: typing.Optional[int] = None,
6 name: typing.Optional[str] = None,
7 sort_by: typing.Optional[EntityCollectionsListRequestSortBy] = None,
8 sort_option: typing.Optional[str] = None,
9 request_options: typing.Optional[RequestOptions] = None,
10) -> SyncPager[EntityCollection]

Parameters:

NameTypeRequiredDescription
pagetyping.Optional[int]NoA number that identifies the page to retrieve. Default: 1.
page_limittyping.Optional[int]NoThe number of items to return on each page. Default: 10. Max: 50
nametyping.Optional[str]No
sort_bytyping.Optional[EntityCollectionsListRequestSortBy]The field to sort on. The following options are available:
- created_at: Sorts by the time, in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity collection was updated.
- updated_at: Sorts by the time, in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity collection was created.
- name: Sorts by the name.
sort_optiontyping.Optional[str]NoThe sorting direction. The following options are available: asc and desc. Default: desc.
request_optionstyping.Optional[RequestOptions]NoRequest-specific configuration

Return value: Returns a SyncPager[EntityCollection] object containing a paginated list of EntityCollection objects, representing the entity collections that match the specified criteria.

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 EntityCollection class contains the following properties:

NameTypeDescription
idtyping_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="_id")]The unique identifier for the entity collection.
nametyping.Optional[str]The name of the entity collection.
descriptiontyping.Optional[str]The description of the entity collection.
created_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity collection was created.
updated_attyping.Optional[dt.datetime]

API Reference: List entity collections

Create an entity collection

Description: This method creates an entity collection.

Free plan users can create one entity collection with up to 15 entities. If your needs exceed the Free plan, consider upgrading to the Developer plan.

Function signature and example:

1def create(
2 self,
3 *,
4 name: str,
5 description: typing.Optional[str] = OMIT,
6 request_options: typing.Optional[RequestOptions] = None,
7) -> EntityCollection

Parameters:

NameTypeRequiredDescription
namestrYesThe name of the entity collection. Make sure you use a succinct and descriptive name.
descriptiontyping.Optional[str]NoA description of the entity collection.
request_optionstyping.Optional[RequestOptions]NoRequest-specific configuration

Return value: Returns an object of type EntityCollection representing the newly created entity collection. The EntityCollection class contains the following properties:

NameTypeDescription
idtyping_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="_id")]The unique identifier for the entity collection.
nametyping.Optional[str]The name of the entity collection.
descriptiontyping.Optional[str]The description of the entity collection.
created_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity collection was created.
updated_attyping.Optional[dt.datetime]

API Reference: Create an entity collection

Retrieve an entity collection

Description: This method retrieves details about the specified entity collection.

Function signature and example:

1def retrieve(
2 self, entity_collection_id: str, *, request_options: typing.Optional[RequestOptions] = None
3) -> EntityCollection

Parameters:

NameTypeRequiredDescription
entity_collection_idstrYesThe unique identifier of the entity collection to retrieve.
request_optionstyping.Optional[RequestOptions]No

Return value: Returns an object of type EntityCollection representing the specified entity collection. The EntityCollection class contains the following properties:

NameTypeDescription
idtyping_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="_id")]The unique identifier for the entity collection.
nametyping.Optional[str]The name of the entity collection.
descriptiontyping.Optional[str]The description of the entity collection.
created_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity collection was created.
updated_attyping.Optional[dt.datetime]

API Reference: Retrieve an entity collection

Update an entity collection

Description: This method updates the specified entity collection.

Function signature and example:

1def update(
2 self,
3 entity_collection_id: str,
4 *,
5 name: typing.Optional[str] = OMIT,
6 description: typing.Optional[str] = OMIT,
7 request_options: typing.Optional[RequestOptions] = None,
8) -> EntityCollection

Parameters:

NameTypeRequiredDescription
entity_collection_idstrYesThe unique identifier of the entity collection to update.
nametyping.Optional[str]NoThe updated name of the entity collection.
descriptiontyping.Optional[str]No
request_optionstyping.Optional[RequestOptions]NoRequest-specific configuration

Return value: Returns an object of type EntityCollection representing the updated entity collection. The EntityCollection class contains the following properties:

NameTypeDescription
idtyping_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="_id")]The unique identifier for the entity collection.
nametyping.Optional[str]The name of the entity collection.
descriptiontyping.Optional[str]The description of the entity collection.
created_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity collection was created.
updated_attyping.Optional[dt.datetime]

API Reference: Update an entity collection

Delete an entity collection

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

Function signature and example:

1def delete(self, entity_collection_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None

Parameters:

NameTypeRequiredDescription
entity_collection_idstrYesThe unique identifier of the entity collection to delete.
request_optionstyping.Optional[RequestOptions]No

Return value: None. This method doesn’t return any data upon successful completion.

API Reference: Delete an entity collection

Entities

Entities represent logical groupings of related entities.

List entities in an entity collection

Description: This method returns a list of the entities in the specified entity collection.

Function signature and example:

1def list(
2 self,
3 entity_collection_id: str,
4 *,
5 page: typing.Optional[int] = None,
6 page_limit: typing.Optional[int] = None,
7 name: typing.Optional[str] = None,
8 status: typing.Optional[EntitiesListRequestStatus] = None,
9 sort_by: typing.Optional[EntitiesListRequestSortBy] = None,
10 sort_option: typing.Optional[str] = None,
11 request_options: typing.Optional[RequestOptions] = None,
12) -> SyncPager[Entity]

Parameters:

NameTypeRequiredDescription
entity_collection_idstrYesThe unique identifier of the entity collection for which the platform will retrieve the entities.
pagetyping.Optional[int]NoA number that identifies the page to retrieve. Default: 1.
page_limittyping.Optional[int]NoThe number of items to return on each page. Default: 10. Max: 50.
nametyping.Optional[str]No
statustyping.Optional[EntitiesListRequestStatus]NoFilter entities by status. Values: processing, ready.
sort_bytyping.Optional[EntitiesListRequestSortBy]NoThe field to sort on. The following options are available:
- created_at: Sorts by the time, in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity was created.
- updated_at: Sorts by the time, in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity was updated.
- name: Sorts by the name.
sort_optiontyping.Optional[str]NoThe sorting direction. The following options are available: asc and desc. Default: desc.
request_optionstyping.Optional[RequestOptions]NoRequest-specific configuration

Return value: Returns a SyncPager[Entity] object containing a paginated list of Entity objects, representing the entities that match the specified criteria.

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 Entity class contains the following properties:

NameTypeDescription
id typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="_id")]The unique identifier of the entity.
nametyping.Optional[str]The name of the entity.
descriptiontyping.Optional[str]A description of the entity.
metadatatyping.Optional[typing.Dict[str, typing.Optional[typing.Any]]]Custom metadata for the entity.
asset_idstyping.Optional[typing.List[str]]An array of asset IDs associated with the entity.
statustyping.Optional[EntityStatus]The status of the entity. Values: processing, ready.
created_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity was created.
updated_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity was last updated.

API Reference: List entities in an entity collection

Create an entity

Description: This method creates an entity within a specified entity collection. Each entity must be associated with at least one asset.

Function signature and example:

1def create(
2 self,
3 entity_collection_id: str,
4 *,
5 name: str,
6 asset_ids: typing.Sequence[str],
7 description: typing.Optional[str] = OMIT,
8 metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
9 request_options: typing.Optional[RequestOptions] = None,
10) -> Entity

Parameters:

NameTypeRequiredDescription
entity_collection_idstrYesThe unique identifier of the entity collection in which to create the entity.
namestrYesThe name of the entity. Make sure you use a succinct and descriptive name.
asset_idstyping.Sequence[str]YesAn array of asset IDs to associate with the entity. You must provide at least one value.
descriptiontyping.Optional[str]NoA description of the entity.
metadatatyping.Optional[typing.Dict[str, typing.Optional[typing.Any]]]No
request_optionstyping.Optional[RequestOptions]NoRequest-specific configuration

Return value: Returns an object of type Entity representing the newly created entity. The Entity class contains the following properties:

NameTypeDescription
id typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="_id")]The unique identifier of the entity.
nametyping.Optional[str]The name of the entity.
descriptiontyping.Optional[str]A description of the entity.
metadatatyping.Optional[typing.Dict[str, typing.Optional[typing.Any]]]Custom metadata for the entity.
asset_idstyping.Optional[typing.List[str]]An array of asset IDs associated with the entity.
statustyping.Optional[EntityStatus]The status of the entity. Values: processing, ready.
created_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity was created.
updated_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity was last updated.

API Reference: Create an entity

Create multiple entities in bulk

Description: This method creates multiple entities within a specified entity collection in a single request. Each entity must be associated with at least one asset. This method is useful for efficiently adding multiple entities, such as a roster of players or a group of characters.

Function signature and example:

1def create_bulk(
2 self,
3 entity_collection_id: str,
4 *,
5 entities: typing.Sequence[EntitiesCreateBulkRequestEntitiesItem],
6 request_options: typing.Optional[RequestOptions] = None,
7) -> BulkCreateEntityResponse

Parameters:

NameTypeRequiredDescription
entity_collection_idstrYesThe unique identifier of the entity collection in which to create the entities.
entitiestyping.Sequence[EntitiesCreateBulkRequestEntitiesItem]YesAn array of objects, each representing an entity to be created. Each object must include the name and asset_ids properties, and can optionally include description and metadata. Each entity must be associated with at least one asset.
request_optionstyping.Optional[RequestOptions]NoRequest-specific configuration

The EntitiesCreateBulkRequestEntitiesItem class contains the following properties:

NameTypeDescription
namestrThe name of the entity. Make sure you use a succinct and descriptive name.
descriptiontyping.Optional[str]A description of the entity.
metadatatyping.Optional[typing.Dict[str, typing.Optional[typing.Any]]]Optional metadata for the entity, provided as key-value pairs to store additional context or attributes. Use metadata to categorize or describe the entity for easier management and search. Keys must be of type string, and values can be of type string, integer, float, or boolean.
asset_idstyping.List[str]An array of asset IDs to associate with the entity. You must provide at least one value.

Return value: Returns an object of type BulkCreateEntityResponse representing the result of the bulk entity creation operation. The BulkCreateEntityResponse class contains the following properties:

NameTypeDescription
success_counttyping.Optional[int]The number of entities that were successfully created.
failed_counttyping.Optional[int]The number of entities that failed to be created due to errors, such as missing assets.
entitiestyping.Optional[typing.List[BulkCreateEntityResponseEntitiesItem]]An array of objects representing the entities that were successfully created.
errorstyping.Optional[typing.List[BulkCreateEntityResponseErrorsItem]]An array of error objects for entities that failed to be created.

The BulkCreateEntityResponseEntitiesItem class contains the following properties:

NameTypeDescription
idtyping_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="_id")]The unique identifier of the entity.
nametyping.Optional[str]The name of the entity.
statustyping.Optional[EntityStatus]The status of the entity. Values:
- processing: The entity is being processed and is not yet ready for use in searches.
- ready: The entity is fully processed and can be used in search queries.

The BulkCreateEntityResponseErrorsItem class contains the following properties:

NameTypeDescription
entity_indextyping.Optional[int]The zero-based index of the entity in the original request array. This helps identify which specific entity failed to be created.
entity_nametyping.Optional[str]The name of the entity that failed to be created, as provided in the request.
error_reasontyping.Optional[str]A message explaining why the entity failed to be created.

API Reference: Create multiple entities in bulk

Retrieve an entity

Description: This method retrieves details about the specified entity.

Function signature and example:

1def retrieve(
2 self, entity_collection_id: str, entity_id: str, *, request_options: typing.Optional[RequestOptions] = None
3 ) -> Entity

Parameters:

NameTypeRequiredDescription
entity_collection_idstrYesThe unique identifier of the entity collection that contains the entity to retrieve.
entity_idstrYesThe unique identifier of the entity to retrieve.
request_optionstyping.Optional[RequestOptions]NoRequest-specific configuration

Return value: Returns an object of type Entity representing the specified entity. The Entity class contains the following properties:

NameTypeDescription
id typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="_id")]The unique identifier of the entity.
nametyping.Optional[str]The name of the entity.
descriptiontyping.Optional[str]A description of the entity.
metadatatyping.Optional[typing.Dict[str, typing.Optional[typing.Any]]]Custom metadata for the entity.
asset_idstyping.Optional[typing.List[str]]An array of asset IDs associated with the entity.
statustyping.Optional[EntityStatus]The status of the entity. Values: processing, ready.
created_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity was created.
updated_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity was last updated.

API Reference: Retrieve an entity

Update an entity

Description: This method updates the specified entity within an entity collection. This operation allows modification of the entity’s name, description, or metadata. Note that this method does not affect the assets associated with the entity.

Function signature and example:

1def update(
2 self,
3 entity_collection_id: str,
4 entity_id: str,
5 *,
6 name: typing.Optional[str] = OMIT,
7 description: typing.Optional[str] = OMIT,
8 metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
9 request_options: typing.Optional[RequestOptions] = None,
10) -> Entity

Parameters:

NameTypeRequiredDescription
entity_collection_idstrYesThe unique identifier of the entity collection containing the entity to be updated.
entity_idstrYesThe unique identifier of the entity to be updated.
nametyping.Optional[str]NoThe updated name of the entity.
descriptiontyping.Optional[str]NoThe updated description of the entity.
metadatatyping.Optional[typing.Dict[str, typing.Optional[typing.Any]]]NoUpdated metadata for the entity. If provided, this completely replaces the existing metadata.
request_optionstyping.Optional[RequestOptions]NoRequest-specific configuration

Return value: Returns an object of type Entity representing the updated entity. The Entity class contains the following properties:

NameTypeDescription
id typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="_id")]The unique identifier of the entity.
nametyping.Optional[str]The name of the entity.
descriptiontyping.Optional[str]A description of the entity.
metadatatyping.Optional[typing.Dict[str, typing.Optional[typing.Any]]]Custom metadata for the entity.
asset_idstyping.Optional[typing.List[str]]An array of asset IDs associated with the entity.
statustyping.Optional[EntityStatus]The status of the entity. Values: processing, ready.
created_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity was created.
updated_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity was last updated.

API Reference: Update an entity

Delete an entity

Description: This method deletes a specific entity from an entity collection. It permanently removes the entity and its associated data, but does not affect the assets associated with this entity.

Function signature and example:

1def delete(
2 self, entity_collection_id: str, entity_id: str, *, request_options: typing.Optional[RequestOptions] = None
3 ) -> None

Parameters:

NameTypeRequiredDescription
entity_collection_idstrYesThe unique identifier of the entity collection containing the entity to be deleted.
entity_idstrYesThe unique identifier of the entity to be deleted.
request_optionstyping.Optional[RequestOptions]NoRequest-specific configuration

Return value: None. This method doesn’t return any data upon successful completion.

API Reference: Delete an entity

Add assets to an entity

Description: This method adds assets to the specified entity within an entity collection. Assets are used to identify the entity in media content, and adding multiple assets can improve the accuracy of entity recognition in searches. When assets are added, the entity may temporarily enter the “processing” state while the platform updates the necessary data. Once processing is complete, the entity status will return to “ready.”

Function signature and example:

1def create_assets(
2 self,
3 entity_collection_id: str,
4 entity_id: str,
5 *,
6 asset_ids: typing.Sequence[str],
7 request_options: typing.Optional[RequestOptions] = None,
8) -> Entity

Parameters:

NameTypeRequiredDescription
entity_collection_idstrYesThe unique identifier of the entity collection that contains the entity to which assets will be added.
entity_idstrYesThe unique identifier of the entity to which assets will be added.
asset_idstyping.Sequence[str]YesAn array of asset IDs to add to the entity.
request_optionstyping.Optional[RequestOptions]NoRequest-specific configuration

Return value: Returns an object of type Entity representing the updated entity with the newly added assets. The Entity class contains the following properties:

NameTypeDescription
id typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="_id")]The unique identifier of the entity.
nametyping.Optional[str]The name of the entity.
descriptiontyping.Optional[str]A description of the entity.
metadatatyping.Optional[typing.Dict[str, typing.Optional[typing.Any]]]Custom metadata for the entity.
asset_idstyping.Optional[typing.List[str]]An array of asset IDs associated with the entity.
statustyping.Optional[EntityStatus]The status of the entity. Values: processing, ready.
created_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity was created.
updated_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity was last updated.

API Reference: Add assets to an entity

Remove assets from an entity

Description: This method removes from the specified entity. Assets are used to identify the entity in media content, and removing assets may impact the accuracy of entity recognition in searches if too few assets remain.

When assets are removed, the entity may temporarily enter a “processing” state while the system updates the necessary data. Once processing is complete, the entity status will return to “ready.”

Notes
  • This operation only removes the association between the entity and the specified assets; it does not delete the assets themselves.
  • An entity must always have at least one asset associated with it. You can’t remove the last asset from an entity.

Function signature and example:

1def delete_assets(
2 self,
3 entity_collection_id: str,
4 entity_id: str,
5 *,
6 asset_ids: typing.Sequence[str],
7 request_options: typing.Optional[RequestOptions] = None,
8) -> Entity

Parameters:

NameTypeRequiredDescription
entity_collection_idstrYesThe unique identifier of the entity collection that contains the entity from which assets will be removed.
entity_idstrYesThe unique identifier of the entity from which assets will be removed.
asset_idstyping.Sequence[str]YesAn array of asset IDs to remove from the entity.
request_optionstyping.Optional[RequestOptions]NoRequest-specific configuration

Return value: Returns an object of type Entity representing the updated entity after the specified assets have been removed. The Entity class contains the following properties:

NameTypeDescription
id typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="_id")]The unique identifier of the entity.
nametyping.Optional[str]The name of the entity.
descriptiontyping.Optional[str]A description of the entity.
metadatatyping.Optional[typing.Dict[str, typing.Optional[typing.Any]]]Custom metadata for the entity.
asset_idstyping.Optional[typing.List[str]]An array of asset IDs associated with the entity.
statustyping.Optional[EntityStatus]The status of the entity. Values: processing, ready.
created_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity was created.
updated_attyping.Optional[dt.datetime]The date and time, in RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”), when the entity was last updated.

API Reference: Remove assets from an entity