Get API request metrics
Count the requests that the Unkey API served for your workspace per time bucket, split by status class.
The filters have the same shape as in logs.listApiRequests, without requestId. In one field, values under is, contains, startsWith, and endsWith are combined with OR. Values under isNot and notContains, and the range operators gt, gte, lt, and lte, are combined with AND. Different fields are combined with AND. Every text match is exact and case-sensitive.
filters.time sets the window. A missing lower bound is the start of your log retention, and a missing upper bound is now. Unkey picks the bucket width from the window. It is the distance between the time of two points. The first bucket starts at or before the window start and counts its whole width. Windows reach back at most 100 days, and requests outside the log retention of your workspace are not counted.
Required Permissions
Your root key must have the following permission:
unkey:v1:<workspace_id>:logs/apiRequests#read
Authorizations
Unkey uses bearer tokens for authentication. Public integrations use root keys, while the dashboard proxy uses short-lived JWTs. To authenticate, include the token in the Authorization header of each request:
Root keys have specific permissions attached to them, controlling what operations they can perform. Resource permissions use Unkey Resource Names plus actions, like unkey:v1:ws_123:projects/*/keyspaces/*/keys/*#write.
Security best practices:
- Keep root keys secure and never expose them in client-side code
- Use different root keys for different environments
- Rotate keys periodically, especially after team member departures
- Create keys with minimal necessary permissions following least privilege principle
- Monitor key usage with audit logs.
Body
Response
One point per bucket, oldest first, with zero counts for buckets without requests.