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 user 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"
}
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"
}
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();
};
Was this page helpful?