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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

how to add existing user group to repository on bitbucket with REST API


Hi I'm trying to create a script which will add existing user group to repository on bitbucket.

I tried something like this: 


groups_for_adding = f'{workspace}/{repo}/{groupname} --data write'
response = requests.put(groups_for_adding, auth=HTTPBasicAuth(username, password))


Also tried solutions from this link:


Any help is very welcomed... :)


1 answer

0 votes
Mark C Atlassian Team Apr 20, 2022

Hi @ext_momcilo_vasic

Welcome to the community.

I've checked our API v1 documentation and compared it with the endpoint you've used and I believe you're just missing the "group_owner" which is the same as the workspace ID.

You can check the documentation on this link (Under "PUT group privileges on a repository").

Here's the exact endpoint:

PUT{workspace_id}/{repo_slug}/{group_owner}/{group_slug} --data "{privilege}"

As an example, if your repository is: some_workspace/some_repo
And your user group name is: some_group

The API endpoint would be:

Btw, please also make sure you're using an App password (as your password credential) as we recently deprecated the Atlassian account password.

Hope it helps and do let me know if you have further questions that I can help with.

Mark C

thanks for the answer, with this api I'm getting following answer

curl --request PUT --user user:password PUT{workspace_id}/{repo_slug}/{group_owner}/{group_slug} --data "{privilege}"

is not a valid privilege

tried with this commands:

curl --request PUT --user user:password --data read

curl --request PUT --user user:password --data "read"


any idea what is wrong?

Mark C Atlassian Team Apr 21, 2022

Hi @ext_momcilo_vasic

I've tried the similar CURL Command below, however, it works fine on my end using an App password.

curl --request PUT --user user:password --data read

Would you be able to confirm if you're using an App password?
You can also try to add the flag -vv in your CURL command to debug it further and see what's happening when it tries to connect to

Let me know how it goes.

Mark C

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events