send
Sends a one-time passcode via SMS to an existing user's phone number. Routes to POST /sdk/v1/otps/sms/send/primary if no session is active, or POST /sdk/v1/otps/sms/send/secondary if a session exists (to add an additional auth factor).
Kotlin:
StytchConsumer.otps.sms.send(
OTPsSMSSendSecondaryParameters(phoneNumber = "+15005550006")
)Content copied to clipboard
iOS:
let params = OTPsSMSSendSecondaryParameters(phoneNumber: "+15005550006")
let response = try await StytchConsumer.otps.sms.send(params)Content copied to clipboard
React Native:
StytchConsumer.otps.sms.send({ phoneNumber: "+15005550006" })Content copied to clipboard
Return
OTPsSMSSendSecondaryResponse containing the methodId needed for OtpClient.authenticate.
Parameters
request
IOTPsSMSSendSecondaryParameters
phoneNumber— The phone number to send the OTP to, in E.164 format (e.g."+15005550006").expirationMinutes?— Expiration for the OTP, in minutes.locale?— Locale used for the SMS message (e.g."en").enableAutofill?— Whether to enable OS-level OTP autofill hints on supported platforms.
Throws
StytchError
if the request fails.
if the coroutine is cancelled.