All endpoints are served under the base path /api/v1. Unless noted, responses follow the shape:
{
"success": boolean,
"message": string,
"data": any
}
Authentication uses Authorization: Bearer <accessToken> from the login response. Role guards are enforced by middleware where noted.
- POST
/api/v1/auth/login— Login. Body:email(string, required),password(string, required),role(student|driver|admin|superadmin, optional).clientInfoParseraddsclientInfowith device, browser, ipAddress, pcName?, os?, userAgent. - POST
/api/v1/auth/change-password— Change password. Body:email(string),oldPassword(string),newPassword(string). - POST
/api/v1/auth/forget-password— Request reset link. Body:email(string). - POST
/api/v1/auth/reset-password— Reset password using emailed token. Body:token(string),newPassword(string). - GET
/api/v1/auth/get-pending-registrations— List pending users. Auth roles: ADMIN, SUPERADMIN. - POST
/api/v1/auth/approve-registration/:id— Approve a user. Auth roles: ADMIN, SUPERADMIN. Body:assignedBusId(string, required when approving a driver; otherwise omit). - DELETE
/api/v1/auth/reject-registration/:id— Reject and delete a pending user. Auth roles: ADMIN, SUPERADMIN.
- POST
/api/v1/user— Self registration. Body depends onrole:- Student:
role: "student",email,password,name,clientInfo{department,rollNumber,bio?},clientITInfo{device(pc|mobile),browser,ipAddress,pcName?,os?,userAgent}. - Driver:
role: "driver",email,password,name,clientInfo{licenseNumber,bio?},clientITInfoas above,profileImage(url),approvalLetter(url),assignedBus?,assignedBusName?. - Admin/Superadmin:
role: "admin"|"superadmin",email,password,name,clientInfo?{bio?},clientITInfoas above,profileImage(url),approvalLetter(url).
- Student:
- POST
/api/v1/user/verfy-email— Verify OTP emailed during registration. Body:email,otpToken. - GET
/api/v1/user/get-all-users— List users. Auth roles: ADMIN, SUPERADMIN. - POST
/api/v1/user/add-user— Admin creates a user. Auth roles: ADMIN, SUPERADMIN. Body (discriminated byrole):- Student:
role: "student",name,email,clientInfo{rollNumber,department?,bio?},profileImage?(url). - Driver:
role: "driver",name,email,clientInfo{licenseNumber,bio?},profileImage(url),approvalLetter(url),assignedBus(string),assignedBusName?. - Admin/Superadmin:
role: "admin"|"superadmin",name,email,clientInfo?{bio?},profileImage(url),approvalLetter(url).
- Student:
- PUT
/api/v1/user/update-user/:id— Admin updates a user. Auth roles: ADMIN, SUPERADMIN. Body matches the create schema but all fields optional;roleis still required to select the discriminator. - DELETE
/api/v1/user/delete-user/:id— Admin deletes a user. Auth roles: ADMIN, SUPERADMIN. - PATCH
/api/v1/user/admin/:id— Update admin profile. Auth roles: ADMIN, SUPERADMIN. Multipart form with optionalprofileImagefile and JSON fieldsname?,clientInfo?{bio?}. - PATCH
/api/v1/user/student/:id— Update student profile. Auth role: STUDENT. Multipart form with optionalprofileImagefile and JSON fieldsname?,clientInfo?{bio?,department?,rollNumber?}. - PATCH
/api/v1/user/driver/:id— Update driver profile. Auth role: DRIVER. Multipart form with optionalprofileImagefile and JSON fieldsname?,clientInfo?{bio?,licenseNumber?}.
- POST
/api/v1/bus/add-bus— Create bus. Body:name(string),plateNumber(string),route(ObjectId),photo(string url),activeHoursComing(string[]),activeHoursGoing(string[], same length as coming),isActive?(boolean). - PUT
/api/v1/bus/update-bus/:id— Update bus. Body: any of the create fields; validation runs on provided fields. - DELETE
/api/v1/bus/delete-bus/:id— Delete bus by id. - GET
/api/v1/bus/get-all-buses— List buses (populates route). - GET
/api/v1/bus/get-bus/:id— Get single bus (populates route).
- POST
/api/v1/route/— Create route. Body:name(string),stopages(ObjectId[]),bus(ObjectId[], optional),isActive?(boolean),activeHoursComing?(string[]),activeHoursGoing?(string[]). - PUT
/api/v1/route/:id— Update route. Body: any of the fields above. Providingstopagesreplaces the array. - DELETE
/api/v1/route/:id— Delete route. - GET
/api/v1/route/— List routes.
- POST
/api/v1/stopage/add-stopage— Create stopage. Body:name(string, min 2),latitude(number between -90 and 90),longitude(number between -180 and 180),isActive?(boolean). - PUT
/api/v1/stopage/update-stopage/:id— Update stopage. Body: any of the create fields. - DELETE
/api/v1/stopage/delete-stopage/:id— Delete stopage. - GET
/api/v1/stopage/get-all-stopages— List stopages.
- POST
/api/v1/notification/— Create notification. Body:title(string),message(string),category?(system|alert|reminder),recipient?(ObjectId or null),targetRole?(superadmin|admin|student|driver|all),isRead?(boolean),sentAt?(date). - PUT
/api/v1/notification/:id— Update notification. Body: any of the fields above. - DELETE
/api/v1/notification/:id— Delete notification. - GET
/api/v1/notification/— List notifications. - GET
/api/v1/notification/:id— Get single notification.
- POST
/api/v1/issue/— Create issue. Body:title(string),description(string),category?(bug|feature|complaint|other),status?(open|in_progress|resolved|closed),priority?(low|medium|high|urgent),reporter?(ObjectId or null),relatedBus?(ObjectId or null),relatedRoute?(ObjectId or null),submittedByRole?(superadmin|admin|student|driver). - PUT
/api/v1/issue/:id— Update issue. Body: any of the fields above. - DELETE
/api/v1/issue/:id— Delete issue. - GET
/api/v1/issue/— List issues. - GET
/api/v1/issue/:id— Get single issue.
- POST
/api/v1/location/— Create location. Body:bus(ObjectId),latitude(number),longitude(number),capturedAt?(date). - PUT
/api/v1/location/:id— Update location. Body: any of the fields above. - DELETE
/api/v1/location/:id— Delete location. - GET
/api/v1/location/— List locations (populates bus). - GET
/api/v1/location/:id— Get single location (populates bus). - GET
/api/v1/location/bus/:busId/latest— Latest location for a bus.
- Required fields are based on the actual validation in the code (
zodschemas or interfaces). Optional fields are marked with?. - For multipart profile updates, send
profileImageas a file field and the JSON fields in adatapart parsed by the middleware.