Skip to main content
PATCH
https://api-dev.weir.ai/
/
user
/
change
/
password
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!"
  }'
{
  "message": "Password changed successfully",
  "status": "success"
}

Change Password

Change the authenticated user’s password.
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!"
  }'
{
  "message": "Password changed successfully",
  "status": "success"
}

Request Body

password
string
required
Current password for verification.
newPassword
string
required
New password (must meet security requirements).

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

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();
};
Pro Tip: Implement password strength validation on the client side before submission.