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

Bitbucket Rest API 2.0 get all users with access to repository


is there a way to get from bitbucket REST API 2.0 list of all users that have access to the repository?

Basically, the same data that is presented on the web page in "User and group access" in the admin section for the repository.

I have tried something like{name}/sample-repo/access but this resource does not exist.

Thank you

2 answers

1 accepted

0 votes
Answer accepted

Hello Krzysztof,

Using the Bitbucket v2 REST API does offer more endpoints then its v1 counterpart. Using the API to access which users are within a repo is a bit more straight forward now. The best option to see which users are within a repo is to use the /2.0/user/permissions/repositories endpoint. This endpoint will allow you to see all users with their permission level granted to your repositories. This endpoint does allow for additional filtering using the following examples:"geordi" or q=permission>"read"

I hope this proves helpful in your quest to gather all users within a repo.

Stephen Sifers

When I try this endpoint, I get the repositories the connected user can access, not the users in a repository (I believe this is consistent with the doc:

Am I missing something?

Like amishra80 likes this

Did you got any answer?

Well, this endpoint not return all users have access in specific repositories, do you have another measures?

How is this the accepted answer? It doesn't answer the question at all.

For anyone who keeps coming back to this question like I have, the accepted answer is NOT correct.  As stated by @Marc Verstaen the accepted answer only returns the caller's permissions, not the permissions of the users that have access to a repository.

To get that information, you need to use either the /2.0/workspaces/{workspace}/permissions/repositories endpoint, which will return all repository permissions within your workspace, or the /2.0/workspaces/{workspace}/permissions/repositories/{repo_slug} endpoint, which will return all the permissions for the specified repository.

"Permissions returned are effective permissions: the highest level of permission the user has. "

Why can't we retrieve the actual permissions on a repository like they are listed on the "User and group access" page? Now, I somehow have to use a deprecated 1.0 API to get groups and their users. Then use this endpoint to get effective permissions, and then use an unreliable diff to figure out direct permissions.

I would like to see a simple endpoint that just returns repository permissions like shown on the configuration page: groups and users.

Suggest an answer

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

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

192 views 2 4
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