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
The API namespace whose keys you want to list. Returns all keys in this API, subject to pagination and filters.
1
"api_1234abcd"
Maximum number of keys to return per request. Balance between response size and number of pagination calls needed.
1 <= x <= 100
Pagination cursor from previous response to fetch next page.
Use when hasMore: true
in previous response.
"key_1234abcd"
Filter keys by external ID to find keys for a specific user or entity. Must exactly match the externalId set during key creation.
3
"user_1234abcd"
When true, attempts to include the plaintext key value in the response. SECURITY WARNING:
- This requires special permissions on the calling root key
- Only works for keys created with 'recoverable: true'
- Exposes sensitive key material in the response
- Should only be used in secure administrative contexts
- Never enable this in user-facing applications
EXPERIMENTAL: Skip the cache and fetch the keys directly from the database. This ensures you see the most recent state, including keys created moments ago. Use this when:
- You've just created a key and need to display it immediately
- You need absolute certainty about the current key state
- You're debugging cache consistency issues
This parameter comes with a performance cost and should be used sparingly.
Response
Successfully retrieved paginated keys. Use the pagination cursor for additional results when hasMore: true
.
Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The requestId
is particularly important when troubleshooting issues with the Unkey support team.
Array of API keys with complete configuration and metadata.
100
Pagination metadata for list endpoints. Provides information necessary to traverse through large result sets efficiently using cursor-based pagination.