Sign up by username and password
Sign up a user
In order to sign up a user by username and password, the recommended flow is to use below endpoints
curl --request POST \
--url https://dev-iam.razi.ai/v1/authentication/users \
--header 'Content-Type: application/json' \
--data '{
"orgId": "271296458001489512",
"firstName": "John",
"lastName": "Doe",
"phoneNumber": "+971000000000",
"email": "john.doe@gmail.com",
"password": "Password@123JonDoeInc"
}'
This endpoint creates a new user in the system with the isEmailVerified flag set to false. It also returns a session token and user ID for the newly created user. The session token is set as a secure HTTP cookie for subsequent authenticated requests.
{
"sessionId": "1234567890",
"sessionToken": "Nngj9fM-aaHr1Y1G851fauHHQb1Y5DPtqF__pKiDrqYlRiCbAh6wkO7xvhXwqVCp-8LHnChY3T8gYg",
"userId": "270471239863153410"
}
Verify email after signup
After the user is created, a verification email is sent to the user's email address. Below endpoint allows the user to verify their email by providing the verification code received in the email. Upon successful verification, the isEmailVerified flag is set to true for the user.
curl --request POST \
--url https://dev-iam.razi.ai/v1/authentication/users/email/verification \
--header 'Content-Type: application/json' \
--data '{
"userId": "2789200",
"verificationCode": "SMXY12"
}'
Re-send verification email
If the user did not receive the verification email or needs to resend it, below endpoint can be used to request a new verification email.
curl --request POST \
--url https://dev-iam.razi.ai/v1/authentication/users/email/verification-request \
--header 'Content-Type: application/json' \
--data '{
"userId": "2789200"
}'