Get repository list within project by using API

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

Summary

When retrieving a repository list for a workspace using the Bitbucket Cloud API the system will return all repositories within that workspace, regardless of project. This page's objective is to provide a way of listing repositories within a given project key using Bitbucket Cloud's API.

Environment

Bitbucket Cloud

Solution

When using the List repositories in a workspace endpoint it's possible to add a filter at the end of the API call so that it returns only repositories from that specific project:

curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspaceID}?q=project.key%3D%22{ProjectKey}%22' \ --user <atlassian_account_email>:<api_token>

The following variables need to be changed to match your environment:

  • {workspaceID}: will be the ID of the workspace you're getting the repository list from, please refer to workspace settings to get workspace ID;

  • {ProjectKey}: The project Key can be found in your workspace project settings.

  • <atlassian_account_email>:<api_token>: The authentication can be done via your Atlassian account email and an API token (as the example above shows) that has at least the scope of read:repository:bitbucket, with a workspace or project access token, or using OAuth.

    ℹ️ Keep in mind that when using OAuth, the scope necessary for this operation would be repository level.

Example:

Let's say the workspace ID is bcloud, project key is TF, the query would look like this,

curl -u <atlassian_account_email>:<api_token> --request GET --url "https://api.bitbucket.org/2.0/repositories/bcloud?q=project.key%3D%22TF%22"

To get the list of all the repositories in a workspace, please refer to Display a list of active repositories.

Updated on September 3, 2025

Still need help?

The Atlassian Community is here for you.