Forgot Password
Authentication
Forgot Password
Request a password reset code via email
POST
Forgot Password
Endpoint
http://localhost:3000/api/v1
This endpoint is public and does not require authentication.
Request Body
string
required
The email address associated with the account. Works for both job seekers and companies.
Request Shape
Response
Success Response (200 OK)
boolean
Always
true for successful requests.object
Contains the submitted email address.
string
Generic success message that doesn’t reveal if the email exists in the system.
Security Behavior
What Actually Happens
1
Immediate Response
API returns success response immediately without waiting for email lookup.
2
Background Processing
System searches for the account in both JobSeeker and Company tables (asynchronously).
3
Email Exists
If account is found: - Generate 6-digit OTP code - Store OTP in Redis with 10-minute expiration -
Queue password reset email for delivery - Email is sent with the reset code
4
Email Doesn't Exist
If account is not found: - Process silently terminates - No email is sent - User sees same
response as successful case
Email Content
If the email exists, the user receives an email containing:- 6-digit OTP code
- Instructions to use the reset password endpoint
- Expiration notice (10 minutes)
- Security warnings
- Information about account protection
OTP Details
OTP Validity: Each password reset code is valid for 10 minutes from generation. After
expiration, users need to request a new code.
Error Responses
400 Bad Request - Validation Error
Returned when request validation fails.email must be an email- Invalid email formatemail should not be empty- Email field is missing
Validation Rules
Rate Limiting Considerations
While the API doesn’t currently enforce rate limiting, excessive requests may be throttled in the future.Response Time
The response is designed to be consistent regardless of whether the email exists:- ✅ Same response time (~50-100ms)
- ✅ Same HTTP status code (200)
- ✅ Same response structure
- ✅ No indication of email existence
Next Steps
After receiving the password reset code via email:- Use the code with the Reset Password endpoint
- Enter the 6-digit code along with the email and new password
- Wait for confirmation that password has been reset
- Login with the new password using the Login endpoint
Important Notes
Automatic User Type Detection: The system automatically determines whether the account is a
Job Seeker or Company account. You don’t need to specify the user type.
Security Notes
Privacy First: This endpoint is designed with security and privacy in mind. It never reveals
whether an email address is registered in the system.
Best Practices
- Don’t reveal email existence - Use generic success messages
- Consistent response times - Prevent timing attacks
- Time-limited OTPs - Codes expire after 10 minutes
- Attempt limiting - Maximum 3 verification attempts per OTP
- Single-use codes - Each OTP can only be used once successfully
Related Endpoints
- Reset Password - Complete password reset with OTP code
- Login - Login after resetting password
- Register Job Seeker - Create new job seeker account
- Register Company - Create new company account
