Skip to main content

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

NameTypeDefaultDescription
api_key_idstring-Filter to a single API key. When omitted, all keys with attributed usage in the window are returned.
fromstring-ISO datetime; window start.
tostring-ISO datetime; window end.
daysinteger-Window in days (1-366). Mutually exclusive with from/to.

Response Format

FieldTypeDescription
apiKeysarrayPer-key consumption rows for the resolved window, sorted by credits desc.
apiKeys[].apiKeyIdstring
apiKeys[].apiKeyNamestring
apiKeys[].apiKeyPrefixstring
apiKeys[].creatorEmailstring | null
apiKeys[].authMethodstring
apiKeys[].oauthClientIdstring | null
apiKeys[].oauthClientNamestring | null
apiKeys[].deletedbooleanTrue if the underlying api_keys row no longer exists (rotated/deleted). Historical consumption is preserved for audit.
apiKeys[].callCountintegerBillable calls (excludes cache hits) within the window.
apiKeys[].creditsnumber
apiKeys[].byToolarray
apiKeys[].byTool[].toolNamestring
apiKeys[].byTool[].callCountinteger
apiKeys[].byTool[].creditsnumber
fromstringStart of the consumption window (inclusive), ISO string.
tostringEnd of the consumption window (exclusive), ISO string.