[role="xpack"]
[[security-api-change-password]]
=== Change Password API

The Change Password API enables you to submit a request to change the password
of a user.

==== Request

`POST _xpack/security/user/_password` +
`POST _xpack/security/user/<username>/_password` 


==== Path Parameters

`username`::
  (string) The user whose password you want to change. If you do not specify
  this parameter, the password is changed for the current user.


==== Request Body

`password` (required)::
  (string) The new password value.


==== Authorization

Every user can change their own password. Users with the `manage_security`
privilege can change passwords of other users.


==== Examples

The following example updates the password for the `elastic` user:

[source,js]
--------------------------------------------------
POST _xpack/security/user/elastic/_password
{
  "password": "x-pack-test-password"
}
--------------------------------------------------
// CONSOLE

A successful call returns an empty JSON structure.

[source,js]
--------------------------------------------------
{}
--------------------------------------------------
// TESTRESPONSE

[role="xpack"]
[[security-api-change-password]]
=== Change Password API

The Change Password API enables you to submit a request to change the password
of a user.

==== Request

`POST _xpack/security/user/_password` +

`POST _xpack/security/user/<username>/_password`


==== Path Parameters

`username`::
  (string) The user whose password you want to change. If you do not specify
  this parameter, the password is changed for the current user.


==== Request Body

`password` (required)::
  (string) The new password value.


==== Authorization

Every user can change their own password. Users with the `manage_security`
privilege can change passwords of other users.


==== Examples

The following example updates the password for the `elastic` user:

[source,js]
--------------------------------------------------
POST _xpack/security/user/elastic/_password
{
  "password": "x-pack-test-password"
}
--------------------------------------------------
// CONSOLE

A successful call returns an empty JSON structure.

[source,js]
--------------------------------------------------
{}
--------------------------------------------------
// TESTRESPONSE

Fix formatting in change password API
[DOCS] Fix formatting in change password API

Original commit: elastic/x-pack-elasticsearch@acbe051abb686fb46f20b22a29b3d4330dd46de9
