Skip to main content

Version: v1

Register User

Create a new user account with the provided email address and password.


HTTP Method & Endpoint

POST | /auth/register


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 addressMust be a valid email format
passwordStringYesUser's passwordMinimum 8 characters with mix of letters, numbers and special characters

Response Format

Success Response (201 Created)

FieldTypeDescription
messageStringStatus message
dataObjectContains user-related flags or metadata
data.isVerifiedBooleanIndicates whether the user's email is verified
sourceStringSource 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 CodeDescription
400Bad Request - Invalid parameters or user already exists
500Internal 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
}