Get consumption by API key (admin)
Coming soon
The v2 MCP API is in preview and not yet generally available. These pages document its tools and request/response shapes; live data access is limited to enrolled organizations until v2 is released.
Per-key credit consumption with per-tool breakdown for the calling org. Includes deleted/rotated keys (with deleted: true) for historical attribution. Without api_key_id: all keys with attributed usage. Requires an admin-scoped API key.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
api_key_id | string | - | Filter to a single API key. When omitted, all keys with attributed usage in the window are returned. |
from | string | - | ISO datetime; window start. |
to | string | - | ISO datetime; window end. |
days | integer | - | Window in days (1-366). Mutually exclusive with from/to. |
Response Format
| Field | Type | Description |
|---|---|---|
apiKeys | array | Per-key consumption rows for the resolved window, sorted by credits desc. |
apiKeys[].apiKeyId | string | |
apiKeys[].apiKeyName | string | |
apiKeys[].apiKeyPrefix | string | |
apiKeys[].creatorEmail | string | null | |
apiKeys[].authMethod | string | |
apiKeys[].oauthClientId | string | null | |
apiKeys[].oauthClientName | string | null | |
apiKeys[].deleted | boolean | True if the underlying api_keys row no longer exists (rotated/deleted). Historical consumption is preserved for audit. |
apiKeys[].callCount | integer | Billable calls (excludes cache hits) within the window. |
apiKeys[].credits | number | |
apiKeys[].byTool | array | |
apiKeys[].byTool[].toolName | string | |
apiKeys[].byTool[].callCount | integer | |
apiKeys[].byTool[].credits | number | |
from | string | Start of the consumption window (inclusive), ISO string. |
to | string | End of the consumption window (exclusive), ISO string. |