Limits
Limits API
Retrieve a limit value by id
- async LimitsAPI.retrieve(id: str) Limit | None
Retrieve a limit value by its id.
Retrieves a limit value by its limitId.
- Parameters:
id (str) – Limit ID to retrieve. Limits are identified by an id containing the service name and a service-scoped limit name. For instance atlas.monthly_ai_tokens is the id of the atlas service limit monthly_ai_tokens. Service and limit names are always in lower_snake_case.
- Returns:
The requested limit, or None if not found.
- Return type:
Limit | None
Examples
Retrieve a single limit by id:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> res = client.limits.retrieve(id="atlas.monthly_ai_tokens")
List limit values
- async LimitsAPI.list(
- filter: Prefix | None = None,
- limit: int | None = 25,
-
Retrieves all limit values for a specific project. Optionally filter by limit ID prefix using a Prefix filter.
- Parameters:
filter (Prefix | None) – Optional Prefix filter to apply on the limitId property (only Prefix filters are supported).
limit (int | None) – Maximum number of limits to return. Defaults to 25. Set to None or -1 to return all limits
- Returns:
List of all limit values in the project.
- Return type:
Examples
List all limits:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> limits = client.limits.list(limit=None)
List limits filtered by prefix (e.g., all limits for the ‘atlas’ service):
>>> from cognite.client.data_classes.filters import Prefix >>> prefix_filter = Prefix("limitId", "atlas.") >>> limits = client.limits.list(filter=prefix_filter)
Limits Data Classes
- class cognite.client.data_classes.limits.Limit(limit_id: str, value: float | int)
Bases:
CogniteResourceA singular representation of a Limit.
Limits are identified by an id containing the service name and a service-scoped limit name. For instance atlas.monthly_ai_tokens is the id of the atlas service limit monthly_ai_tokens. Service and limit names are always in lower_snake_case.
- Parameters:
limit_id (str) – Limits are identified by an id containing the service name and a service-scoped limit name.
value (float | int) – The numeric value of the limit.
- as_id() str
Returns the limit ID.
- class cognite.client.data_classes.limits.LimitList(
- resources: Sequence[T_CogniteResource],
Bases:
CogniteResourceList[Limit]- as_ids() list[str]
Returns a list of limit IDs.