Change User Email
Starts a change of another user's sign-in email. It takes effect once the user confirms it from the new address.
POST /api/users/:id/email-change
An organization admin can change the sign-in email of a member of their own organization, a global admin of any user. The address does not change right away: a confirmation link is mailed to the new address, valid for 24 hours, and the change takes effect once it is opened. Until then the user keeps signing in with the current address. Opening the link signs nobody in. Once the change is confirmed, the old address receives a notice naming the new address and who requested it.
A new request replaces an earlier one that is still open, so only the latest link works.
API tokens cannot call this endpoint. It requires a real, logged-in user session. If the
calling admin has two-step verification, they confirm their second factor first
(403 mfa_step_up_required: enter the code in the dashboard dialog, then repeat the request).
Your own address is changed in your profile instead, which asks for your password.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
newEmail | string | yes | The new sign-in email. Stored in lower case. |
Example (cURL)
Call this endpoint from an authenticated browser session (the admin's own login session cookie), not with an API token:
BASE_URL="https://uptimeify.io"
curl -X POST "$BASE_URL/api/users/user_123/email-change" \
-H "Cookie: better-auth.session_token=<your-session-cookie>" \
-H "Content-Type: application/json" \
-d '{"newEmail": "jane.doe@example.com"}'Response
{ "ok": true, "pendingEmail": "jane.doe@example.com" }Common errors
401 unauthorizedwhen you are not authenticated403 nonUserSessionForbiddenwhen called with an API token or agent access token403 mfa_step_up_requiredwhen your account has two-step verification and you have not confirmed it in the last five minutes403 forbiddenwhen you are not an organization admin or global admin403 globalUserProtectedwhen the target is a platform account (global admin or supporter) and you are not a global admin404 userNotFoundwhen the user does not exist or belongs to another organization400 userSelfChangeForbiddenwhen:idis your own user; change your address in your profile400 emailUnchangedwhen the new address is the current one400 emailAlreadyExistswhen another member of your organization already uses the address. An address held by an account outside your organization is not named: the request answers like a free one and no link is sent502 emailSendFailedwhen the confirmation link could not be sent; the address is unchanged