POST /profile/register
Registers a new user and sends a verification OTP to the provided email.
{
"username": "unique_username",
"email": "user@example.com",
"password": "user_password"
}
- Success:
{ "message": "User registered, Verify User through OTP" }
POST /profile/resendotp
Resends the verification OTP to the user's email.
{
"email": "user@example.com"
}
- Success:
{ "message": "OTP sent for verification" }
POST /profile/verify
Verifies the user's email with the provided OTP.
{
"email": "user@example.com",
"otp": "123456"
}
- Success:
{ "message": "Email verified" }
POST /profile/login
Logs in the user with either username or email and password and sends the JWT token.
{
"username": "unique_username", // or "email": "user@example.com"
"password": "user_password"
}
- Success:
{ "message": "User logged in", "token": "jwt_token" }
PUT /profile/update
Updates the user's profile with additional information.
{
"location": "Mumbai",
"work": "Software Engineer",
"dob": "2004-06-15",
"briefDescription": "A brief description about the user."
}
- Success:
{ "message": "Profile updated successfully", "user": { ...updatedUserDetails } }
GET /profile
Fetches the profile of the authenticated user.
- Success:
{ "user": { ...userDetails } }
POST /profile/admin/login
Logs in an admin user.
{
"email": "admin@example.com",
"password": "admin_password"
}
- Success:
{ "message": "Admin User logged in", "token": "jwt_token" }
GET /profile/admin/users
Fetches a list of usernames of all non-admin users.
- Success:
{ "users": ["username1", "username2", ...] }
POST /profile/admin/user
Fetches details of a specific user by username.
{
"username": "unique_username"
}
- Success:
{ "user": { ...userDetails } }
DELETE /profile/admin/user
Deletes a specific user by username.
{
"username": "unique_username"
}
- Success:
{ "message": "User deleted" }
- Ensure to include a valid JWT token in the
Authorization
header withbearer
key for routes that require authentication.