Register User
Create a new user account with the provided email address and password.
HTTP Method & Endpoint
POST | /auth/register
Request
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"
}
warning
After a successful registration, you must temporarily store the user's email and password on the client side (e.g., in memory or secure storage) because these will be required—along with the OTP—for completing the email verification step.
Examples
JavaScript (React)
import axios from "axios";
import { api } from "../constant";
const registerUser = async (email,password) => {
try {
const response = await api.post("/auth/register", {
email: email
password: password
});
// temporary storage for verification purpose only
localStorage.setItem("email",email)
localStorage.setItem("password",password)
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
}