Deactivate a user
You can call the API to deactivate a user.
Prerequisites
- All the user's account memberships are disabled.
- The user isn't the legal representative for any account.
- The user doesn't have a team membership to any of your projects.
- Go to Dashboard > your profile > Team management to confirm the user isn't a team member.
Finally, you need a project access token to call the mutation.
Guide​
- Call the
deactivateUser
mutation. - Add the user ID for the user you need to deactivate.
- Add success payload (line 3) and all rejections (lines 6, 11, 16).
Mutation​
🔎 Open the mutation in API Explorer
mutation DeactivateUser {
deactivateUser(input: { userId: "$USER_ID" }) {
... on DeactivateUserSuccess {
__typename
}
... on UserCannotBeDeactivatedRejection {
__typename
message
userId
}
... on UserAlreadyDeactivatedRejection {
__typename
message
userId
}
... on UserNotFoundRejection {
id
message
}
}
}
Success payload​
The following payload shows a successful deactivation.
{
"data": {
"deactivateUser": {
"__typename": "DeactivateUserSuccess"
}
}
}
Rejection payload​
The following payload shows an unsuccessful deactivation. This user couldn't be deactivated because they're a legal representative.
{
"data": {
"deactivateUser": {
"__typename": "UserCannotBeDeactivatedRejection",
"message": "User with id '$USER_ID' can't be deactivated (reason=The user is a legal representative)",
"userId": "$USER_ID"
}
}
}