Retrieve labels
- async AsyncCogniteClient.labels.retrieve(
- external_id: str | SequenceNotStr[str],
- ignore_unknown_ids: bool = False,
Retrieve one or more label definitions by external id.
Deprecated since version 8.23.0: The Labels API is deprecated and is scheduled for removal on 2027-12-31. There is no direct replacement; model labels as a concept in your data model. See https://docs.cognite.com/cdf/deprecated for details and migration guidance.
- Parameters:
external_id (str | SequenceNotStr[str]) – External ID or list of external ids
ignore_unknown_ids (bool) – If True, ignore IDs and external IDs that are not found rather than throw an exception.
- Returns:
The requested label definition(s)
- Return type:
LabelDefinition | LabelDefinitionList | None
Examples
Get label by external id:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> res = client.labels.retrieve(external_id="my_label", ignore_unknown_ids=True)