Request Access
To get started:- Find your workspace ID in the Unkey dashboard settings
- Email us at support@unkey.dev with:
- Your workspace ID
- Your use case (billing, dashboards, reporting, etc.)
- Expected query volume
Authentication
Analytics queries require a root key with analytics permissions. Create one in your dashboard:- Go to Settings → Root Keys
- Click Create New Root Key
- Select permissions:
api.*.read_analyticsORapi.<api_id>.read_analytics - Copy and securely store your root key
Your First Query
Once you have access, execute your first analytics query using the/v2/analytics.getVerifications endpoint.
Count Total Verifications
Count the total number of key verifications in the last 7 days across all your APIs to get a high-level view of your overall usage volume.Break Down by Outcome
Group verifications by their outcome (VALID, RATE_LIMITED, USAGE_EXCEEDED, etc.) over the last 24 hours to understand the distribution of successful vs. failed requests.
Top Users by Usage
Identify your most active users by counting their total verifications over the last 30 days to spot power users or potential abuse patterns.Understanding the Response
Analytics queries return data as an array of objects:data array contains fields from your SELECT clause. The field names match the column names or aliases you specified in your query.
Filtering by API or User
You can filter queries to specific APIs or users. Usekey_space_id to filter by API (find this identifier in your API settings) and external_id to filter by user. These fields support standard SQL operators: =, !=, IN, NOT IN, <, >, etc.
Automatic filtering: All queries are automatically filtered based on your root key’s permissions:
- Workspace filtering: All queries are scoped to your workspace. You do not need to filter by
workspace_id. - API filtering: If your root key has
api.<api_id>.read_analyticspermissions (scoped to a specific API), queries are automatically filtered to that API’skey_space_id. If your root key hasapi.*.read_analytics(all APIs), you should filter bykey_space_idyourself to query specific APIs.
Queries are subject to resource limits (execution time, memory, result size,
and quota). See Query Restrictions for
complete details on limits and error codes.