Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

API reference

Clerk API reference

Clerk authentication and user management

Identifiers
108
With full guides
97
Types
8

Topics covered

  • ClerkProvider setup
  • SignIn / SignUp
  • Protecting routes
  • Organizations
  • Webhooks
  • Session management
  • Customising UI
  • Backend verification

Class

NameWhat it does
UserThe User object represents the current user associated with a Clerk session. It provides core identity, contact, and metadata information.
SessionClerk's Session object represents the current user's authenticated interaction with the server. It is accessed through Clerk and supports inspecting session state, refreshing activity, clearing cached data, and ending the session.
OrganizationClerk is the central interface for Clerk authentication and user management. Its organization APIs create and retrieve organizations and support choosing the active organization.
OrganizationMembershipOrganizationMembership represents a user's membership in an Organization. It provides membership data and methods to update the member's role or remove the membership.
EmailAddressEmailAddress is Clerk's model for a user's email identifier, including its value, identity metadata, linked identifications, and verification state. Use its methods to start verification, remove the address, or obtain its string value.
PhoneNumberPhoneNumber represents a user's phone number and its verification state. Its API supports adding numbers, completing SMS OTP verification, formatting them as E.164 values, and using them for multi-factor authentication.
ExternalAccountExternalAccount represents a verified identity supplied by an external provider such as Google. It exposes provider metadata, granted scopes, account identifiers, and methods to reauthorize or delete the connection.
ClerkClerk is the central JavaScript client for Clerk authentication and user management. Construct it with a publishable key, load it, then use its methods and properties for sign-in, sessions, users, organizations, and related features.

Component

NameWhat it does
ClerkProviderClerkProvider supplies Clerk session and user context to React hooks and components. Put it at the app entry point for global authentication, or lower in the tree for selected routes.
SignInSignIn renders Clerk’s configured authentication UI, allowing users to sign in or sign up by default. It supports customization through properties and can show required session tasks after authentication.
SignUpClerk's SignUp component renders a ready-made user-registration interface. Its behavior follows Clerk Dashboard settings, supports rendering-time customization, and can show required session tasks after registration.
UserButtonUserButton renders an account menu for signed-in users, including account management and sign-out. With multi-session enabled, it also supports switching between accounts.
OrganizationSwitcherOrganizationSwitcher is a Clerk component for multi-tenant apps. It lets signed-in users create, switch between, and manage organizations from the application UI.
SignedInSignedIn conditionally renders its children for users who are signed in. Use it beneath ClerkProvider to show authenticated-only UI.
SignedOutComponent
ProtectProtect conditionally displays content or entire routes for signed-in users and can additionally require a role, permission, feature, or plan. It supports declarative authentication and authorization boundaries.
RedirectToSignInRedirectToSignIn sends unauthenticated users to the sign-in URL configured in the Clerk application. Its navigation behaves like a server-side redirect and replaces the current history entry.
UserProfileUserProfile is Clerk’s ready-made account-management UI for profile, security, and billing settings. In Next.js, render it from an optional catch-all route so its internal navigation works.
OrganizationProfileOrganizationProfile is Clerk’s prebuilt UI for managing an organization’s membership, security, and billing. It includes general organization controls and member administration, with additional tabs shown when supported by configuration and permissions.
OrganizationListComponent
CreateOrganizationCreateOrganization is Clerk's prebuilt UI for creating organizations. It supports post-creation navigation, configurable routing, invitation-step behavior, and a mounting fallback.
RedirectToSignUp<RedirectToSignUp /> declaratively sends signed-out users to the sign-up URL configured for the Clerk application. Its navigation replaces the current history entry, matching server-side redirect behavior.
ClerkLoadedClerkLoaded renders its children after Clerk has loaded and makes the Clerk object available under window.Clerk. The loaded state includes ready and degraded statuses.
ClerkLoadingClerkLoading renders its children while Clerk initializes. Use it to show custom loading feedback before Clerk becomes available.
GoogleOneTapGoogleOneTap renders Google's One Tap UI for Clerk sign-up and sign-in. It supports configurable redirects and stays hidden when the user is already signed in.
WaitlistThe Clerk Waitlist component provides a prebuilt form for collecting early-access requests. It emails users after submission and again when they are approved, while Waitlist mode restricts new-user access until approval.
SignInButtonSignInButton provides a sign-in control that normally navigates to the app's sign-in page. It can wrap custom button content and optionally open sign-in in a modal.
SignUpButtonSignUpButton is an unstyled React trigger for Clerk sign-up. It redirects to the sign-up route by default or opens sign-up in a modal when configured with mode="modal".
SignOutButtonSignOutButton is a Clerk React component that signs users out when activated. It supports default or custom content, targeted session sign-out, and redirecting after successful sign-out.
PricingTablePricingTable renders Clerk Plans and Features in a subscription table. Users or organizations can choose a plan and continue through Clerk checkout.
UserButton.MenuItemsUserButton.MenuItems is the Clerk container for adding custom actions and navigation links to a UserButton menu. It also supports arranging default entries and conditionally displaying menu items.
UserButton.ActionUserButton.Action adds a custom action item to Clerk's UserButton menu. It can run an onClick callback or open a specific page in the UserProfile modal.
UserButton.LinkUserButton.Link adds a custom navigational item to Clerk’s UserButton menu. It requires a destination, visible label, and icon, and supports links to custom pages or external URLs.
UserProfile.PageUserProfile.Page adds a custom page and navigation item inside Clerk's UserProfile UI. Supply page content, a label, an icon, and a URL segment.
OrganizationProfile.PageOrganizationProfile.Page adds a custom page to Clerk's OrganizationProfile navigation. Configure its label, URL segment, optional icon, and child content.
SignIn.StepSignIn.Step conditionally renders the children for a named stage of a Clerk Elements sign-in flow. It is used inside SignIn.Root for stages such as starting sign-in, verification, strategy selection, and password recovery.
SignUp.StepSignUp.Step conditionally renders part of a Clerk Elements sign-up flow. Use start for the initial form, continue for missing required fields, and verifications for configured email or phone checks.

