Find repository ID for Bitbucket mirror synchronized from the upstream server

Platform Notice: Data Center Only - This article only applies to Atlassian apps on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Learn how to retrieve the Bitbucket repository ID for a mirror that has been synchronized from the upstream server.

The repository ID on the upstream (primary Bitbucket instance) and the repository ID on the mirror can and often do differ.

Each instance (upstream and mirror) assigns its own unique repository ID to the same repository. On the mirror, the repository ID used locally is different from the upstream's repository ID, which is referred to as the externalRepositoryId in mirror logs and configuration files.

RepoID is needed to navigate to the repository location on the file system for the Mirror. Currently, there is no easy way to identify the Repository ID for the repository on the mirror.

Product Version

Bitbucket 9.x and Bitbucket 8.6+

Solution

Use REST API to retrieve the repository ID

We can use one of the following REST API endpoints to retrieve the repository sync status. In the output of the API includes localRepoId value corresponding to your repository’s slug, this value represents the repository ID on the mirror. This ID can be used to locate the repository directory on the mirror server.

Please note:

  • With Bitbucket 9, we can supply the repository slug individually to get the sync status for a specific repository.

  • In Bitbucket 8.6+, the REST API is more generic and will return the sync status for all mirrored repositories.

Example

GET https://<mirror base url>:8443/rest/mirroring/latest/supportInfo/projects/TEST/repos/test/repoSyncStatus { "externalRepoId": "1", "failedSyncCount": 0, "hashes": { "content": "1e30308be56ad75739acfef71dbe7a6c3947a466c13fa5c580bd4bf3f8912eb1", "metadata": "268f78c1b8ba08f651f9bbb4ba415455ca2333bce1d5320d34b7c82fcf4cfee1" }, "initialSyncDate": 1743484938726, "lastSyncDate": 1750824365095, "localRepoId": 4, "localProjectId": 1, "upstreamId": "b1ef3c77-f9a5-3ecc-8fb8-ec5081e97d22" }

The output shows ExternalRepoID as 1, which corresponds to RepoID on the Upstream Bitbucket server and localRepoId as 4 which corresponds to RepoID on the mirror server.

Updated on October 31, 2025

Still need help?

The Atlassian Community is here for you.