externalId, or retrieve key details for administrative purposes. Each key includes status, metadata, permissions, and usage limits.
Important: Set decrypt: true only in secure contexts to retrieve plaintext key values from recoverable keys.
Required Permissions
Your root key must have the following permissions: For basic key listing:api.*.read_key(to read keys from any API)api.<api_id>.read_key(to read keys from a specific API)
api.*.read_apiorapi.<api_id>.read_api
api.*.decrypt_keyorapi.<api_id>.decrypt_key
Request
The API namespace whose keys you want to list. Returns all keys in this API, subject to pagination and filters.Example:
api_1234abcdMaximum number of keys to return per request. Balance between response size and number of pagination calls needed.Range: 1-100
Pagination cursor from previous response to fetch next page. Use when
hasMore: true in previous response.Example: key_1234abcdFilter keys by external ID to find keys for a specific user or entity. Must exactly match the externalId set during key creation.Example:
user_1234abcdWhen 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
Response
Array of API keys with complete configuration and metadata.
The unique identifier for this key in Unkey’s system.
The first few characters of the key for identification purposes (includes prefix).
The complete plaintext key value. Only present when
decrypt: true and key was created with recoverable: true.Whether the key is currently active.
Human-readable name assigned to the key.
Unix timestamp in milliseconds when the key was created.
Unix timestamp in milliseconds when the key expires. Omitted for permanent keys.
Custom metadata associated with the key.
List of permissions directly assigned to the key.
List of roles assigned to the key.