Function

NameWhat it does
authauth() provides the current authentication context for Next.js App Router server code. It exposes the Auth object, route-protection capabilities, and a sign-in redirect helper.
currentUsercurrentUser() asynchronously returns the Backend User for the currently active user in a Next.js App Router server context. Use it in Server Components, Route Handlers, or Server Actions when server-side user data is needed.
clerkMiddlewareClerk's Express clerkMiddleware() reads request cookies and headers for a session JWT and, when present, attaches an Auth object to req.auth. Register it before other middleware, then use getAuth() in routes to apply access decisions.
getAuthgetAuth() reads Clerk authentication state from an Express request and returns an Auth object. Use it in route handlers to protect endpoints and inspect authentication, authorization, and token information.
clerkClientclerkClient is a JavaScript wrapper around Clerk's Backend API. Instantiate it with createClerkClient({ secretKey }), then use resource methods such as users.getUserList().
createRouteMatchercreateRouteMatcher() builds a predicate from an array of Next.js-style route patterns. Calling the predicate with a middleware request returns true when the request matches a supplied route; Clerk now marks the helper deprecated.
verifyTokenverifyToken() validates the signature of a Clerk-generated token and returns its verified claims. Use jwtKey for networkless verification or let Clerk retrieve JWKS from the Backend API.
createClerkClientCreates a customized Clerk Backend API client for JavaScript environments. Provide a Clerk Secret Key in the options object, then use the returned client for server-side resources such as users and invitations.
authMiddlewareFunction

Hook

