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
| Header | Value | Description |
|---|---|---|
Content-Type | application/json | Specifies that the request body is in JSON format |
x-store-id | {storeId} | StoreId (replace {storeId} with your actual storeId) |
Request Body Parameters
| Parameter | Type | Required | Description | Constraints |
|---|---|---|---|---|
email | String | Yes | User's email address to verify | Must be a valid email format |
otp | String | Yes | One-Time Password received via email | 6-digit numeric code |
password | String | Yes | User's password for verification | Must match registered password |
Response Format
Success Response (200 OK)
| Field | Type | Description |
|---|---|---|
message | String | Status message ("Login Success") |
data | Data | Contains user details and authentication token |
source | String | Source of the data (e.g., "db") |
Data Object Properties
| Field | Type | Description |
|---|---|---|
customer | Customer | Contains all details about the verified user |
accessToken | String | JWT token for authenticated requests |
isVerified | Boolean | Email verification status (true after success) |
Customer Object Properties
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier for the user |
storeId | String | Store ID the user belongs to |
email | String | User's email address |
mobileNumber | String | User's mobile number (if available) |
emailVerified | String | Timestamp of email verification |
mobileVerified | String | Timestamp of mobile verification |
status | String | Account status (e.g., "ACTIVE") |
createdAt | String | Account creation timestamp |
updatedAt | String | Last 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 Code | Description |
|---|---|
| 400 | Bad Request - Invalid parameters or validation failed |
| 401 | Unauthorized - Invalid OTP or password |
| 403 | Forbidden - Account inactive or suspended |
| 404 | Not Found - Email address not registered |
| 409 | Conflict - Email already verified |
| 500 | Internal 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
}