Method for Changing User Password

User password can be changed using the change_password API method. Two request types are available: with the PUT and PATCH methods. Before changing the password it is recommended to check new password correspondence with the requirements that are set in security settings.

Password change request using the PUT method:

curl -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer <user token>" -d '{"password":"<new password>","confirm_password":"<repeat new password>","old_password":"<old password>"}' "<IP address or server DNS name>/api/v1/accounts/current_user/change_password/"

Password change request using the PATCH method:

curl -X PATCH -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer <user token>" -d '{"password":"<new password>","confirm_password":"<repeat new password>","old_password":"<old password>"}' "<IP address or server DNS name>/api/v1/accounts/current_user/change_password/"

Positive response (code 200):

{

  "id": 38,

  "username": "test",

  "project": "anproject",

  "environment": "analytics"

}

Negative response (code 400):

{

  "__all__": [

    "\"password\" and \"confirm_password\" mismatch"

  ]

}

See also:

Server API | Managing Passwords