Skip to main content
Execute custom SQL queries against your key verification analytics. Use this to inspect verification patterns, monitor outcomes, and build custom reports over your key usage data. Only SELECT queries are allowed. The response rows are dynamic — fields vary based on your SQL SELECT clause and can include any combination of columns such as time, outcome, count, key_id, and more. For complete documentation including available tables, columns, data types, and query examples, see the schema reference in the API documentation. Required permissions:
  • analytics.*.read_verifications (to query verification analytics)
See the API reference for the full HTTP endpoint documentation.

Usage

unkey api analytics get-verifications [flags]

Flags

--query
string
required
SQL SELECT query to execute against your analytics data. Only SELECT queries are allowed. The query runs against the key_verifications_v1 table, which contains columns like time, key_id, outcome, and more. See the API reference for the full schema.

Global Flags

FlagTypeDescription
--root-keystringOverride root key ($UNKEY_ROOT_KEY)
--api-urlstringOverride API base URL (default: https://api.unkey.com)
--configstringPath to config file (default: ~/.unkey/config.toml)
--outputstringOutput format — use json for raw JSON

Examples

unkey api analytics get-verifications --query="SELECT COUNT(*) as total FROM key_verifications_v1 WHERE outcome = 'VALID' AND time >= now() - INTERVAL 7 DAY"

Output

Default output shows the request ID with latency, followed by the query results:
req_2c9a0jf23l4k567 (took 120ms)

[
  {
    "outcome": "VALID",
    "count": 1234,
    "time": 1696118400000
  },
  {
    "outcome": "RATE_LIMITED",
    "count": 56,
    "time": 1696118400000
  }
]
With --output=json, the full response envelope is returned:
{
  "meta": {
    "requestId": "req_2c9a0jf23l4k567"
  },
  "data": [
    {
      "outcome": "VALID",
      "count": 1234,
      "time": 1696118400000
    },
    {
      "outcome": "RATE_LIMITED",
      "count": 56,
      "time": 1696118400000
    }
  ]
}
Last modified on March 26, 2026