send

abstract suspend fun send(request: IB2BOTPsSMSSendParameters): B2BOTPsSMSSendResponse

Sends an SMS OTP to the member's phone number for MFA verification. Calls the POST /sdk/v1/b2b/otps/sms/send endpoint. Automatically includes the intermediate session token if one is present.

Kotlin:

StytchB2B.otp.sms.send(
B2BOTPsSMSSendParameters(
organizationId = "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
memberId = "member-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
)
)

iOS:

let params = B2BOTPsSMSSendParameters(
organizationId: "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
memberId: "member-test-d5a3b680-e8a3-40c0-b815-ab79986666d0"
)
let response = try await StytchB2B.otp.sms.send(params)

React Native:

StytchB2B.otp.sms.send({
organizationId: "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
memberId: "member-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
})

Return

B2BOTPsSMSSendResponse confirming the OTP was sent.

Parameters

request
  • IB2BOTPsSMSSendParameters

  • organizationId — The ID of the organization.

  • memberId — The ID of the member to send the OTP to.

  • mfaPhoneNumber? — Phone number to send to; uses the member's existing number if omitted.

  • locale? — Locale for the SMS content.

  • enableAutofill? — Whether to enable OS-level SMS autofill on supported devices.

Throws

StytchError

if the request fails.

if the coroutine is cancelled.