Skip to main content
import { Button } from 'react-native';
import { useStytchB2BClient } from '@stytch/react-native/b2b';

export const SendSMSOTP = () => {
  const stytch = useStytchB2BClient();

  const sendOTP = async () => {
    const response = await stytch.otps.sms.send({
      organization_id: 'organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931',
      member_id: 'member-test-32fc5024-9c09-4da3-bd2e-c9698807585d',
      mfa_phone_number: '+15555555555',
    });
    console.log('SMS OTP sent:', response);
  };

  return <Button title="Send SMS OTP" onPress={sendOTP} />;
};
otps.sms.send wraps the Send SMS OTP endpoint. Call this method to send an SMS passcode to an existing . If a Member has a phone number and is enrolled in MFA, then after a successful primary authentication event (e.g. email magic link authenticate or SSO authenticate is complete), an SMS OTP will automatically be sent to their phone number. In that case, this endpoint should only be used for subsequent authentication events, such as prompting a Member for an OTP again after a period of inactivity.

Cost to send SMS OTP

Before configuring SMS or WhatsApp OTPs, review how Stytch bills the costs of international OTPs and understand how to protect your app against toll fraud.

Parameters

organization_id
string
required
Globally unique UUID that identifies a specific Organization. You may also use the organization_slug or organization_external_id here as a convenience.
member_id
string
required
Globally unique UUID that identifies a specific Member. You may use an external_id here if one is set for the member.
mfa_phone_number
string
The phone number to send the OTP to. If the Member already has a phone number, this argument is not needed.
locale
string
Used to determine which language to use when sending the user this delivery method. Parameter is an IETF BCP 47 language tag, e.g. “en”.Supported languages are English (“en”), Spanish (“es”), French (“fr”) and Brazilian Portuguese (“pt-br”); if no value is provided, the copy defaults to English.

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.