Retrieve a paginated list of API keys for dashboard and administrative interfaces.
Use this to build key management dashboards, filter keys by user with 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:
api.*.read_keyorapi.<api_id>.read_key(to read keys)api.*.read_apiorapi.<api_id>.read_api(to read the API)api.*.decrypt_keyorapi.<api_id>.decrypt_key(additionally required when using--decrypt)
See the API reference for the full HTTP endpoint documentation.
Usage#
Flags#
The API namespace whose keys you want to list. Returns all keys in this API, subject to pagination and filters.
Maximum number of keys to return per request. Balance between response size and number of pagination calls needed. Must be between 1 and 100.
Default: 100
Pagination cursor from a previous response to fetch the next page. Use when hasMore: true in the previous response.
Filter keys by external ID to find keys for a specific user or entity. Must exactly match the externalId set during key creation.
When true, includes the plaintext key value in the response. Only works for keys created with recoverable: true. Requires the decrypt_key permission on the calling root key. Never enable this in user-facing applications.
Default: false
Experimental. Skip the cache and fetch keys directly from the database. Use this when you have just created a key and need to see it immediately, or when debugging cache consistency issues. This comes with a performance cost and should be used sparingly.
Default: false
Global Flags#
| Flag | Type | Description |
|---|---|---|
--root-key | string | Override root key ($UNKEY_ROOT_KEY) |
--api-url | string | Override API base URL (default: https://api.unkey.com) |
--config | string | Path to config file (default: ~/.unkey/config.toml) |
--output | string | Output format. Use json for raw JSON |
--body | string | Send this JSON string as the request body. You cannot combine it with request-building flags. |
Examples#
Output#
Default output shows the request ID, followed by the list of keys:
With --output=json, the full response envelope including pagination is returned: