Documentation Index
Fetch the complete documentation index at: https://mintlify.com/praveenarya123/sps-backend/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/auth/login
Authenticates a user by email and password. On success, returns a signed JWT and the user’s role. No authentication is required to call this endpoint.
Request body
Email address of the registered user.
Plain-text password. Compared against the stored bcrypt hash.
Response
Signed JWT. Pass this value in the
Authorization header of subsequent requests.Role of the authenticated user. One of
SUPER_ADMIN, ACADEMIC_ADMIN, STUDENT_ADMIN, FINANCE_ADMIN, OPERATIONS_ADMIN, TEACHER, or STUDENT.Using the token
The JWT middleware reads the token directly from theAuthorization header as a raw string value — not as a Bearer scheme. Set the header as follows:
Error cases
| HTTP status | Message | Condition |
|---|---|---|
404 | User not found | No account exists for the provided email |
400 | Wrong password | Account found but password does not match |
Examples
Authenticating subsequent requests
Once you have the token, include it in theAuthorization header of every protected request:
cURL
The JWT payload contains the user’s
id and role. These are used by downstream middleware to enforce role-based access control on protected routes.