B2B Magic Links

Send an invite email to a new Member to join an Organization. The Member will be created with an invited status until they successfully authenticate. Sending invites to pending Members will update their status to invited. Sending invites to already active Members will return an error.

The magic link invite will be valid for 1 week.

Revoke an invite

To revoke an existing invite, use the Delete Member endpoint. This will both delete the invited Member from the target Organization and revoke all existing invite emails.

post/v1/b2b/magic_links/email/invite

Request

  • Base URL
    https://api.stytch.com
  • Auth
    HTTP basic

Headers

X-Stytch-Member-Sessionstring

A Stytch session that can be used to run the request with the given member's permissions.

X-Stytch-Member-SessionJWTstring

A Stytch Session JSON Web Token (JWT) that can be used to run the request with the given member's permissions.

Request body

organization_idstring required

Globally unique UUID that identifies a specific Organization. The organization_id is critical to perform operations on an Organization, so be sure to preserve this value. You may also use the organization_slug or organization_external_id here as a convenience.

email_addressstring required

The email address of the Member.

invite_redirect_urlstring

The URL that the Member clicks from the invite Email Magic Link. This URL should be an endpoint in the backend server that verifies the request by querying Stytch's authenticate endpoint and finishes the invite flow. If this value is not passed, the default invite_redirect_url that you set in your Dashboard is used. If you have not set a default invite_redirect_url, an error is returned.

invited_by_member_idstring

The member_id of the Member who sends the invite.

namestring

The name of the Member.

trusted_metadataobject

An arbitrary JSON object for storing application-specific data or identity-provider-specific data.

untrusted_metadataobject

An arbitrary JSON object of application-specific data. These fields can be edited directly by the frontend SDK, and should not be used to store critical information. See the Metadata resource for complete field behavior details.

invite_template_idstring

Use a custom template for invite emails. By default, it will use your default email template. Templates can be added in the Stytch dashboard using our built-in customization options or custom HTML templates with type “Magic Links - Invite”.

locale'en' | 'es' | 'pt-br' | 'fr'
rolesstring[]

Roles to explicitly assign to this Member. See the RBAC guide for more information about role assignment.

invite_expiration_minutesinteger

The expiration time, in minutes, for an invite email. If not accepted within this time frame, the invite will need to be resent. Defaults to 10080 (1 week) with a minimum of 5 and a maximum of 10080.

Response

Successful response

request_idstring required

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.

member_idstring required

Globally unique UUID that identifies a specific Member.

status_codeinteger required

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.

Changes