Register User
Create a new user account with the provided email address and password.
HTTP Method & Endpoint
POST | /auth/register
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 | Must be a valid email format |
password | String | Yes | User's password | Minimum 8 characters with mix of letters, numbers and special characters |
Response Format
Success Response (201 Created)
| Field | Type | Description |
|---|---|---|
message | String | Status message |
data | Object | Contains user-related flags or metadata |
data.isVerified | Boolean | Indicates whether the user's email is verified |
source | String | Source of the response (e.g., "db") |
Sample Success Response
{
"message": "Registration Success, Please verify your email before logging in",
"data": {
"isVerified": false
},
"source": "db"
}
Examples
cURL
curl -X POST "https://dev-sfapi.unisouk.com/auth/register" \
-H "Content-Type: application/json" \
-H "x-store-id: <STORE_ID>"
-d '{
"email": "abc@gmail.com",
"password": "1111111111"
}'
JavaScript (React)
import axios from "axios";
const registerUser = async () => {
try {
const response = await axios.post(
"https://dev-sfapi.unisouk.com/auth/register",
{
email: "abc@gmail.com",
password: "1111111111",
},
{
headers: {
"Content-Type": "application/json",
"x-store-id": "<STORE_ID>",
},
}
);
console.log("Registration successful:", response.data);
} catch (error) {
console.error("Registration failed:", error.response?.data || error.message);
}
};
Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request - Invalid parameters or user already exists |
| 500 | Internal Server Error - Something went wrong on the server |
Sample Error Response
{
"requestId": "1fb266e6-4c72-4895-bc56-88cab4308187",
"error": "BadRequestException",
"statusCode": 400,
"message": ["email must be an email"],
"path": "/auth/register",
"timestamp": 1748353186394
}