ورود | ثبت نام
  • FA
  • EN

API Docs

PUT /api/v1/auth/change-password

Allows the currently authenticated user to change their password.


Permissions

This endpoint requires authentication but does not require any special permissions. Users can only change their own password.


Request Body Parameters

NameTypeRequiredDescription
current_passwordstringYesThe user's current password
passwordstringYesThe new password (minimum 8 characters)
password_confirmationstringYesConfirmation of the new password

Notes:

  • The current_password must match the user's existing password.
  • The password field must be at least 8 characters long.
  • The password_confirmation must exactly match the password field.

Request Example

PUT /api/v1/auth/change-password
Authorization: Bearer {token}
Content-Type: application/json

{
  "current_password": "currentpassword123",
  "password": "newpassword123",
  "password_confirmation": "newpassword123"
}

Response

200 OK

Returns a success message when the password is changed successfully.

Example

{
  "message": "Password changed successfully."
}

Error Responses

StatusDescriptionReference
401Unauthorized (not authenticated)Authentication error
422Validation error (invalid input)See below

422 Validation Error Examples

{
  "message": "The current password field is required.",
  "errors": {
    "current_password": ["The current password field is required."]
  }
}
{
  "message": "The password is incorrect.",
  "errors": {
    "current_password": ["The password is incorrect."]
  }
}
{
  "message": "The password field must be at least 8 characters.",
  "errors": {
    "password": ["The password field must be at least 8 characters."]
  }
}
{
  "message": "The password confirmation field must match password.",
  "errors": {
    "password": ["The password confirmation field must match password."]
  }
}

Related Resources

footer wave
logo

دمبل، دنیای هوشمند ورزش و تغذیه

LinkedinInstagramXYoutubeTelegram