Skip to main content

Verify Email

warning

The user has to be logged in to proceed with this flow.

Make sure to either:

  • Send a valid Authorization header with of type Bearer TOKEN_VALUE where TOKEN_VALUE is the token returned in the response from Sign up or Sign in flow
  • In case your app supports cookie, you can enable request cookies as our API Automatically sets a cookie named session-token which is forwarded with each request to our api.

Initiate Email Verification

If a user has not initiated email verification or if the verification code has expired, the logged-in user can initiate the email verification process using the following endpoint:

curl --request POST \
--url https://dev-iam.razi.ai/v1/authentication/users/email/verification-request \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--data '{
"userId": "2789200"
}'

This API call will return a 200 OK status if a new verification code is generated and sent to the user's email address.

Verify Email with code

Once the user receives the email containing the verification code, they can use the code to verify their email address by sending a request to the following endpoint:

curl --request POST \
--url https://dev-iam.razi.ai/v1/authentication/users/email/verification \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--data '{
"userId": "2789200",
"verificationCode": "SMXY12"
}'
tip

Link to Playground

In this example, replace "SMXY12" with the actual verification code received in the email.

If the verification is successful, the user's isEmailVerified flag will be set to true