An "email link" is a link that, when visited, will automatically authenticate your user so that they can perform some action on your site with less friction than if they had to sign in manually. You can create email links with Clerk by generating a sign-in token, which you can detect and take action on in your frontend.
Common use cases include:
Welcome emails when users are added off a waitlist
Promotional emails for users
Recovering abandoned carts
Surveys or questionnaires
This guide will teach you how to set this flow up.
Embeddable email links leverage sign-in tokens, which are JWTs that can be used to sign in to an application without specifying any credentials. A sign-in token can be used at most once, and can be consumed from the Frontend API using the ticket strategy.
Note
By default, sign-in tokens expire in 30 days. You can optionally supply a different duration in seconds using the expires_in_seconds property.
The following example demonstrates a cURL request that fetches a valid sign-in token:
This will return a token, which can then be embedded as a query param in any link, such as the following example:
https://your-site.com/welcome?token=THE_TOKEN
You can embedded this link anywhere, such as an email.
To do something with the email links you generate, you must setup a page in your frontend that detects the sign-in token, signs the user in, then performs whatever actions you want.
The following example demonstrates basic code that detects a token and uses it to initiate a sign-in with Clerk: