Bearer Authentication
Authentication is performed using HTTP Bearer authentication in theAuthorization header:
Security Best Practices
Never expose your root key in client-side code or include it in public repositories. For frontend applications, always use a backend server to proxy requests to the Unkey API.Root Key Management
Root keys can be created and managed through the Unkey dashboard. We recommend:- Using Different Keys for Different Environments: Maintain separate root keys for development, staging, and production
 - Rotating Keys Regularly: Create new keys periodically and phase out old ones
 - Setting Clear Key Names: Name your keys according to their use case for better manageability
 
Key Permissions System
Unkey implements a sophisticated RBAC (Role-Based Access Control) system for root keys. Permissions are defined as tuples of:- ResourceType: The category of resource (api, ratelimit, rbac, identity)
 - ResourceID: The specific resource instance
 - Action: The operation to perform on that resource
 
Available Resource Types
| Resource Type | Description | 
|---|---|
api | API-related resources, such as endpoints and keys | 
ratelimit | Rate limiting resources and configuration | 
rbac | Permissions and roles management | 
identity | User and identity management | 
Permission Examples
Specific permission to manage a single API:Authentication Errors
If your authentication fails, you’ll receive a 401 Unauthorized or 403 Forbidden response with an error message:- Missing the Authorization header
 - Invalid key format
 - Revoked or expired root key
 - Using a key with insufficient permissions