PUT {{NEXT_PUBLIC_API_BASE_URL}}/api/user/update/email
Update User Email
Updates an authenticated user’s email address. The user must give their current email and their new email. Their current email must match their account’s email. Furthermore, the user’s new email must be unique.
Request Headers
- Content-Type: application/json
- X-CSRFToken: The CSRF token of the user
Request Body
- email (string, required): The current email of the user
- new_email (string, required): The user’s new email address
Example:
{
"email": "[email protected]",
"new_email": "[email protected]"
}
Responses
200
The user’s email address is successfully updated.
Example:
{
"message": "Email updated!"
}
400
The current email does not match the authenticated user’s email or the new email address is already in use.
Example:
{
"message": "Current email does not match or email already exists"
}
500
An error occurred while updating the user’s email.
Example:
{
"message": "Error updating user email",
"error": "Some descriptive error message"
}
Last updated on