Authentication & User Management
Handles user onboarding, token issuance, session handling, role access, and identity management.
πΈ POST /sign-up β Register New User
POST /sign-up β Register New UserRegisters a new user and sends a verification OTP to their email.
Request Body:
{
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
"password": "strongpassword123"
}π Auth Required: No π© Sends OTP to email
β cURL
curl -X POST https://api.yourdomain.com/sign-up \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
"password": "strongpassword123"
}'β JS Example
πΈ POST /sign-in β Authenticate & Get JWT Token
POST /sign-in β Authenticate & Get JWT TokenLogs in a user and returns a token for future requests.
Request:
Response:
π Auth Required: No
β cURL
β JS Example
πΈ GET /me β Get Current User
GET /me β Get Current UserReturns profile info of the authenticated user.
π Auth Required: β Yes (Bearer Token)
β cURL
β JS Example
πΈ GET /logout β Logout User
GET /logout β Logout UserInvalidates the current JWT token.
π Auth Required: β Yes
β cURL
πΈ POST /send-otp β Send OTP to Email
POST /send-otp β Send OTP to EmailSends a one-time verification code to a user's email.
Request:
π Auth Required: β No
β cURL
πΈ POST /password-reset/request β Start Reset Flow
POST /password-reset/request β Start Reset FlowSends OTP to email for resetting password.
β cURL
πΈ POST /password-reset/confirm β Confirm New Password
POST /password-reset/confirm β Confirm New PasswordRequest:
β cURL
πΈ GET /all-users β List All Users (Admin Only)
GET /all-users β List All Users (Admin Only)π Auth Required: β Admin
β cURL
πΈ GET /users/{user_id} β Get User by ID
GET /users/{user_id} β Get User by IDReturns details of a specific user (admin access).
β cURL
πΈ POST /users/{user_id}/change-role/{new_role_id} β Change Role
POST /users/{user_id}/change-role/{new_role_id} β Change RoleChanges the user's role (e.g., to admin, user, etc.).
β cURL
πΈ PUT /{user_id} β Update Profile
PUT /{user_id} β Update ProfileUpdate user details like name or password.
β cURL
πΈ DELETE /{user_id} β Delete Account
DELETE /{user_id} β Delete AccountPermanently deletes a user account.
β cURL
πΈ GET /by-email/{email} β Lookup User by Email
GET /by-email/{email} β Lookup User by EmailFinds a user using their email address.
β cURL
πΈ POST /google β Login with Google OAuth
POST /google β Login with Google OAuthLog in using Google. Typically done via frontend OAuth provider like Google SDK. The server endpoint exchanges the token and responds with a JWT.
β cURL
Last updated