Skip to main content
POST
Send a magic link via email for passwordless authentication. Users can sign in by clicking the link in their email without entering a password.
This endpoint does not require authentication and can create new users if create_user is set to true.

Request Body

string
required
Email address to send the magic link to.
boolean
Whether to create a new user if the email doesn’t exist. Defaults to false.
string
URL to redirect to after successful authentication. If not provided, uses the default redirect URL.
object
Additional user metadata to store if creating a new user.
string
Captcha token for verification if captcha is enabled.

Response

string
Unique identifier for the sent magic link email (when available)

Error Responses

1

Request Magic Link

User enters their email address and requests a magic link
2

Email Sent

A magic link email is sent to the user’s email address
3

User Clicks Link

User clicks the magic link in their email
4

Authentication

User is automatically authenticated and redirected to your application

Implementation Examples

Node.js Backend Handler

Use Cases

Passwordless Login

Perfect for users who prefer not to remember passwords:

Quick Signup

Streamlined user registration without password requirements:

Account Recovery

Alternative to password reset for users who prefer magic links:

Security Features

  • Token Expiration: Magic links expire after 1 hour
  • Single Use: Links can only be used once
  • Rate Limiting: Prevents spam and abuse
  • Secure Tokens: Cryptographically secure random tokens
  • Email Verification: Inherent email verification through link click

Rate Limiting

This endpoint is rate limited to prevent abuse:

Best Practices

  • Provide clear instructions about checking email
  • Include troubleshooting tips for email delivery issues
  • Offer alternative sign-in methods
  • Show loading states during email sending
  • Implement resend functionality with cooldown
  • Use secure, random tokens with sufficient entropy
  • Implement proper token expiration (1 hour recommended)
  • Log magic link requests for security monitoring
  • Validate email addresses before sending
  • Implement rate limiting to prevent abuse
  • Use reputable email service providers
  • Implement proper email authentication (SPF, DKIM, DMARC)
  • Monitor delivery rates and bounce rates
  • Provide clear sender identification
  • Include plain text version of emails

Testing

Unit Tests

Verify Magic Link

Complete magic link authentication

Resend Magic Link

Resend magic link email

User Signup

Traditional email/password registration

User Login

Password-based authentication