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 '{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

# get userId by emailId
curl --request GET   --url '{directoryId}/Users?'   --header 'Authorization: Bearer <access_token>'   --header 'Accept: application/json'

# deactivate the user with userId
curl --request DELETE \
  --url '{directoryId}/Users/{userId}' \
  --header 'Authorization: Bearer <access_token>'