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

API for Bitbucket Edited

I am looking for the REST API for Bitbucket to show the number of repositories. I spent a while researching, but still am at a loss.


I also found this:


If I input this:

It provides information for a user and repository named "tweakmsg", so I suppose it is a stock response? 

When I try finding the repositories for my user on my Atlassian bitbucket account, it gives an error:{my user id}

{"type": "error", "error": {"message": "Repository users/{543f3bdf-9cc8-481b-8468-9021a69824d4} not found"}}


1 answer

0 votes
Warren Community Leader Sep 06, 2019

Hi @KMok 

From the answer by Blizzard in this, using

gives me all the repositories that I'm a member of.

Hope this helps


Good news is I made progress and the first link is the weblink that is useful as a reference for my purposes:

1.  Using my own user account as a test and trying to access repos:

The result is empty! I tried all the options (from contributor, owner, admin) Even tho I am listed as an owner to one repository.

2. I was able to access initial information using the team UUID. 

Then am trying to use the teams/<uuid>/repositories, but based on the documentation it only returns empty: 

{“pagelen”: 10, “values”: [], “page”: 1, “size”: 0}

I supposedly have admin access to this team. 

Warren Community Leader Sep 06, 2019

Hi @KMok 

How are you calling the API? cURL? Postman? Java? C#? Other?

You need to be authenticating with your Bitbucket username and an API token associated with that username - are you doing this? It may be useful to show the full call that you're sending off, with the token anonymised.

If you don't pass in authorisation, or the authorisation fails, then it will return all the public repositories, of which tweakmsg is the first one.



Thanks for the reply! 

Using API (Browser - Chrome). I have also used curl in the past.

I have noticed that when I go to:<uuid>/members

to check my access:

{"type": "error", "error": {"message": "Forbidden"}}

This is the output. 


2.<team uuid>/permissions/repositories

Shows a login prompt. I enter my username and pw. I cannot log in with my account (loops to ask for login again). Once again, I supposedly have admin access to the team, but also, it seems I am unable to log in to view this. 

Does there need to be a separate permission granted for users to use

Ok, I'll authenticate using curl, and let you know! :) 

Hi, I have access to a token which is 32 characters long. Is the same length as an expected API token to curl? Thanks!

After trying a few things, creating the App Password works for me.

Thanks, I was able to successfully find:<team uuid>/permissions/repositories

I tried looking at the repositories to get the repo count:<team uuid>/repositories

{"pagelen": 10, "values": [], "page": 1, "size": 0}

 which shouldn't be the case. Appreciate your help! <-- Even after reading this, I would assume we can view the repositories. But the default value is an 'error' even in the documentation. Can someone please confirm that this endpoint is in use? Thanks!

^ The above means that `All repositories owned by a user/team. This includes private repositories, but filtered down to the ones that the calling user has access to.` is deprecated...

Any help with viewing repositories without having to make access public? 

@Warren Hi! Wondering if I can view repositories without making access public. Since it looks like private repositories cannot be viewed as shown the deprecated link above. I am looking for a way to count the number of repositories and can filter the repo based on number of links. Thanks!

Warren Community Leader Sep 10, 2019

Hi @KMok 

I was struggling to follow all the info that you've given here, but I can say that all our repositories are Private and I can view them via the API, so you don't need to make them all public to see them. The user whose details are used for the API call will need access rights to view those repositories.

You may want to post your question on the Developer Community site as well, to increase your chances of getting help

Hi Warren, 

Thank you for the reply. Unfortunately, even though I am in the administrator group, I cannot see the projects nor repositories. 

Can you paste to me the API that you are using to be able to see the repositories? I tried using users which have admin access and also the team uuid. 

It would be ideal to be able to view the API without having to use additional credentials

Warren Community Leader Sep 11, 2019

Hi @KMok 

Reading back what you've written, I think the issue may be that you are using the browser, which isn't allowing you to authenticate. I would recommend that you try doing this via Postman (either online or download the free app) to know that your authentication is working. You can see from the screenshot below that I'm using Basic Auth and my username and API token to successfully get data returned.


Once you get to this point using Postman and know that it is working, you can then try some other route.


Thanks so much!! I'll try that! :) 

Ok, I've been able to get my results using Postman. :)  I was able to authenticate using the browser as well. This is for my own user. 


When I use the team uuid, I cannot view the repos. Any help with this, as this is my main goal :) 

Hi @Warren 

Definitely the following link works for others, but not for me:

They are using:{TeamName} 


@Warren Thank you so much!
It worked!! Using postman, and adding the parameter: `scopes=repository` worked, as that was missing in the API call!!

Warren Community Leader Sep 11, 2019

Hi @KMok 

I'm glad that you're finally able to get the results that you need. I have never used scopes=repository so I guess that mine were correctly set by default.

Thank you so much for all your help, Warren! Yes, I think you had the settings by default. 

Suggest an answer

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

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,826 views 0 7
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