A Guide to Adding Multiple Users in Bulk to Jira Groups

A Guide to Adding Multiple Users in Bulk to Jira Groups

Are you tired of manually adding users one by one to your Jira groups? I have the perfect solution for you! This comprehensive guide will walk you through adding multiple users at once or in bulk to Jira groups. With a few simple steps and the power of automation, you can save time and effort while efficiently managing your Jira user groups. So, let's dive in and streamline your user management workflow!

Step 1: Ensure Admin Access and Create an API Token

To begin, make sure you have administrative access to your Jira instance. Contact your Jira administrator to assist you if you don't have admin privileges. Once you have admin access, create an API token by following these steps:

  1. Go to your Jira account settings.

  2. Locate the API token section and generate a new token.

  3. Wait for a moment as the token is generated. You will receive an email confirming the successful creation of your new API token.

Step 2: Obtain the Account IDs

You need to gather the account IDs of the users you want to add to the Jira groups. Here's how you can do it:

  1. Open Confluence Teams and search for the desired user by name.

  2. Once you find the user, navigate to their profile page.

  3. In the URL of the user's profile page, look for the accountID parameter. For example, if the URL is "your-domain.net/wiki/people/612498b16512980..," the accountID would be "612498b165129802006af619ef."

  4. Export the users' information to a CSV file. The exported CSV will contain a User ID column corresponding to the accountID.

Step 3: Identify the GroupID

To proceed, you need to obtain the GroupID for the target Jira group(s) to which you want to add the users. Here's how you can find the GroupID:

  1. Access the Jira administration settings.

  2. Navigate to the "Groups" section.

  3. Use the search functionality to find the desired group(s).

  4. Once you locate the group, check the URL in your browser. For example, if the URL is "admin.atlassian.com/s/*/groups/9366eda7-cbd..," the GroupID would be "9366eda7-cbde-41f6-8b6d-27fad9219e3c."

Step 4: Prepare the Input Data and Script

Now that you have the necessary information, it's time to input the data into a script that will automate the user addition process. Here's what you need to do:

  1. Open a text editor or script editor of your choice.

  2. Copy and paste the following script into the editor:


# Define the API endpoint and group ID

# Define the user account IDs to be added

# Loop through the user account IDs and send a curl request for each
  curl --request POST \
    --url "$API_ENDPOINT" \
    --user 'email@example.com:<api_token>' \
    --header 'Content-Type: application/json' \
    --data "{\"accountId\":\"$USER_ACCOUNT_ID\"}"

Make sure to replace 'https:/your-domain.net/wiki/rest/api/group/userByGroupId?groupId=9366eda7-cbde-41f6-8b6d-27fad9219e3c' it with the actual API endpoint corresponding to your Jira instance and group.

Step 5: Verify the User Addition

To confirm the success of the user addition process, you can use the following curl command:

curl --request GET
--url 'https://your-domain.atlassian.net/wiki/rest/api/group/member?name={name}'
--user 'email@example.com:<api_token>'
--header 'Accept: application/json' | jq .

Replace 'https://your-domain.atlassian.net/wiki/rest/api/group/member?name={name}' with the appropriate API endpoint for your Jira instance.

If you need to retrieve the name of your group, execute the following curl command:

curl --request GET
--url 'https://your-domain.atlassian.net/wiki/rest/api/group/by-id?id={id}'
--user 'email@example.com:<api_token>'
--header 'Accept: application/json' | jq .

Again, update 'https://your-domain.atlassian.net/wiki/rest/api/group/by-id?id={id}' with the relevant API endpoint.

Congratulations! You have successfully learned how to add multiple users in bulk to Jira groups using automation. Following the steps outlined in this guide and utilizing the provided script can save valuable time and effort when managing user access in Jira. Remember to ensure admin access, create an API token, gather account IDs, identify the GroupID, and execute the script to streamline your user management process. Happy collaborating with your expanded Jira groups!