Appearance
Change password
Changes the account password when you know the current one.
POST /api/v1/auth/change-password
Body
| Field | Type | Required | Description |
|---|---|---|---|
current_password | string | Yes | The password in use now. |
password | string | Yes | The new password. At least 8 characters. |
password_confirmation | string | Yes | The new password again. Must match password. |
Example
bash
curl -X POST https://app.xash.co.zw/api/v1/auth/change-password \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"current_password":"OLD_PASSWORD","password":"NEW_PASSWORD","password_confirmation":"NEW_PASSWORD"}'Response 200
json
{
"success": true,
"message": "Password changed successfully."
}All session tokens are deleted, including the one used for this request if it was a session token. Sign in again to get a new one. Server tokens keep working.
Errors
| Status | When | Body |
|---|---|---|
422 | current_password is wrong. | {"success": false, "message": "Current password is incorrect."} |
422 | The new password is too short or the confirmation does not match. | Validation error |
If you have forgotten the current password, see Forgotten password.