Clerk Backend SDK
Clerk Backend SDK
The Clerk Backend SDK exposes Clerk's backend API resources and low-level authentication utilities for JavaScript environments. While the backend SDK is mainly used as a building block for Clerk's higher-level SDKs, it can also be used on its own for advanced flows and custom integrations.
Clerk SDKs expose an instance of the Clerk Backend SDK for use in server environments.
The Backend SDK is accessible via the clerkClient
object if you are using Next.js.
The Backend SDK is accessible via the createClerkClient
function if you are using Remix.
The Backend SDK is accessible via the clerkClient
object if you are using Fastify.
The Backend SDK is accessible via the clerkClient
object if you are using Node.
Error handling
Backend SDK functions do not throw errors when something goes wrong. Instead, they return a ClerkBackendApiResponse
object, just as they would if there were no errors. You can check for errors on the .errors
property of the response. For example:
This approach to error handling allows Clerk to produce strongly-typed errors for those using TypeScript, and can reduce the need for try/catch
blocks in your code.
Feedback
Last updated on