http://localhost:{PORT}
Most endpoints require authentication via JWT token passed as a cookie or in headers. Protected routes are marked with π.
All responses follow this general structure:
{
"message": "Success/Error message",
"data": {...}, // Optional data payload
"error": "Error details" // Only present on error
}Login a user with email and password.
Request Body:
{
"email": "user@example.com",
"password": "SecurePass123"
}Validation:
email: Valid email format, trimmedpassword: Required string
Response (200):
{
"message": "Login successful",
"role": "MEMBER" // or "VISITOR" if not approved
}Response (401):
{
"message": "Invalid credentials"
}Register a new user with profile information and optional profile picture.
Content-Type: multipart/form-data
Form Fields:
{
"name": "John Doe",
"email": "john@example.com",
"phone": "9876543210", // or "+919876543210"
"password": "SecurePass123",
"bio": "Optional bio (max 500 chars)",
"linkedin_url": "https://linkedin.com/in/johndoe",
"github_url": "https://github.com/johndoe",
"degree": "Computer Science",
"specialization": "Machine Learning",
"primary_community_name": "ML", // ML, IS, WEB, GAMES_APPS, CYBER
"reason_for_joining": "Detailed reason (min 10 chars, max 500 chars)"
}File Upload:
profilePicture: Optional image file
Validation Rules:
name: 1-256 chars, letters and spaces onlyemail: Valid email formatphone: Indian phone number (10 digits starting with 6-9) or with +91 prefixpassword: Min 8 chars, must contain uppercase, lowercase, and numberbio: Max 500 chars (optional)linkedin_url: Must be valid LinkedIn URL (optional)github_url: Must be valid GitHub URL (optional)degree: 2-100 charsspecialization: 2-100 charsprimary_community_name: One of the enum valuesreason_for_joining: 10-500 chars
Response (201):
{
"message": "User registered successfully"
}Initiate password reset process.
Request Body:
{
"email": "user@example.com"
}Response (200):
{
"message": "Password reset OTP sent to email"
}Verify OTP for password reset.
Request Body:
{
"email": "user@example.com",
"otp": "123456"
}Response (200):
{
"message": "OTP verified successfully"
}Reset password after OTP verification.
Request Body:
{
"email": "user@example.com",
"newPassword": "NewSecurePass123",
"otp": "123456"
}Response (200):
{
"message": "Password reset successfully"
}Get user information by ID.
URL Parameters:
id: User ID (string)
Response (200):
{
"message": "User found",
"data": {
"_id": "user_id",
"name": "John Doe",
"email": "john@example.com",
"bio": "User bio",
"linkedin_url": "https://linkedin.com/in/johndoe",
"github_url": "https://github.com/johndoe",
"photo_url": "https://cloudinary.com/image.jpg",
"degree": "Computer Science",
"specialization": "Machine Learning",
"status": "approved",
"createdAt": "2025-01-01T00:00:00.000Z"
}
}Get all users with optional community filtering.
Authentication Required: Yes
Roles Allowed: GLOBAL_ADMIN, COMMUNITY_ADMIN, PR_EDITOR, MEMBER
Query Parameters:
community: Filter by community (ML, IS, WEB, GAMES_APPS, CYBER) - optional
Example: /users?community=ML
Response (200):
{
"message": "Users retrieved successfully",
"data": [
{
"_id": "user_id",
"name": "John Doe",
"email": "john@example.com",
"primary_community_name": "ML",
"status": "approved",
"createdAt": "2025-01-01T00:00:00.000Z"
}
]
}Get current user's status and profile information.
Authentication Required: Yes
Response (200):
{
"message": "User status retrieved",
"data": {
"_id": "user_id",
"name": "John Doe",
"email": "john@example.com",
"role": "MEMBER",
"status": "approved",
"primary_community": "ML",
"profile": {
"bio": "User bio",
"linkedin_url": "https://linkedin.com/in/johndoe",
"github_url": "https://github.com/johndoe",
"photo_url": "https://cloudinary.com/image.jpg",
"degree": "Computer Science",
"specialization": "Machine Learning"
}
}
}Update current user's profile information.
Authentication Required: Yes
Request Body:
{
"name": "Updated Name",
"email": "updated@example.com",
"phone": "9876543210",
"bio": "Updated bio",
"linkedin_url": "https://linkedin.com/in/updated",
"github_url": "https://github.com/updated",
"photo_url": "https://cloudinary.com/updated-image.jpg",
"degree": "Updated Degree",
"specialization": "Updated Specialization"
}Validation Rules:
- All fields are optional
name: 2-100 chars, letters and spaces onlyemail: Valid email formatphone: Indian phone number formatbio: Max 500 charslinkedin_url: Must be valid LinkedIn URLgithub_url: Must be valid GitHub URLphoto_url: Valid URL formatdegree: 2-100 charsspecialization: 2-100 chars
Response (200):
{
"message": "Profile updated successfully",
"data": {
// Updated user profile data
}
}Get list of pending user approvals.
Authentication Required: Yes
Roles Allowed: GLOBAL_ADMIN, COMMUNITY_ADMIN
Query Parameters:
type: Type of approval (default: "member")community: Filter by community (optional)status: Filter by status (pending, approved, rejected) - default: "pending"
Example: /admin/approvals?community=ML&status=pending
Response (200):
{
"message": "Approvals retrieved successfully",
"data": [
{
"_id": "user_id",
"name": "John Doe",
"email": "john@example.com",
"primary_community_name": "ML",
"reason_for_joining": "I want to learn ML",
"status": "pending",
"createdAt": "2025-01-01T00:00:00.000Z"
}
]
}Approve a pending user.
Authentication Required: Yes
Roles Allowed: GLOBAL_ADMIN, COMMUNITY_ADMIN
URL Parameters:
id: User ID to approve (string)
Response (200):
{
"message": "User approved successfully"
}Reject a pending user with optional reason.
Authentication Required: Yes
Roles Allowed: GLOBAL_ADMIN, COMMUNITY_ADMIN
URL Parameters:
id: User ID to reject (string)
Request Body:
{
"reason": "Reason for rejection (min 10 chars, max 500 chars)"
}Validation:
reason: 10-500 chars (optional, default: "No reason provided")
Response (200):
{
"message": "User rejected successfully"
}Register a new admin user.
Content-Type: multipart/form-data
Form Fields:
{
"name": "Admin Name",
"email": "admin@example.com",
"phone": "9876543210",
"password": "SecurePass123",
"bio": "Admin bio",
"linkedin_url": "https://linkedin.com/in/admin",
"github_url": "https://github.com/admin",
"degree": "Computer Science",
"specialization": "System Administration",
"primary_community_name": "ML",
"reason_for_joining": "I am admin" // default value
}File Upload:
profilePicture: Optional image file
Validation: Same as user registration with default reason_for_joining
Response (201):
{
"message": "Admin registered successfully"
}ML- Machine LearningIS- Information SecurityWEB- Web DevelopmentGAMES_APPS- Games & AppsCYBER- Cybersecurity
VISITOR- Unverified userMEMBER- Approved memberPR_EDITOR- Public Relations EditorCOMMUNITY_ADMIN- Community AdministratorGLOBAL_ADMIN- Global Administrator
pending- Awaiting approvalapproved- Approved and activerejected- Application rejected
400 Bad Request:
{
"message": "Validation error",
"errors": [
{
"field": "email",
"message": "Invalid email format"
}
]
}401 Unauthorized:
{
"message": "Authentication required"
}403 Forbidden:
{
"message": "Insufficient permissions"
}404 Not Found:
{
"message": "Resource not found"
}500 Internal Server Error:
{
"message": "Internal server error"
}-
Authentication: JWT tokens are typically set as HTTP-only cookies. Ensure your frontend can handle cookie-based authentication.
-
File Uploads: Profile picture uploads use
multipart/form-data. Use FormData for these requests. -
Phone Number Format: Accept both formats:
9876543210and+919876543210. -
Community Filtering: Most admin endpoints support community-based filtering for community admins.
-
Role-Based Access: Different endpoints require different user roles. Implement role checking in your frontend routing.
-
Error Handling: All endpoints return consistent error formats. Implement centralized error handling.
-
Validation: Client-side validation should match server-side rules to provide better UX.