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/register
Creates a new user account. No authentication is required. The password is hashed with bcrypt before being stored.
Request body
Full name of the user.
Email address of the user. Must be unique across all accounts. Attempting to register with a duplicate email will cause a MongoDB duplicate key error.
Plain-text password. Hashed with bcrypt (10 salt rounds) before storage.
Role assigned to the user. Must be one of the following values:
SUPER_ADMINACADEMIC_ADMINSTUDENT_ADMINFINANCE_ADMINOPERATIONS_ADMINTEACHERSTUDENT
Response
Returns the newly created user document as stored in MongoDB.MongoDB ObjectId of the created user.
Full name of the user.
Email address of the user.
Role assigned to the user.
Bcrypt-hashed password. Returned by the API because the User model does not apply
select: false to this field.MongoDB document version key.
Error cases
| Condition | Result |
|---|---|
email already exists | MongoDB E11000 duplicate key error (unhandled — the server returns a 500-level response) |
| Missing required fields | The document is saved with undefined values — no validation error is thrown unless the schema is updated to enforce required fields |
Invalid role value | MongoDB validation error due to the enum constraint |
The current implementation does not include explicit error handling middleware. Duplicate email errors and validation failures will surface as unformatted MongoDB errors in the response body.