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

export const StartMemberEmailUpdate = ({ memberId }) => {
  const stytch = useStytchB2BClient();
  const [newEmail, setNewEmail] = useState('');

  const handleStart = async () => {
    await stytch.organizations.members.startEmailUpdate({
      member_id: memberId,
      email_address: newEmail
    });
  };

  return (
    <div>
      <input
        value={newEmail}
        onChange={(e) => setNewEmail(e.target.value)}
        placeholder="Enter new email address"
      />
      <button onClick={handleStart}>Start Email Update</button>
    </div>
  );
};
{
  "status_code": 200,
  "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
  "member_id": "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
  "member": {...},
  "organization": {...}
}
organizations.members.startEmailUpdate wraps the start member email update endpoint. Use it to start an email update for a .
RBAC Enforced MethodThis method requires a valid Session for a member with permission to perform the Action on the Resource.Before using this method, enable Member actions & organization modifications in the Frontend SDK page. To learn more, see our RBAC guide.
The organization_id will be automatically inferred from the logged-in Member’s session. This method cannot be used to start the self-serve email update process of Members in other Organizations. Use the Start Self Email Update method when the Member is updating their own email.

Parameters

member_id
string
required
The id of the Member whose email address to update.
email_address
string
required
The new email address for the Member.
login_redirect_url
string
The URL that the Member clicks from the login 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 login.If this value is not passed, the default login redirect URL that you set in your Dashboard is used. If you have not set a default login redirect URL, an error is returned.
login_template_id
string
The id of the template to use for the login Email Magic Link.By default, it will use your default email template. The template must be from Stytch’s built-in customizations or a custom HTML email for Magic Links - Login.
locale
string
default:"en"
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.
delivery_method
string
default:"EMAIL_MAGIC_LINK"
The method that should be used to verify a Member’s new email address. The options are EMAIL_MAGIC_LINK or EMAIL_OTP.This field is optional, if no value is provided, EMAIL_MAGIC_LINK will be used.

Response

member_id
object
The id of the Member whose email address will be updated.
member
object
The Member whose email address will be updated.
organization
object
The Organization of the Member whose email address will be updated.
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.