Invitations
Invitations
Clerk makes it easy to invite users to your application via the invitations feature. This feature is offered by default to all Clerk applications without any extra configuration. Currently, Clerk supports inviting users via email.
Inviting users to your application begins with creating an invitation for an email address. Once the invitation is created, an email with an invitation link will be sent to the user's email address. When the user visits the invitation link, they will be redirected to the application's sign up page and their email address will be automatically verified. At this point, the user will just have to fill in the rest of the details according to the application's settings.
Invitations expire after a month. If the user clicks on an expired invitation, they will get redirected to the application's sign-up page and will have to go through the normal sign-up flow. Their email address will not be auto-verified.
Creating invitations
At the moment, you can only create invitations for email addresses via the Backend API.
You can either use a cURL command or Clerk's JavaScript Backend SDK to create an invitation. Use the tabs to see examples for each method.
The following example demonstrates how to create an invitation using cURL.
Clerk's Backend SDK is a wrapper around the Backend API that makes it easier to interact with the API.
To use the Backend SDK to create an invitation, see the createInvitation()
reference documentation.
Invitation metadata
You can also add metadata to an invitation. Once the invited user signs up using the invitation link, the invitation metadata will end up in the user's public_metadata
. You can find more information about user metadata in the metadata docs.
To add metadata to an invitation, you can use the public_metadata
property when the invitation is created. The following example demonstrates how to create an invitation with metadata using cURL:
Revoking invitations
Revoking an invitation prevents the user from using the invitation link that was sent to them.
At the moment, you can only revoke invitations via the Backend API.
You can either use a cURL command or Clerk's JavaScript Backend SDK to create an invitation. Use the tabs to see examples for each method.
The following example demonstrates how to revoke an invitation using cURL.
Clerk's Backend SDK is a wrapper around the Backend API that makes it easier to interact with the API.
To use the Backend SDK to revoke an invitation, see the revokeInvitation()
reference documentation.
When you create an invitation, you can specify a redirect_url
parameter. This parameter tells Clerk where to redirect the user when they visit the invitation link.
The following example demonstrates how to create an invitation with the redirect_url
set to https://www.example.com/my-sign-up
:
Once the user visits the invitation link and is redirected to the specified URL, an invitation token will be appended to the URL.
Using the previous example, the URL with the invitation token would look like this:
https://www.example.com/my-sign-up?__clerk_ticket=.....
You can then use the invitation token to create a new sign-up. The following example demonstrates how to create a new sign-up using the invitation token:
Feedback
Last updated on