NameWhat it does
useUseruseUser() provides access to the current user's data in a React application. It also exposes loading and signed-in state so components can safely decide when to read or update the User object.
useAuthuseAuth() gives React components access to Clerk’s current authentication and active-session state. It also provides organization context and helpers such as getToken() and signOut().
useClerkuseClerk() gives a React component access to Clerk's client object. Use it for advanced authentication flows or custom alternatives to Clerk Components.
useOrganizationReact's useOrganization() hook provides access to the currently active Clerk Organization and optionally fetches related collections. Collection data is not populated unless requested with true or configuration options.
useOrganizationListReact hook for accessing a user's organization memberships, invitations, and suggestions. It also supports creating organizations and changing the active organization.
useSessionuseSession() gives a React component the current Clerk session, authentication-loading state, sign-in state, and active-session helpers. Check loading and sign-in status before accessing session properties.
useSessionListuseSessionList() exposes the current user's sessions registered on the client device. Use isLoaded to wait for Clerk initialization before reading sessions or using session-management operations.
useSignInHook
useSignUpuseSignUp() gives a React component access to Clerk’s current SignUpFuture resource. Use its returned state and resource to inspect and manage a sign-up attempt, including custom flows.
useReverificationuseReverification wraps a sensitive asynchronous action and handles session reverification when the user's credentials are no longer fresh. Clerk's default modal retries the original action after successful verification, or you can supply a custom UI handler.
useEmailLinkuseEmailLink provides Clerk's email-link authentication flow API. Use it to start a flow that emails a verification link and redirects the user to an application route for verification.

Interface

NameWhat it does
SignInResourceInterface
SignUpResourceSignUpResource represents Clerk's current sign-up attempt and provides its state plus methods for managing registration. It is used to implement custom sign-up flows after Clerk has loaded.
UserResourceUserResource is Clerk’s type for a user object used in application code. Import it through the SDK’s public types entry point to add type safety to user data and operations.
SessionResourceInterface
OrganizationResourceOrganizationResource is Clerk’s client-side object type for an organization. It is returned by organization retrieval and creation methods and can be used as the active-organization value.

Type Alias

NameWhat it does
ClerkProviderPropsClerkProviderProps is the props type accepted by ClerkProvider. It configures Clerk's application-wide authentication context, redirects, appearance, navigation, and integration-specific behavior.
AppearanceAppearance is Clerk's configuration for customizing component styling globally or per component. It supports themes, layout options, broad variables, element-level overrides, CAPTCHA appearance settings, and CSS-layer control.
ClerkOptionsClerkOptions is the optional configuration object accepted by Clerk.load(). Its properties customize loading-related behavior, including where users go after signing out.
PublishableKeyType Alias
OAuthStrategyOAuthStrategy is Clerk's type for identifying an OAuth strategy. It accepts provider-prefixed OAuth identifiers or a custom OAuth strategy and can be supplied to SignIn or SignUp operations.
Web3StrategyWeb3Strategy is Clerk's string-literal type for selecting a supported wallet-signature verification flow. It covers MetaMask, Base, Coinbase Wallet, OKX Wallet, and Solana.
ClerkPaginatedResponseClerkPaginatedResponse is the generic interface for a method response containing a paginated list of resources. Pass the resource type as its type parameter to keep returned items strongly typed.
EmailLinkFactorType Alias
PhoneCodeFactorType Alias

Module

NameWhat it does
users.getUserRetrieves a Clerk User by ID through the backend SDK. It returns a promise resolving to the user's Backend User object.
users.createUserCreates a Clerk User through the Backend SDK or its underlying POST/users endpoint. Required attributes and permitted fields come from the instance's Clerk Dashboard configuration.
users.updateUserUpdates a Clerk user by ID with selected optional attributes and returns the updated user. It is the backend SDK wrapper for Clerk's PATCH user endpoint.
users.deleteUserDeletes a Clerk user by ID through the Backend API. The method accepts a user ID and returns a promise for the deleted User.
users.getUserListLists users in the current Clerk instance with optional filters, ordering, and pagination. The response contains matching User objects plus the instance-wide total count.
organizations.createOrganizationCreates a Clerk Organization through the backend SDK. Provide a name and optionally a creator, slug, membership limit, and metadata.
organizations.getOrganizationRetrieves a Clerk Organization through the backend SDK by ID or slug. An optional flag includes the organization's member count.
sessions.getSessionRetrieves a specific Clerk Session by its session ID. It returns a promise resolving to the Session object.
sessions.revokeSessionRevokes a specific Clerk session by ID and signs the user out from its associated client. The operation returns the revoked Session.
invitations.createInvitationCreates an application invitation for an email address and sends the invitation email by default. It returns the newly created Invitation resource.
emailAddresses.createEmailAddressCreates an email address for a specified Clerk user and returns the resulting EmailAddress object. Optional flags can make it primary or mark it verified.
users.banUserUse banUser() in Clerk's JavaScript Backend SDK to ban a user by ID. The operation revokes the user's sessions and blocks future sign-ins.
users.lockUserLocks a Clerk user so they cannot sign in until the lock expires or is manually removed. The backend method accepts a user ID and returns the affected User object.
organizations.updateOrganizationUpdates an existing Clerk organization by ID and returns the updated Organization. Pass optional organization attributes in the params object.
organizations.deleteOrganizationDeletes a specified Clerk Organization by ID and returns the deleted Organization resource.
organizations.createOrganizationMembershipCreates an organization membership directly for a user, without an invitation. It returns the newly created OrganizationMembership.
invitations.revokeInvitationRevokes an active Clerk invitation by ID and makes its invitation email link unusable. The call returns the revoked Invitation resource.
sessions.getSessionListLists sessions for a specified client or user, with optional status filtering and pagination. The result contains session data plus the total matching-session count.

