Skip to main content

Version: v1

Verify User Email

Verify a user's email address by validating the One-Time Password (OTP) sent to their email. Upon successful verification, returns user details and an access token for immediate authentication.


HTTP Method & Endpoint​

POST | /auth/email/verify


Request​

Headers​

HeaderValueDescription
Content-Typeapplication/jsonSpecifies that the request body is in JSON format
x-store-id{storeId}StoreId (replace {storeId} with your actual storeId)

Request Body Parameters​

ParameterTypeRequiredDescriptionConstraints
emailStringYesUser's email address to verifyMust be a valid email format
otpStringYesOne-Time Password received via email6-digit numeric code
passwordStringYesUser's password for verificationMust match registered password

Response Format​

Success Response (200 OK)​

FieldTypeDescription
messageStringStatus message ("Login Success")
dataDataContains user details and authentication token
sourceStringSource of the data (e.g., "db")

Data Object Properties​

FieldTypeDescription
customerCustomerContains all details about the verified user
accessTokenStringJWT token for authenticated requests
isVerifiedBooleanEmail verification status (true after success)

Customer Object Properties​

FieldTypeDescription
idStringUnique identifier for the user
storeIdStringStore ID the user belongs to
emailStringUser's email address
mobileNumberStringUser's mobile number (if available)
emailVerifiedStringTimestamp of email verification
mobileVerifiedStringTimestamp of mobile verification
statusStringAccount status (e.g., "ACTIVE")
createdAtStringAccount creation timestamp
updatedAtStringLast account update timestamp

Sample Success Response​

{
"message": "Login Success",
"data": {
"customer": {
"id": "2342341293912313",
"storeId": "2342341293912313",
"email": "abc@gmail.com",
"mobileNumber": null,
"emailVerified": "2025-05-21T14:28:24.827Z",
"mobileVerified": null,
"status": "ACTIVE",
"createdAt": "2025-05-21T14:10:44.454Z",
"updatedAt": "2025-05-21T14:28:24.828Z"
},
"accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsI....",
"isVerified": true
},
"source": "db"
}

Examples​

cURL​

curl -X POST "https://dev-sfapi.unisouk.com/auth/email/verify" \
-H "Content-Type: application/json" \
-H "x-store-id: <STORE_ID>" \
-d '{
"email": "abc@gmail.com",
"otp": "743515",
"password": "1111111111"
}'

JavaScript (React)​

import axios from "axios";

const verifyEmail = async () => {
try {
const response = await axios.post(
"https://dev-sfapi.unisouk.com/auth/email/verify",
{
email: "abc@gmail.com",
otp: "743515",
password: "1111111111",
},
{
headers: {
"Content-Type": "application/json",
"x-store-id": "<STORE_ID>",
},
}
);

console.log("Email verification successful:", response.data);
// Store the access token
if (response.data.data.accessToken) {
localStorage.setItem("accessToken", response.data.data.accessToken);
}
} catch (error) {
console.error("Email verification failed:", error.response?.data || error.message);
}
};

Error Responses​

Status CodeDescription
400Bad Request - Invalid parameters or validation failed
401Unauthorized - Invalid OTP or password
403Forbidden - Account inactive or suspended
404Not Found - Email address not registered
409Conflict - Email already verified
500Internal Server Error - Something went wrong on the server

Sample Error Responses​

Invalid OTP:

{
"requestId": "0ec96825-8a34-41da-a37c-8b9002337a8d",
"error": "BadRequestException",
"statusCode": 400,
"message": "Invalid Verification Token.",
"path": "/auth/email/verify",
"timestamp": 1748353133182
}