How to Deactivate a Atlassian User

There are two different set of APIs for managing atlassian users, so there will be different ways to deactivate a user.

Deactivate a user from Admin portal

Deactivate a user with User Management API

curl --request POST \
  --url 'https://api.atlassian.com/users/{account_id}/manage/lifecycle/disable' \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Content-Type: application/json' \

Deactivate a user with User Provisioning API

if a user was provisioned by User Provisioning API, the previous step will not work, it has to be deactivated with User Provisioning API, for example, we need to deactivate a user test@example.com

# get userId by emailId
curl --request GET   --url 'https://api.atlassian.com/scim/directory/{directoryId}/Users?filter=userName%20eq%20%22test@example.com%22'   --header 'Authorization: Bearer <access_token>'   --header 'Accept: application/json'

# deactivate the user with userId
curl --request DELETE \
  --url 'https://api.atlassian.com/scim/directory/{directoryId}/Users/{userId}' \
  --header 'Authorization: Bearer <access_token>'

Reference