This tutorial will help you to:
This API will not do the following:
site-admins, org-admins, system-administrators, atlassian-addons, or atlassian-addons-admin, or rename a group to one of these names.To complete this tutorial, you need the following:
The Rename group script uses an API key as a Bearer access token. It also uses the Organization ID field as a path parameter.

To create an API key and get the Organization ID:
Learn more about the API keys.
The v2 APIs are directory-aware, so you need a directoryId as a path parameter. Use the API key and Organization ID from the previous step with the Get directories endpoint to get the directoryId: GET /admin/v2/orgs/{orgId}/directories
1 2 3 4 5curl --request GET \ --url 'https://api.atlassian.com/admin/v2/orgs/{orgId}/directories' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json'
Search the results to find the correct directoryId.
Learn more about the Get directories API.
The groupId is a required path parameter to rename a group. Use the directoryId, API key and Organization ID from the previous steps with the Search for groups endpoint and the current group name as the search term: POST /admin/v2/orgs/{orgId}/directories/{directoryId}/groups/search
1 2 3 4 5 6 7 8 9 10curl --request POST \ --url 'https://api.atlassian.com/admin/v2/orgs/{orgId}/directories/{directoryId}/groups/search' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "searchTerm": "<current group name>", "limit": 20 }'
Search the results by group name to find the correct groupId.
Learn more about the Search for groups API.
Use the groupId, directoryId, API key and Organization ID from the previous steps to rename the group: PUT /admin/v2/orgs/{orgId}/directories/{directoryId}/groups/{groupId}
Only the fields you include in the request body are changed. To rename the group and keep its current description, send only name:
1 2 3 4 5 6 7 8 9curl --request PUT \ --url 'https://api.atlassian.com/admin/v2/orgs/{orgId}/directories/{directoryId}/groups/{groupId}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "name": "<new group name>" }'
To rename the group and update its description at the same time, send both fields:
1 2 3 4 5 6 7 8 9 10curl --request PUT \ --url 'https://api.atlassian.com/admin/v2/orgs/{orgId}/directories/{directoryId}/groups/{groupId}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "name": "<new group name>", "description": "<new description>" }'
A successful request returns 204 No Content. If the group can’t be renamed, the API returns:
400 when the group is synchronized through SCIM, is restricted from being modified, or is referenced in a Jira configuration that doesn’t support renames.409 when a group with the new name already exists in the directory, or the new name is restricted.Make your first request and get started with the Update group API and get more information on error codes.
Rate this page: