Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Rest Api to add user in Confluence group

I'm totally new to rest api and I do not know where to start. But after some googling I tried this in powershell

curl --request POST \
>> --url 'https://confluenceURI/rest/api/group/user?name={name}' \
>> --header 'Content-Type: application/json' \
>> --data '{
>> "accountId": "{---}"
>> }'

But it's giving me an error

At line:2 char:5
+ --url 'https://confluenceURI/rest/api/gr ...
+ ~
Missing expression after unary operator '--'.
At line:2 char:5
+ --url 'https://confluenceURI/rest/api/gr ...
+ ~~~
Unexpected token 'url' in expression or statement.
At line:3 char:5
+ --header 'Content-Type: application/json' \
+ ~
Missing expression after unary operator '--'.
At line:3 char:5
+ --header 'Content-Type: application/json' \
+ ~~~~~~
Unexpected token 'header' in expression or statement.
At line:4 char:5
+ --data '{
+ ~
Missing expression after unary operator '--'.
At line:4 char:5
+ --data '{
+ ~~~~
Unexpected token 'data' in expression or statement.
At line:4 char:9
+ --data '{
+ ~
The Data section is missing its statement block.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingExpressionAfterOperator

Our confluence is on server. Any help would appreciated. 

3 answers

0 votes
JimmyVanAU Community Leader Nov 28, 2020


There isn't an official REST API endpoint to add users to groups unfortunately. See for what is available.

With respect to curl, I'm guessing your query came from another website. It looks like the >> indentation is confusing Powershell. Try

curl --request POST \
--url 'https://confluenceURI/rest/api/group/user?name={name}' \
--header 'Content-Type: application/json' \
--data '{ \
"accountId": "{---}" \

I've also added some further \ to the last two lines.

Cheers, Jimmy

Hi @JimmyVanAU 

Does that means I'll be not able to add users in a group using rest; writing anything in Powershell?

For >>, when I copy paste everything it just comes by default and I can not remove it. Not sure if I'm doing anything wrong.

Just conforming what would you right the name and acountid here:

"accountId": "{---}"

and again it's giving me the same errors

0 votes
Prince Nyeche Community Leader Nov 28, 2020

Hi @Spatel 

Let me emphasize on the difference here. First of all, there's no API for adding users to group on Confluence Server. secondly, Atlassian Server Products doesn't use accountId, so the example you might be using is totally wrong.

I would suggest you look into using an SQL query, if you want to add users to a group on confluence server. A simple query to see a list of users and their matching groups below to give you an idea.

select, cd.user_name,,  g.group_name, g.lower_group_name from cwd_user cd
join cwd_group g on cd.directory_id = g.directory_id;

Once you have an idea of how the structures are, then you can simply do an "insert" query to add a new user into a specific group that exist on the table cwd_group which is where the user groups are stored. Also you might want to do a directory search prior to know what kind of directory exist on your Instance.

select * from cwd_directory;

I highly recommend, you run a test environment for Confluence Server and perform such SQL queries to see the result. Then, if it's what you're looking for, you can apply that to your Production environment.

@Prince Nyeche 


Thanks a lot for detailed explanation, but I don't have access to backend and that's the reason I'm trying to do from PowerShell. Do you have any other suggestions, that I can try in PwoerShell?

0 votes
JimmyVanAU Community Leader Nov 29, 2020

Hi Spatel,

There aren't many alternatives unfortunately. There's AtlassianPS (, but that builds on the REST API. Development also looks to have stalled. May be worth asking the AtlassianPS Slack community for suggestions.

Are marketplace apps an option? Bulk User Upload Management Utility ( may be worth your while.

Otherwise it may help to step back, look at the bigger problem, consider authentication as the larger problem, and investigate SAML SSO. Many of those apps will allow you to create users (on first login, or in bulk) and keep them updated directly from your source user directory, be it Azure AD, G Suite, Okta, etc.

Cheers, Jimmy

Hi @JimmyVanAU 

Thanks! I'll take a look at AtlassianPS

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you