12 endpoints.
| Method | Path | Summary |
|---|---|---|
POST | /api/auth/change-password | Change user password |
POST | /api/auth/confirm-email-change | Confirm email change using verification token |
POST | /api/auth/forgot-password | Request password reset email |
POST | /api/auth/login | Login to the platform |
POST | /api/auth/logout | Logout from the platform |
GET | /api/auth/me | Get current user profile |
PUT | /api/auth/profile | Update user profile |
POST | /api/auth/refresh | Refresh JWT token |
POST | /api/auth/refresh-token | Refresh tokens using a refresh token |
POST | /api/auth/request-email-change | Request email change (sends verification to new email) |
POST | /api/auth/reset-password | Reset password using token from email |
POST | /api/auth/setup-password | Setup password for new member after approval |
POST /api/auth/change-passwordAllows authenticated users to change their password. Requires current password verification and new password confirmation. Auth: Bearer JWT required.
Request body (required) — application/json
| Field | Type | Required | Description |
|---|---|---|---|
currentPassword | string (password) | yes | Current password for verification |
newPassword | string (password) | yes | New password (min 8 characters) |
confirmPassword | string (password) | yes | Confirmation of new password |
Responses
| Status | Description | Body |
|---|---|---|
200 | Password changed successfully | object |
400 | Validation error (missing fields, passwords don't match, weak password, or new password same as current) | Error |
401 | Invalid current password or not authenticated | Error |
500 | Server error | Error |
POST /api/auth/confirm-email-changeCompletes the email change process:
- Verifies the token from the verification link
- Updates user's email in database
- Sends success notification to new email
- Forces re-login for security
Auth: Bearer JWT required.
Request body (required) — application/json
| Field | Type | Required | Description |
|---|---|---|---|
token | string | yes | Verification token from email |
Responses
| Status | Description | Body |
|---|---|---|
200 | Email changed successfully (requires re-login) | object |
400 | Invalid or expired token, email mismatch, or email already in use | Error |
500 | Server error | Error |
POST /api/auth/forgot-passwordSends a password reset email if the email exists in the system. Always returns success to prevent email enumeration attacks. Auth: Bearer JWT required.
Request body (required) — application/json
| Field | Type | Required | Description |
|---|---|---|---|
email | string (email) | yes | User's email address |
Responses
| Status | Description | Body |
|---|---|---|
200 | Password reset email sent (if email exists). Always returns success for security. | object |
400 | Invalid email format | Error |
429 | Too many requests (rate limited) | Error |
500 | Server error | Error |
POST /api/auth/loginAuthenticates a user and returns a JWT token. Security checks:
- Validates email and password
- Checks account expiration (accountExpiresAt)
- Checks account suspension (isActive)
- Handles mustResetPassword flag for first-time login (admin-provisioned accounts)
Auth: Bearer JWT required.
Request body (required) — application/json
Type: LoginRequest
Responses
| Status | Description | Body |
|---|---|---|
200 | Login successful or password reset required | object |
400 | Invalid request (missing fields or invalid email format) | Error |
401 | Invalid credentials or account not found | Error |
403 | Account suspended, expired, or user not authorized for tenant | Error |
500 | Server error | Error |
POST /api/auth/logoutLogout endpoint (client-side token removal). Since JWT tokens are stateless, logout is primarily handled client-side by removing the token. Token blacklisting can be added in the future if needed.
Auth: Bearer JWT required.
Responses
| Status | Description | Body |
|---|---|---|
200 | Logged out successfully | object |
GET /api/auth/meReturns the authenticated user's profile information along with their associated tenants/communities and roles. Auth: Bearer JWT required.
Responses
PUT /api/auth/profileUpdates the authenticated user's profile information. Supports text fields and image uploads (avatar, coverImage). Auth: Bearer JWT required.
Request body (required) — multipart/form-data
| Field | Type | Required | Description |
|---|---|---|---|
firstName | string | no | User's first name |
middleName | string | no | User's middle name |
grandfatherName | string | no | User's grandfather name |
familyName | string | no | User's family name |
phone | string | no | User's phone number |
email | string (email) | no | User's email address |
description | string | no | User's bio/description (max 200 characters) |
employeeNumber | string | no | Employee number |
birthDate | string (date) | no | Date of birth |
gender | enum: MALE, FEMALE, OTHER | no | Gender |
maritalStatus | enum: SINGLE, MARRIED, DIVORCED, WIDOWED | no | Marital status |
nationality | string | no | Nationality |
cityCode | string | no | City code |
region | string | no | Region |
city | string | no | City |
bloodType | enum: A+, A-, B+, B-, AB+, AB-, O+, O- | no | Blood type |
specialization | string | no | Professional specialization |
position | string | no | Job position |
department | string | no | Department |
facebook | string (uri) | no | Facebook profile URL |
twitter | string (uri) | no | Twitter profile URL |
instagram | string (uri) | no | Instagram profile URL |
linkedin | string (uri) | no | LinkedIn profile URL |
youtube | string (uri) | no | YouTube channel URL |
tiktok | string (uri) | no | TikTok profile URL |
snapchat | string | no | Snapchat username |
whatsapp | string | no | WhatsApp number |
telegram | string | no | Telegram username |
avatar | string (binary) | no | Profile avatar image (JPG, PNG, GIF, WEBP, max 5MB) |
coverImage | string (binary) | no | Profile cover image (JPG, PNG, GIF, WEBP, max 5MB) |
Responses
| Status | Description | Body |
|---|---|---|
200 | Profile updated successfully | object |
400 | Validation error (file too large, invalid file type, description too long) | Error |
401 | Not authenticated | Error |
500 | Server error | Error |
POST /api/auth/refreshGenerates a new JWT token with the same claims as the current token. Useful for extending session without re-authentication. Auth: Bearer JWT required.
Responses
| Status | Description | Body |
|---|---|---|
200 | Token refreshed successfully | object |
401 | Not authenticated or invalid token | Error |
500 | Server error | Error |
POST /api/auth/refresh-tokenGenerates a new access + refresh token pair using a valid refresh token. Does NOT require authentication — the access token may be expired. This is the primary mechanism for mobile apps to renew sessions silently.
Auth: Bearer JWT required.
Request body (required) — application/json
| Field | Type | Required | Description |
|---|---|---|---|
refreshToken | string | yes | The refresh token received from login or previous refresh |
Responses
| Status | Description | Body |
|---|---|---|
200 | Tokens refreshed successfully | object |
400 | Missing refresh token | — |
401 | Refresh token expired or invalid | — |
500 | Server error | — |
POST /api/auth/request-email-changeInitiates email change process:
- Requires password verification for security
- Validates new email format and availability
- Sends security alert to current email
- Sends verification link to new email
Auth: Bearer JWT required.
Request body (required) — application/json
| Field | Type | Required | Description |
|---|---|---|---|
newEmail | string (email) | yes | The new email address |
password | string (password) | yes | Current password for verification |
Responses
| Status | Description | Body |
|---|---|---|
200 | Verification email sent to new address | object |
400 | Invalid email format, email already in use, or new email same as current | Error |
401 | Invalid password or not authenticated | Error |
429 | Too many requests (rate limited) | Error |
500 | Server error | Error |
POST /api/auth/reset-passwordResets the user's password using a valid reset token from the password reset email. Auth: Bearer JWT required.
Request body (required) — application/json
| Field | Type | Required | Description |
|---|---|---|---|
token | string | yes | Reset token from password reset email |
password | string (password) | yes | New password (min 8 characters) |
confirmPassword | string (password) | yes | Confirmation of new password |
Responses
| Status | Description | Body |
|---|---|---|
200 | Password reset successfully | object |
400 | Invalid token, expired token, or password validation failed | Error |
500 | Server error | Error |
POST /api/auth/setup-passwordAuth: Bearer JWT required.
Request body (required) — application/json
| Field | Type | Required | Description |
|---|---|---|---|
token | string | no | — |
password | string | no | — |
Responses
| Status | Description | Body |
|---|---|---|
200 | Password setup successful | — |