valid field in response data to determine if the key is authorized. A 429 may be returned if the workspace exceeds its API rate limit.
Required permissions:
Your root key needs one of:
api.*.verify_key(verify keys in any API)api.<api_id>.verify_key(verify keys in specific API)
code: NOT_FOUND to avoid leaking key existence.
See the API reference for the full HTTP endpoint documentation.
Usage
Flags
The API key to verify, exactly as provided by your user. Include any prefix — even small changes will cause verification to fail.
Metadata tags for analytics in
key=value format. Attaches metadata for analytics and monitoring without affecting verification outcomes. Enables segmentation of API usage in dashboards by endpoint, client version, region, or custom dimensions. Avoid including sensitive data in tags as they may appear in logs and analytics reports.Permission query to check, supports
AND/OR operators and parentheses for grouping. Examples: "documents.read", "documents.read AND documents.write", "(documents.read OR documents.write) AND users.view". Verification fails if the key lacks the required permissions through direct assignment or role inheritance.JSON object for credit consumption configuration. Controls credit deduction for usage-based billing and quota enforcement. Omitting this field uses the default cost of 1 credit per verification.
JSON array of rate limit checks to enforce during verification. Omitting this field skips rate limit checks entirely, relying only on configured key rate limits. Multiple rate limits can be checked simultaneously, each with different costs and temporary overrides.
Migration provider ID for on-demand key migration from your previous system. Reach out for migration support at support@unkey.dev.
Global Flags
| Flag | Type | Description |
|---|---|---|
--root-key | string | Override root key ($UNKEY_ROOT_KEY) |
--api-url | string | Override API base URL (default: https://api.unkey.com) |
--config | string | Path to config file (default: ~/.unkey/config.toml) |
--output | string | Output format — use json for raw JSON |
Examples
Output
Default output shows the request ID with latency, followed by the verification result:--output=json, the full response envelope is returned:
valid field is false and code indicates the reason:
code values: VALID, NOT_FOUND, FORBIDDEN, INSUFFICIENT_PERMISSIONS, USAGE_EXCEEDED, RATE_LIMITED, DISABLED, EXPIRED.
