Remove(delete) users from an Atlassian Cloud site or organization using Postman and REST APIs
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
This document serves solely as a knowledge base resource. Please be aware that customization and development requests are not covered under Atlassian's support offerings. For assistance with such requests, we will refer customers to our developer network or partner network.
When to use this article
This article may be used any time there is a need to remove(delete) users in bulk from an Atlassian Cloud site. For example, after testing user migration to Atlassian Cloud, it may be necessary to remove many users from the organization to re-test, or after a company merger, it may be necessary to remove old accounts.
This article assumes that Jira is available on the Cloud site.
When not to use this article
This article will not work for organizations with users and groups provisioned with Atlassian Guard SCIM, as these groups will be recreated following the next update/synchronization. Please refer to your identity provider administrator to make changes to users provisioned through SCIM.
Identify your organisation’s user management UI experience
Head to admin.atlassian.com. Select your organization if you have more than one.
Original | Centralized |
As a site administrator or organization admin, Users is found under the Product site. If the Users page is not present under the Directory tab, then you have the Original user admin UI experience. | As an organization admin, Users is found under Directory tab. |
Prepare data
Go to admin.atlassian.com. Select your organization if you have more than one.
This step is different depending on your user management experience:
- Original: Select the site's name and URL to open the Admin for that site, then select Users.
- Centralized: Select Directory > Users.This step is different depending on your user management experience:
- Original: Select Export users.
- Centralized: At the top of the screen, select > Export users.Select the users that you’d like to export:
All users in your site/organization – Include all users in your site/organization, across all groups.
Users from selected groups only – Only includes users in the groups you select.
Select "All users" to include all active, suspended and deactivated users.
Select further options to include additional data in the download, which may assist with filtering the data:
Group membership – Includes groups a user belongs to. By default, multiple groups are formatted as a comma-separated list.
Product access – Includes the product and product roles a user has access to.
Select Export users.
An email will be sent when the CSV file is ready to download. Check your junk or spam folder if it’s taking awhile.
Open the email and select Download CSV file. If you’re not logged in, you may need to log in before the download will begin.
Using a spreadsheet program or text editor, remove all rows that should not be deleted, for example, organization administrators.
Ensure that the user executing the deletion is removed.
Ensure the column "User id" (the Atlassian account id) is not removed during cleanup.
Save the csv, now containing a list of all users to be removed.
Set up Postman
This section may be skipped if:
a collection named "Atlassian Cloud User Management" has previously been set up, and
an environment named "Atlassian Cloud" has previously been set up
Set up REST API call
Select New, or type
Ctrl
+N
(Windows/Linux) orCmd
+N
(MacOS).Select "HTTP".
Name the request "Remove user from Atlassian Cloud site".
Change the method from
GET
toDELETE
.In the URL, paste:
{{cloudUrl}}/rest/api/2/user?accountId={{User id}}
Select the "Authorization" tab.
Ensure Type is "Inherit auth from parent".
Select Save , saving into the "Atlassian Cloud User Management" collection.
Execute runner
Change the environment using the environment selector at the top right of Postman, selecting "Atlassian Cloud".
Select Collections in the sidebar.
Select the "Atlassian Cloud User Management" collection.
On the Overview tab, select ▶️ Run towards the top right corner.
Under Run order, ensure there is one and only REST API call - "Remove user from Atlassian Cloud site".
On the Functional tab, select Run manually.
Select Data.
Navigate to and select the previously prepared csv file.
Reduce the number of "Iterations" under Run configuration to 1.
We strongly recommend testing with a single user and verifying results before systematically deleting/removing all users. Also, please be advised that the API will skip any accounts who have data associated with those accounts, e.g. if a user has made a comment or created a Jira issue using their account, then the API will skip that user and return a message similar to this:
{"errorMessages":["Cannot delete user because 1 issues were reported by this person.","Cannot delete user because they have made 1 comments."],"errors":{}}
Leave Advanced settings as is.
Select Run Atlassian Cloud User Management.
Check Postman to ensure the runner collection has passed all tests. The run results should show:
"Iterations" and "All tests" to be equivalent in count
Passed (n) where n is the number of iterations
Failed (0)
Skipped (0)
Check admin.atlassian.com to ensure the user count has been reduced by one.
Rerun Postman Runner following the previous steps, with the number of "Iterations" set to the number of rows in the csv file. One error may be expected as it is not possible to delete a user who has already been deleted.
References
There is an active feature request:
Feel free to add your vote to help us prioritise new developments based on our users' needs.