Skip to main content

Note

Looking for the and you use to connect your own app to Clerk? Those are different from the API keys described here. You can copy them from the API keys page in the Clerk Dashboard, or learn more in the Clerk environment variables reference.

Note

In most cases, you'll want to verify API keys using framework-specific helpers like auth() in Next.js, which handles the verification automatically. See the verifying API keys guide for more details.

Verifies the given API key.

  • If the API key is valid, the method returns the API key object with its properties.
  • If the API key is invalid, revoked, or expired, the method will throw an error.

Returns the verified APIKey object.

function verify(secret: string): Promise<APIKey>
  • Name
    secret
    Type
    string
    Description

    The secret of the API key to verify.

Note

Using clerkClient varies based on the SDK you're using. Refer to the overview for usage details, including guidance on how to access the userId and other properties.

const apiKeySecret = 'ak_live_123'

const response = await clerkClient.apiKeys.verify(apiKeySecret)

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint POST/api_keys/verify. See the BAPI reference for more information.

Feedback

What did you think of this content?

Last updated on