Skip to main content

Change Password API

Overview

Allows a user to change their password by verifying their existing oldPassword against stored passwordHash using bcrypt before updating.

  • Endpoint: /api/auth/change-password
  • Method: POST or GET
  • Auth Required: Optional / Public

Request Parameters (Body / Query)

FieldTypeRequiredDescription
emailIdStringYes (or email)User's registered email address
oldPasswordStringYesExisting current password
passwordStringYesNew password (min 6 characters)
confirmPasswordStringYesConfirmation matching password

Example Request Body

{
"emailId": "user@example.com",
"oldPassword": "OldPassword123!",
"password": "NewSecurePassword123!",
"confirmPassword": "NewSecurePassword123!"
}

Responses

Success Response (200 OK)

{
"success": true,
"message": "Password Updated",
"data": null
}

Invalid Old Password (400 Bad Request)

{
"success": false,
"message": "Invalid old password",
"data": null
}