> ## Documentation Index
> Fetch the complete documentation index at: https://doc-dev.weir.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Change Password

> Change user password

# Change Password

Change the authenticated user's password.

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH 'https://api.weir.ai/user/change/password' \
    -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
    -H 'Content-Type: application/json' \
    -H 'x-source: console' \
    -d '{
      "password": "currentPassword123",
      "newPassword": "newSecurePassword456!"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "message": "Password changed successfully",
    "status": "success"
  }
  ```
</ResponseExample>

## Request Body

<ParamField body="password" type="string" required>
  Current password for verification.
</ParamField>

<ParamField body="newPassword" type="string" required>
  New password (must meet security requirements).
</ParamField>

## Password Requirements

* Minimum 8 characters
* At least one uppercase letter
* At least one lowercase letter
* At least one number
* At least one special character

## Usage Examples

<CodeGroup>
  ```javascript JavaScript theme={null}
  const changePassword = async (currentPassword, newPassword, accessToken) => {
    const response = await fetch('https://api.weir.ai/user/change/password', {
      method: 'PATCH',
      headers: {
        'Authorization': `Bearer ${accessToken}`,
        'Content-Type': 'application/json',
        'x-source': 'console'
      },
      body: JSON.stringify({
        password: currentPassword,
        newPassword: newPassword
      })
    });
    if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
    return await response.json();
  };
  ```

  ```python Python theme={null}
  import requests

  def change_password(current_password, new_password, access_token):
      response = requests.patch(
          'https://api.weir.ai/user/change/password',
          headers={
              'Authorization': f'Bearer {access_token}',
              'Content-Type': 'application/json',
              'x-source': 'console'
          },
          json={
              'password': current_password,
              'newPassword': new_password
          }
      )
      response.raise_for_status()
      return response.json()
  ```
</CodeGroup>

<Tip>
  **Pro Tip**: Implement password strength validation on the client side before submission.
</Tip>