Pipe

NameWhat it does
userIduserId identifies the current Clerk user in authentication state. Read it with useAuth() on the client, or pass it to getUser() on the backend to retrieve the full user record.
sessionIdsessionId is the string ID of a Clerk session. Pass it to the backend getSession() method to retrieve that session.
orgIdPipe
orgRolePipe
orgSlugClerk organization slugs are readable identifiers, such as acme-corp, that can appear in URL paths. Clerk can use matching slug routes to activate the corresponding organization and support tenant-specific navigation.
hasClerk localization pipes pass a runtime value through a named formatter, optionally with arguments. Pipes can be chained so each formatter receives the preceding result.
redirectToSignInredirectToSignIn navigates to the sign-in URL configured in the application's instance. It returns a promise that can be awaited for navigation completion.
getTokenRetrieves a token for a Clerk session or creates a JWT from a specified Dashboard template. The backend method accepts a session ID and returns the generated token asynchronously.
sessionClaimssessionClaims exposes claims from the current Clerk session token through the Auth object. Configure custom claims in Clerk's session-token editor, then read them with the authentication API for your SDK.
publishableKeyClerk's publishable key identifies the application's dedicated Frontend API instance. It contains an environment prefix and a base64-encoded FAPI URL, followed by a $ delimiter.
secretKeysecretKey is the required string option containing your Clerk Secret Key when creating a backend clerkClient. Usually, supply it through the CLERK_SECRET_KEY environment variable.
appearanceThe appearance prop customizes the look of Clerk components. Apply it globally at the Clerk integration or locally to an individual component.
localizationClerk localization lets you replace text in prebuilt Clerk components with predefined or custom language resources. Install @clerk/localizations, import a locale, and pass it through the integration's localization option.
signInUrlsignInUrl tells Clerk where the client-side sign-in page is hosted. Configure it with the page's path or full URL so Clerk can target it for relevant redirects.
signUpUrlsignUpUrl is an optional string containing the full URL or path to an application's sign-up page. Clerk uses it for the sign-up link rendered by <SignIn />; custom sign-up pages configure it to point to the route hosting <SignUp />.
afterSignInUrlbuildAfterSignInUrl() returns the Clerk-configured full URL or path for navigation after successful sign-in or sign-up. The legacy afterSignInUrl setting is deprecated in favor of current redirect configuration options.
afterSignUpUrlafterSignUpUrl is the URL or path Clerk uses after a successful sign-up. Configure it in the JavaScript SDK and retrieve the resolved destination with buildAfterSignUpUrl().
signInFallbackRedirectUrlClerk’s signInFallbackRedirectUrl sets the post-sign-in destination when no redirect_url is already present. It defaults to / and is also used by sign-in links rendered from sign-up components.
afterSignOutUrlafterSignOutUrl defines the URL or path Clerk uses after a successful sign-out. Read it with buildAfterSignOutUrl() or navigate to it with redirectToAfterSignOut().

Search across every package and filter by type in your dashboard.

Start learning