- API playgrounds that need to display keys for testing
- Improved developer experience when keys are lost
- Customer support scenarios requiring key retrieval
How the vault works
Unkey’s vault is a secure storage system for secrets built with defense in depth:Encrypted at rest
All secrets are encrypted using industry-standard encryption before storage
Isolated storage
Vault runs on separate infrastructure from the main database
Multi-layer protection
Requires vault data + main database + encryption keys to decrypt
Regular rotation
Encryption keys are rotated regularly to minimize exposure window
Security guarantees
- A leak of vault data does not expose secrets
- A leak of the main database does not expose secrets
- A leak of the main encryption keys does not expose secrets
Opting in to key recovery
By default, we only store key hashes, not encrypted keys.Enable encryption permission
Your root key must have the
encrypt_key permission to create recoverable keys.- Go to Settings → Root Keys
- Edit your root key or create a new one
- Enable the
encrypt_keypermission
Contact us to enable recovery
Send an email to [email protected] to opt in to key recovery.Include in your email:
- Send from the email address associated with your workspace
- The
API IDyou want to enable recovery for - Confirmation you understand the security implications
This is not retroactive. Existing keys were never stored and cannot be recovered. Only keys created after opting in can be recovered.
Creating recoverable keys
When creating a key via API, setrecoverable: true:
- Returned to you in plaintext (this is the only time you’ll see it normally)
- Stored as a hash for verification
- Stored encrypted in the vault for recovery
Recovering plaintext keys
Both the getKey and listKeys endpoints accept adecrypt query parameter.
Get a single key
List keys with decryption
Use cases
API playground
Show users their keys in an API testing interface:Customer support
Retrieve a customer’s lost key:Security considerations
Best practices
- Separate root keys - Use different root keys for encryption and decryption
- Minimal use - Only decrypt when absolutely necessary
- Audit logs - Monitor decryption operations in audit logs
- Rotate regularly - Rotate root keys with decrypt permission frequently
- Network isolation - Call decrypt operations from secure backend services only
When not to use recovery
Do not enable key recovery if:- Your users can easily regenerate keys
- You don’t need to display keys after creation
- Your security policy requires hash-only storage
- You want maximum security with minimal attack surface
Most applications don’t need key recovery. The hash-only approach is more secure and simpler to operate.
Recovering from leaked keys
If a key is compromised:- Revoke immediately - Disable or delete the key via API or dashboard
- Create replacement - Generate a new key for the user
- Check audit logs - Review logs for unauthorized key usage
- Notify user - Inform the user their key was rotated
GitHub secret scanning
Unkey partners with GitHub to automatically detect leaked root keys:- GitHub scans repositories for Unkey key patterns
- If found, GitHub notifies Unkey
- You receive an email alert with details
- Keys remain active to avoid production outages
- Commit content and comments
- Pull request titles, descriptions, comments
- Issue titles, descriptions, comments
- Discussion content
- Gist content and comments
- NPM packages
Get help
Questions about key recovery? Contact [email protected].For security concerns, disclose responsibly to [email protected].
Next steps
Root Keys
Learn about root key permissions
Delete Protection
Prevent accidental key deletion