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

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

Adding users/groups to a repository using REST API 2.0

I am trying to add existing user/group to a bitbucket repository (public/private) using REST API 2.0. I am not able to find any endpoints available for it! Can anyone help me with it?

This might be a duplicate of the question:

But even there no answers are found!!

2 answers


I was able to add groups to a repo via API 2.0 in Bitbucket Cloud. Instead of trying to add groups to a repo directly, I tired to add Branch Permission to a repository. Something like this.

curl --url "{WORKSPACE}/branch-restrictions" --user username:password --request POST --header "Content-Type: application/json" --data "{"kind": "push", "pattern": "{branch_name}","groups": [{"name": "{group_name}","type": "group", "slug": "{group_name}"}]}"

By executing this I was able to add the group to my repository and also was able to set branch permission to that group. But there is one issue, Executing this added all the available groups to the repository with admin access.

0 votes

Hi @Akshay b and welcome to the community.

At the moment there is no support for adding users/groups to a repo via API 2.0 in Bitbucket Cloud. Until this is implemented, we have temporary support for 1.0 API resources that can do this.

The following endpoint can be used to send an invitation for direct repo access, see POST send an invite:

The following can be used to send an invitation to a user group, see Issue an invitation to a group:

If you want to create a new user group in a workspace, you can use the following endpoint, see POST a new group:

I hope this helps, please feel free to let me know if you have any questions!

Kind regards,

Thanks @Theodora Boudale . I was able to add groups to a repository in a different way. Check out my answer.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,725 views 10 16
Read article

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