POST
/v1/auth/otp/update/email

Authorization

Descope Project ID:Refresh JWT
AuthorizationBearer <token>

Project ID:Refresh JWT as bearer token.

In: header

Request Body

application/json

loginId?string
email?string
addToLoginIDs?boolean
Defaultfalse
onMergeUseExisting?boolean
Defaultfalse
providerId?string
templateOptions?object
locale?string
failOnConflict?boolean

Update Email Address of Existing User

Update the email of an existing end user by sending an OTP code to the new email address. After successfully verifying the code the new email address will be used to deliver new OTP messages via email. The bearer token requires both the ProjectId and refresh JWT in the format <Project ID>:<JWT>, and can therefore only be run for end users who are currently signed-in.

This endpoint will return an empty response object when it completes successfully.

Descope allows you to associating multiple login IDs for a user during API update calls. For details on how this feature works, please review the details here.

Next Steps

Verify the OTP code using the Verify OTP Code endpoint to complete the update process. After successfully verifying the code the new email address will replace the original email address.

See Also

  • See The User Object for further details on how to identify users and their contact information such as email address and phone number.
  • See the Verify OTP Code endpoint, which will return the Refresh Jwt needed.
curl -X POST "https://api.descope.com/v1/auth/otp/update/email" \  -H "Content-Type: application/json" \  -d '{}'
{  "maskedEmail": "string",  "verificationAttempts": 0}
export interface Response {maskedEmail?: stringverificationAttempts?: number}
Was this helpful?

Verify OTP Code POST

### Verify the validity of an OTP code sent via email Verify that the OTP code entered by the end user matches the OTP code that was sent. The Verify OTP code endpoint completes the OTP via email flow for: - [Sign-Up](/api/otp/email/sign-up) - [Sign-In](/api/otp/email/sign-in) - [Sign-In with Auto Sign-up](/api/otp/email/sign-in-auto-sign-up) - [Update Email](/api/otp/email/update-email) The response object includes the session JWT `sessionJwt` and refresh JWT `refreshJwt` when the endpoint completes successfully, and the end user will be signed in. For an update email flow, the new email address will replace the original email address. ### See Also - See [The User Object](/api/overview#the-user-object) for further details on how to identify users and their contact information such as email address and phone number.

Sign-Up POST

### Sign-up new end user by sending an OTP code via SMS Initiate a sign-up process by sending a One-Time Password (OTP) to a new end user. Descope will generate and deliver the OTP code via SMS to the phone number specified. Sending multiple OTP codes (for example, when an end user tries to sign-up a second or third time) will invalidate any OTP code that has already been sent. This endpoint will return an empty response object when it completes successfully. The endpoint will return a failure code if the phone number is already registered. ### Next Steps Verify the OTP code using the [Verify OTP Code](/api/otp/sms/verify-otp) endpoint to complete the user sign-up process. After successfully verifying the OTP code the end user will be signed-in. ### See Also - See [The User Object](/api/overview#the-user-object) for further details on how to identify users and their contact information such as email address and phone number. - Use the [Sign-In](/api/otp/sms/sign-in) endpoint to sign-in an existing end user. - Use the [Sign-In with Auto Sign-up](/api/otp/sms/sign-in-auto-sign-up) endpoint to create a single sign-up and sign-in flow, which will create a new end user if they are not already registered.