invite

abstract suspend fun invite(request: IB2BMagicLinksInviteParameters): B2BMagicLinksInviteResponse

Sends a magic link invitation email to a new member of the organization. Calls the POST /sdk/v1/b2b/magic_links/email/invite endpoint. Requires an active session.

Kotlin:

StytchB2B.magicLinks.email.invite(
B2BMagicLinksInviteParameters(emailAddress = "newmember@example.com")
)

iOS:

let params = B2BMagicLinksInviteParameters(emailAddress: "newmember@example.com")
let response = try await StytchB2B.magicLinks.email.invite(params)

React Native:

StytchB2B.magicLinks.email.invite({ emailAddress: "newmember@example.com" })

Return

B2BMagicLinksInviteResponse confirming the invitation email was sent.

Parameters

request
  • IB2BMagicLinksInviteParameters

  • emailAddress — The email address of the person to invite.

  • inviteRedirectUrl? — URL to redirect to when the invite is accepted.

  • inviteTemplateId? — Custom email template ID for the invitation email.

  • name? — Display name to pre-populate for the new member.

  • untrustedMetadata? — Client-settable key-value metadata to assign to the new member.

  • locale? — Locale used for the invitation email.

  • roles? — List of RBAC role IDs to assign to the new member.

Throws

StytchError

if the request fails or the caller lacks permission to invite members.

if the coroutine is cancelled.