Consumer Authentication

/

Frontend SDKs

/

Headless

/

One-Time Passcodes (OTP)

/

Send via Email

Send via email

Wraps Stytch's send via email API endpoint. Call this method to send an email passcode to existing users.

This method is also used when you need to add a phone number to an existing Stytch User. If there is a currently valid Stytch session, and the user inputs a phone number that does not match one on their Stytch User object, upon successful authentication the new phone number will be added to the existing user. Note, this does expose a potential account enumeration vector, see our article on preventing account enumeration for more details.


Method parameters


email*string

Configurationobject

Additional configuration.

expiration_minutesint
login_template_idstring
signup_template_idstring
localestring
import React, { useCallback } from 'react';
import { useStytch } from '@stytch/react';
export const Login = () => {
  const stytch = useStytch();
  const sendPasscode = useCallback(() => {
    stytch.otps.email.send('sandbox@stytch.com', {
      expiration_minutes: 5,
    });
  }, [stytch]);
  return <button onClick={sendPasscode}>Send passcode</button>;
};

RESPONSE

200
{
    "status_code": 200,
    "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
    "method_id": "email-test-81bf03a8-86e1-4d95-bd44-bb3495224953"
  }