Remove all groups on Jira Cloud

Platform Notice: Cloud and Data Center - This article applies equally to both cloud and data center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Learn how to remove all groups from your Jira Cloud instance through the Jira Cloud Platform REST API.

Overview

During the migration journey to the cloud, it might be necessary to remove all groups from a Jira Cloud instance.

This article provides step-by-step instructions on using a script that utilizes the Jira Cloud Platform REST API requests to delete all groups in the instance.

Solution

Make sure to take appropriate backups, test this solution in a staging environment, and consider the implications before proceeding with all groups deletion.

Deleting the groups is irreversible.

  1. Open a text editor.

  2. Copy and paste the below script into the text editor.

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 #!/bin/bash ############ REQUIREMENTS ############ #1. Set the Jira Cloud instance URL JIRA_URL=https://<instance>.atlassian.net #2. Set your username USER=<user@domain.com> #3. Set your Jira Cloud API token API_TOKEN=<api_token> ############ ############ ############ # Requesting a list of all the groups into "response.txt" curl -s --request GET \ --url "$JIRA_URL/rest/api/3/groups/picker?maxResults=1000" \ --user $USER:$API_TOKEN > response.txt # Extracting the group IDs into "groupids.txt" cat response.txt | grep -o '"groupId":"[^"]*"' | awk -F'"' '{print $4}' > groupids.txt # Request to delete the groups id=($(cat groupids.txt)) for id in "${id[@]}" do curl --request DELETE \ --url "$JIRA_URL/rest/api/2/group?groupId=$id" \ --user $USER:$API_TOKEN done
  3. Replace "<instance>" with your actual Jira Cloud instance name on line number five.

  4. Replace "<user@domain.com>" with your user's email address on line number eight.

  5. Replace "<api_token>" with your API Token on line 11. (Create an API token and Use an API token)

  6. Save the file with .sh extension (e.g. delete-groups.sh).

  7. Open your terminal.

  8. Give permission execution to the .sh file with the command:

    1 $ chmod +x delete-groups.sh
  9. Execute the script with the command:

    1 $ ./delete-groups.sh

Note that read-only groups cannot be deleted, in this case you will see the API return the message "You do not have permission to remove this group from all the directories in which it occurs."

The script retrieves 1000 groups by default.

If the instance has more groups, you can run the script again or adjust the value of the parameter ?maxResults in line 16.

What does this script do exactly?

The script will:

  1. Retrieve the first 1000 groups from the provided cloud instance.

  2. Extract the IDs of the groups.

  3. Trigger the deletion of the given group IDs.

Updated on April 17, 2025

Still need help?

The Atlassian Community is here for you.