Authorizations
Unkey uses API keys (root keys) for authentication. These keys authorize access to management operations in the API. To authenticate, include your root key in the Authorization header of each request:
Authorization: Bearer unkey_123
Root keys have specific permissions attached to them, controlling what operations they can perform. Key permissions follow a hierarchical structure with patterns like resource.resource_id.action
(e.g., apis.*.create_key
, apis.*.read_api
).
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
Specifies which key to retrieve using the database identifier returned from keys.createKey
.
Do not confuse this with the actual API key string that users include in requests.
Key data includes metadata, permissions, usage statistics, and configuration but never the plaintext key value unless decrypt=true
.
Find this ID in creation responses, key listings, dashboard, or verification responses.
3 - 255
"key_1234abcd"
Controls whether to include the plaintext key value in the response for recovery purposes.
Only works for keys created with recoverable=true
and requires the decrypt_key
permission.
Returned keys must be handled securely, never logged, cached, or stored insecurely.
Use only for legitimate recovery scenarios like user password resets or emergency access. Most applications should keep this false to maintain security best practices and avoid accidental key exposure. Decryption requests are audited and may trigger security alerts in enterprise environments.
Response
Successfully retrieved key information. When decrypt: true
, includes plaintext key value for recoverable keys.