Skip to main content
Docs

list()

Lists API keys for a given user or organization.

function list(queryParams: GetAPIKeyListParams): Promise<PaginatedResourceResponse<APIKey[]>>
  • Name
    subject
    Type
    string
    Description

    The user or organization ID to query API keys by.

  • Name
    includeInvalid?
    Type
    boolean
    Description

    Whether to include invalid API keys (revoked or expired). Defaults to false.

  • Name
    limit?
    Type
    number
    Description

    The maximum number of API keys to return. Defaults to 10.

  • Name
    offset?
    Type
    number
    Description

    The number of API keys to skip before returning results. Defaults to 0.

Note

Using clerkClient varies based on your framework. Refer to the JS Backend SDK overview for usage details, including guidance on how to access the userId and other properties.

const apiKeys = await clerkClient.apiKeys.list({
  subject: 'user_xxx',
})
const apiKeys = await clerkClient.apiKeys.list({
  subject: 'user_xxx',
  includeInvalid: true,
})
const apiKeys = await clerkClient.apiKeys.list({
  subject: 'user_xxx',
  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

What did you think of this content?

Last updated on