How to add uninvited users to groups using REST API on Atlassian Cloud

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

Summary

This article provides an overview of adding uninvited users to groups in the new user management experience using the Organizations REST API, particularly in situations where:

  • Users and groups are not provisioned via SCIM
  • Or the Atlassian Account is not listed under Directory / Users section in admin.atlassian.com

In the above two scenarios, if you use the Add user to group endpoint you will run into the User not found error with 404 response:

Environment

Solution

Pre-requisites

We will break the process into two steps mentioned below:

  1. Invite the managed account to be visible under Directory Users using the Create User API request
  2. Then the Add user to group endpoint can be used to add the user to the group

Below is the detailed set of instructions that will help you to add a managed account to a group:


Step 1Step 2
APICreate User APIAdd user to group
Request MethodPOSTPOST
Request URL

https://<site-url>/rest/api/3/user

https://api.atlassian.com/admin/v1/orgs/{orgId}/directory/groups/{groupId}/memberships

Request Body
{
    "emailAddress": "<email-address>",
    "products": []
}
{
    "account_id": "<Atlassian-Account-Id>"
}
Authentication Method

User API key

Admin API key




Last modified on May 29, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.