Bitbucket RepositoryService: findAll method doesn't return all repositories?



Replicating a community question:

I need to receive all repositories from Bitbucket. In order to do this I am using the RepositoryService which has a method called “findAll”. It’s described as follows:
“Find all repositories in the system.”
You can find said RepositoryService with the findAll method here.

Unfortunately this method doesn’t seem to return all repositories. It returns fewer repositories than my file system contains. If I use different endpoints to get all project repositories and all user repositories there are still fewer repositories than in the file system. All repositories on the file system are accessible but somehow aren’t found by the API, despite being found by the database and the file system.

Do any of you know which repositories findAll ignores? Is there a way to get every single repository?

Thank you in advance,

shady boy


Try to finding repos inside a security context like to

securityService.withPermission(REPO_READ, "Find repos").call(() -> {


We tried using the paging as you suggested but it didn’t work. We are still trying to receive all the repositories, project and personal. The user we use to access the repositories is a SYS Admin user, so he should have access to every repository. As we understood it, there is no way to do that with the Java API, is that correct?


Hi @yorlov, @iragudo
Any response to this ?


Repository ID’s seem to be just incrementing integers. Maybe just call RepositoryService.findById(integer) and start counting from 1! Ignore small gaps of nulls since that typically represents repositories that once existed but have since been deleted.

(But I would consider a run of 1000-in-a-row that return null to mean you reached the end).

I suspect this will give you all project repos as well as all personal repos (including personal forks).

No guarantee that Bitbucket keeps the ID’s as incrementing integers though. Maybe one day they’ll start randomizing it. But as of today I believe it’s still an increment from 1.