This API is available only to customers using the new user management experience. Learn more about the new user management experience.
This tutorial will help you to:
The functionality of this API does not include the ability to make modifications to group memberships that are synchronized through SCIM. To make changes to these memberships, you will need to modify them within your external identity provider. Learn more about configuring user provisioning with an identity provider.
To complete this tutorial, you need the following:
API token ≠ API key:
These are required path parameters to add user to group.
An API token is needed to get the accountId and groupId in the next step. Use the API token to authenticate your script.
To create an API token:
To get the accountId:
Use the Jira user search API with the API token and Basic authentication to get the accountId: GET /rest/api/3/users/search
1 2curl --request GET \ --url 'https://your-domain.atlassian.net/rest/api/3/users/search' \ --user 'email@example.com:<api_token>' \ --header 'Accept: application/json'
Search the results by email address or name to find the correct accountId.
Learn more about the Jira API.
If you don’t have Jira, export a .csv of the user list. Learn how to export users from a site
To get the groupId:
Use the Jira group search API with the API token and Basic authentication to get the groupId: GET /rest/api/3/groups/picker
1 2curl --request GET \ --url 'https://your-domain.atlassian.net/rest/api/3/groups/picker' \ --user 'email@example.com:<api_token>' \ --header 'Accept: application/json'
Search the results by email address or name to find the correct accountId.
Learn more about the Jira API.
If you don’t have Jira, export a .csv of the user list. Make sure to select pivot to column when prompted. Learn how to export users from a site
The Add user to 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.
Use the accountId, groupId, API key and Organization ID from the previous steps to Add user to group: POST /admin/v1/orgs/{orgId}/directory/groups/{groupId}/memberships
1 2curl --request POST \ --url 'https://api.atlassian.com/admin/v1/orgs/{orgId}/directory/groups/{groupId}/memberships' \ --header 'Authorization: Bearer <api_key>' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "account_id": "<string>" }'
Make your first request and get started with the Add user to group API and get more information on error codes.
Rate this page: