Retrieve an asset by id

async AsyncCogniteClient.assets.retrieve(
id: int | None = None,
external_id: str | None = None,
) Asset | None

Retrieve a single asset by id.

Parameters:
  • id (int | None) – ID

  • external_id (str | None) – External ID

Returns:

Requested asset or None if it does not exist.

Return type:

Asset | None

Examples

Get asset by id:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> res = client.assets.retrieve(id=1)

Get asset by external id:

>>> res = client.assets.retrieve(external_id="1")