Update user email
POST
/api/v1/usersUpdates the email address of an existing user. The email can be changed at any time, even if the user has active cases.
cv-api-key
Production
https://api.care360-next.carevalidate.com/api/v1/usersStaging
https://api-staging.care360-next.carevalidate.com/api/v1/usersHeaders
Headers
cv-api-keystringrequiredYour unique API key for authentication.
Content-TypestringrequiredMust be application/json.
Example:
application/jsonRequest Body
Body Parameters
actionstringrequiredThe action to be performed. Must be UPDATE_EMAIL.
Values:UPDATE_EMAIL
dataobjectrequiredAn object containing the current and new email addresses.
Show 2 child properties
currentEmailstringrequiredThe user's current email address.
Example:
john.doe@example.comnewEmailstringrequiredThe new email address for the user.
Example:
doe.john@example.comExample Request
- cURL
- JavaScript
- Python
curl --location '<BASE_URL>/api/v1/users' \
--header 'cv-api-key: <redacted>' \
--header 'Content-Type: application/json' \
--data-raw '{
"action": "UPDATE_EMAIL",
"data": {
"currentEmail": "john.doe@example.com",
"newEmail": "doe.john@example.com"
}
}'
const response = await fetch('<BASE_URL>/api/v1/users', {
method: 'POST',
headers: {
'cv-api-key': '<redacted>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
action: 'UPDATE_EMAIL',
data: {
currentEmail: 'john.doe@example.com',
newEmail: 'doe.john@example.com',
},
}),
});
const data = await response.json();
console.log(data);
import requests
response = requests.post(
'<BASE_URL>/api/v1/users',
headers={
'cv-api-key': '<redacted>',
'Content-Type': 'application/json',
},
json={
'action': 'UPDATE_EMAIL',
'data': {
'currentEmail': 'john.doe@example.com',
'newEmail': 'doe.john@example.com',
},
},
)
print(response.json())
Responses
▶200Email updated successfullyThe email was updated successfully. Returns the updated user object.
{
"status": 200,
"success": true,
"message": "Email updated successfully",
"data": {
"user": {
"email": "doe.john@example.com",
"firstName": "John",
"lastName": "Doe",
"dob": "2000-10-01",
"phoneNumber": "+11111111111",
"gender": "MALE",
"address": "1 ABC St",
"address2": "Apt 3",
"city": "NYC",
"state": "NY",
"country": "US",
"postalCode": "10101"
}
}
}
▶400User does not existThe currentEmail does not match an existing user.
{
"status": 400,
"success": false,
"message": "User {currentEmail} does not exist"
}
▶400User not in organizationThe user exists but is not part of the organization associated with the API key.
{
"status": 400,
"success": false,
"message": "User {currentEmail} does not exist in the organization"
}
▶400Not allowed to update emailThe user's role is not USER, so they cannot update their email.
{
"status": 400,
"success": false,
"message": "Not allowed to update the email"
}
▶400New email already existsThe newEmail is already associated with another user.
{
"status": 400,
"success": false,
"message": "New Email {newEmail} already exists"
}
▶400Email exists in databaseThe new email is already associated with an existing user in the database with a different ID.
{
"status": 400,
"success": false,
"message": "User with email {newEmail} already exists in database"
}
▶400Email exists in auth serviceThe new email is already linked to a different user account in the authentication system.
{
"status": 400,
"success": false,
"message": "User with email {newEmail} already exists in authentication"
}
Try It Out
Try itAPI Playground
▶