Adding 'n' number of users in a Stash group.

Good afternoon .

I want to add some 100 users into a group in Stash. I am an admin and so I am able to create group and add users. Do I have to add the users individually, or can I add them together, instead of seperately in the group via some plug-in??




2 answers

1 accepted

1 vote
Accepted answer

Hi Jewel,

To retrieve a list of users from your instance (which is documented here: and use as an input for a parser to obtain the list of users you want to assign to a certain group, please use the curl call below:

$ curl --user admin:admin http://localhost:7990/rest/api/1.0/admin/users


{"size":3,"limit":25,"isLastPage":true,"values":[{"name":"admin","emailAddress":"","id":1,"displayName":"Thiago Bomfim","active":true,"slug":"admin","type":"NORMAL","directoryName":"Stash Internal Directory","mutableDetails":true,"mutableGroups":true,"link":{"url":"/users/admin","rel":"self"},"links":{"self":[{"href":"http://localhost:7990/users/admin"}]}},{"name":"testuser1","emailAddress":"","id":2,"displayName":"Test User 1","active":true,"slug":"testuser1","type":"NORMAL","directoryName":"Stash Internal Directory","mutableDetails":true,"mutableGroups":true,"link":{"url":"/users/testuser1","rel":"self"},"links":{"self":[{"href":"http://localhost:7990/users/testuser1"}]}},{"name":"testuser2","emailAddress":"","id":51,"displayName":"Test User 2","active":true,"slug":"testuser2","type":"NORMAL","directoryName":"Stash Internal Directory","mutableDetails":true,"mutableGroups":true,"link":{"url":"/users/testuser2","rel":"self"},"links":{"self":[{"href":"http://localhost:7990/users/testuser2"}]}}],"start":0}

The following curl call works for me and assign the users "testuser1" and "testuser2" to a group called "newtestgroup". This is documented here:

$ curl -H "Content-Type:application/json" -H "Accept:application/json" --user admin:admin -X POST -d '{"group": "newtestgroup","users": ["testuser1","testuser2"]}' http://localhost:7990/rest/api/1.0/admin/groups/add-users

I hope that is helpful.

Best regards,
Thiago Bomfim
Atlassian Support - DevTools


THank you Thiago. It helps alot. Regards, -Jewel

This works perfectly, is it possible to add users using email id or displayname instead of Users ?

You can do this via the REST API. (You need [POST] )

I think there this is mislinked. This should be the right rest point to use

It seems that the numbers after the # change for each session(?) If I navigate to the right place, copy the link, close the tab, paste the link, it takes me to a different place than previously. Anyway. Updated the answer to be more helpful.

Balazs/Deric, Thank you for the update. I am checking it out. Will let you know of the outcome.

How does the REST API work to add users when a system is connected to LDAP ? If a stash instance is LDAP enabled it should authenticate the users against LDAP, and find user attributes such as email in LDAP. Is it allowed to add users via REST API without specifying values for email and password ?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

1,963 views 7 10
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you