Skip to main content
import { StytchClient } from '@stytch/vanilla-js';

const stytch = new StytchClient('${publicToken}');

export const sendEmailMagicLink = () => {
stytch.magicLinks.email.loginOrCreate('${email}', {
  login_magic_link_url: '${exampleURL}/authenticate',
  login_expiration_minutes: 60,
  signup_magic_link_url: '${exampleURL}/authenticate',
  signup_expiration_minutes: 60,
});
};
{
    "status_code": 200,
    "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141"
}
The Login or create method wraps the Login or Create Email Magic Link API endpoint.

Parameters

email
string
required
The email address of the User to send the Magic Link to.
Configuration
object
Additional configuration.

Response

request_id
string
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
status_code
number
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.