Bulk delete group memberships for Atlassian Cloud using Postman and REST APIs
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
When to use this article
This article may be used any time there is a need to bulk update and remove group memberships in Atlassian Cloud. Note that this article outlines how to update memberships, but does not update the usage of groups in Jira projects, Jira permission schemes, Confluence space permissions or Confluence page restrictions.
When not to use this article
This article will not work for organizations with users and groups provisioned with Atlassian Guard SCIM. Please refer to your identity provider administrator to make changes to group memberships 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
Export users and group memberships
- 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 and User status options as required.
Select the Additional data options to include the required data in the download:
Group membership – Includes groups the users belong to.
Pivot to column – Expands group data to generate a row for each group membership.
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 longer than expected to receive the email.
Open the email and select Download CSV file.
- Rename the file to
groups.csv
- Rename "Group id"(column A) column heading to
groupId
- case sensitive - Rename "User id"(column C) column heading to
accountId
- case sensitive - Remove rows corresponding to group memberships that you wish to keep - any group memberships mapped in the CSV will be removed, i.e. the group memberships listed in the final CSV will be the memberships that will be deleted.
Save the CSV.
Sample file - groups.csv
Notes:
- It is important that the
groupId
andaccountId
column headers are exactly like this below example because Postman will be iterating through these columns to delete the group memberships of the users listed in the CSV - Technically speaking, only columns A and C are required, all other columns are not required. Your CSV may have more columns than what is shown in this example. The number of columns correspond to the number of products that exist on the site/organization and the number of columns in the CSV does not affect the API calls that Postman will be making
- In this example, 6 users will be removed from the Engineering group, i.e. group membership to the Engineering group will be revoked for 6 distinct users
- The user "syncpolicytestuser3@domain.example" will be removed from 3 groups
- The users' accounts will remain on the site/org. - only the group memberships will be removed
groupId | Group name | accountId | User name | User status | Added to org | Org role | Last seen in Confluence - site-test3 | Last seen in Confluence - site-test3-sandbox | |
---|---|---|---|---|---|---|---|---|---|
e7b24a95-307c-4179-b143-18071d986420 | Engineering | 712020:789cba25-bbe2-45c5-a2b6-3a81ca61ba74 | SyncPolicy TestUser3 | syncpolicytestuser3@domain.example | Active | 1 Sep 2023 | None | Never accessed | Never accessed |
61cb3f2f-cc52-4458-8e0a-bf78ccd504bb | Sales | 712020:789cba25-bbe2-45c5-a2b6-3a81ca61ba74 | SyncPolicy TestUser3 | syncpolicytestuser3@domain.example | Active | 1 Sep 2023 | None | Never accessed | Never accessed |
685d588b-04ce-40c8-b8ca-00bc16a9e60a | IT | 712020:789cba25-bbe2-45c5-a2b6-3a81ca61ba74 | SyncPolicy TestUser3 | syncpolicytestuser3@domain.example | Active | 1 Sep 2023 | None | Never accessed | Never accessed |
e7b24a95-307c-4179-b143-18071d986420 | Engineering | 63b6efaab790087ed712a5c1 | User Test | usertest@domain.example | Active | 5 Jan 2023 | None | Never accessed | Never accessed |
942e2db7-0537-4296-9d59-3160c8433b9e | Finance | 712020:67392043-03d0-4867-aa8f-a7de831c9123 | test user | test.user@domain.example | Inactive | 7 Mar 2024 | None | Never accessed | Never accessed |
e7b24a95-307c-4179-b143-18071d986420 | Engineering | 6283b01fbd640f0068ad476d | pruser | pruser@domain.example | Active | 5 Jan 2023 | None | Never accessed | Never accessed |
e7b24a95-307c-4179-b143-18071d986420 | Engineering | 63b6efb248b367d78a18988d | Rachael | 1234@domain.example | Active | 5 Jan 2023 | None | Never accessed | Never accessed |
e7b24a95-307c-4179-b143-18071d986420 | Engineering | 712020:13d92893-a902-4936-8903-2abc4e7916d0 | Steve test | steve_test@domain.example | Active | 30 Oct 2023 | None | Never accessed | Never accessed |
e7b24a95-307c-4179-b143-18071d986420 | Engineering | 5fa522f08573800069c749ac | temp admin | temp_admin@domain.example | Inactive | 26 Aug 2022 | None | Never accessed | Never accessed |
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
Click New, or type
Ctrl
+N
(Windows/Linux) orCmd
+N
(MacOS).Select "HTTP".
Name the request "Remove User from Group in Atlassian Cloud".
Change the method from
GET
toDELETE
.In the URL, paste:
{{cloudUrl}}/rest/api/latest/group/user?groupId={{groupId}}&accountId={{accountId}}
Note that Postman variables are case-sensitive and must match what is supplied in the attached environment and spreadsheet.
Click the "Authorization" tab.
Ensure Type is "Inherit auth from parent".
Click Save, saving into the "Atlassian Cloud User Management" collection.
Execute Postman 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 Group in Atlassian Cloud" - selected.
On the Functional tab, select Run manually.
Click Data.
Navigate to and select the previously prepared csv file from "Map data".
Reduce the number of "Iterations" under Run configuration to 1.
Leave Advanced settings as is.
Click 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 in row 2 of the exported list has been made a member of the expected group.
Rerun Postman Runner following the previous steps, with the number of "Iterations" set to the number of rows in the csv file.
References
- Export users from a site
- Microsoft - Import or export text (.txt or .csv) files
- Jira Cloud REST API - Remove user from group
- Postman - Using the Collection Runner