list()
Gets a list of API keys for the given user or Organization. By default, the list is returned in descending order by creation date (newest first).
Returns a PaginatedResourceResponse object with a data property containing an array of APIKey objects and a totalCount property containing the total number of API keys for the user or Organization.
function list(queryParams: GetAPIKeyListParams): Promise<PaginatedResourceResponse<APIKey[]>>- Name
includeInvalid?- Type
boolean- Description
Whether to include invalid API keys (revoked or expired). Defaults to
false.
- Name
subject- Type
string- Description
The user or Organization ID to query API keys by.
Filer by user ID
Gets a list of API keys for a user
const userId = 'user_123'
const apiKeys = await clerkClient.apiKeys.list({
subject: userId,
})Filter by user ID, including invalid API keys
Gets a list of API keys for a user, including invalid ones
const userId = 'user_123'
const apiKeys = await clerkClient.apiKeys.list({
subject: userId,
includeInvalid: true,
})Filter by user ID, including invalid API keys, with pagination
Gets a list of API keys for a user with pagination
const userId = 'user_123'
const apiKeys = await clerkClient.apiKeys.list({
subject: userId,
limit: 20,
offset: 0,
})Backend API (BAPI) endpoint
This method in the SDK is a wrapper around the BAPI endpoint GET/api_keys. See the BAPI reference for more information.
Feedback
Last updated on