Get repository list within project by using API

Platform Notice: Cloud Only - This article only applies to Atlassian products 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:

1 2 3 curl --request GET \ --url 'https://api.bitbucket.org/2.0/repositories/{workspaceID}?q=project.key%3D%22{ProjectKey}%22' \ --user {username}:{AppPassword}

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

  • workspaceID: will be 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.

  • username/AppPassword: The authentication can be done via username and app password (as the example above shows), 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,

1 curl -u <username>:<apppassword> --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 April 2, 2025

Still need help?

The Atlassian Community is here for you.