send
abstract suspend fun send(request: IOTPsEmailSendSecondaryParameters): OTPsEmailSendSecondaryResponse
Sends a one-time passcode via email to an existing user's email address. Routes to POST /sdk/v1/otps/email/send/primary if no session is active, or POST /sdk/v1/otps/email/send/secondary if a session exists (to add an additional auth factor).
Kotlin:
StytchConsumer.otps.email.send(
OTPsEmailSendSecondaryParameters(email = "user@example.com")
)Content copied to clipboard
iOS:
let params = OTPsEmailSendSecondaryParameters(email: "user@example.com")
let response = try await StytchConsumer.otps.email.send(params)Content copied to clipboard
React Native:
StytchConsumer.otps.email.send({ email: "user@example.com" })Content copied to clipboard
Return
OTPsEmailSendSecondaryResponse containing the methodId needed for OtpClient.authenticate.
Parameters
request
IOTPsEmailSendSecondaryParameters
email— The email address to send the OTP to.expirationMinutes?— Expiration for the OTP, in minutes.signupTemplateId?— Custom email template ID to use for new-user emails.loginTemplateId?— Custom email template ID to use for returning-user emails.locale?— Locale used for the email content (e.g."en").
Throws
StytchError
if the request fails.
if the coroutine is cancelled.