Skip to main content
Docs

verify()

Verifies an API key secret. 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.

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 guideNext.js Icon for more details.

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

    The API key secret to verify.

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 apiKey = await clerkClient.apiKeys.verify('ak_live_xxx')

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