> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-server/discovering/devops-platforms/bitbucket-cloud.md).

# Bitbucket Cloud

Introduction to SonarQube Server 2026.5 integration with Bitbucket Cloud.

SonarQube’s integration with Bitbucket Cloud allows you to maintain code quality and security in your Bitbucket Cloud repositories.

{% hint style="success" %}
To bind your SonarQube Server instance to Bitbucket Cloud, see [Binding to Bitbucket Cloud](/sonarqube-server/instance-administration/devops-platforms/bitbucket-cloud.md).
{% endhint %}

## Key features

With this integration, you’ll be able to:

* Import your Bitbucket Cloud repositories: Import your Bitbucket Cloud repositories into SonarQube Server to easily set up SonarQube Server projects.
* Analyze projects with Bitbucket Pipelines: Integrate analysis into your build pipeline. SonarScanners running in Bitbucket Pipelines can automatically detect branches or pull requests being built so you don’t need to specifically pass them as parameters to the scanner.
* Report your quality gate status to your pull requests: See your quality gate and code metric results right in Bitbucket Cloud so you know if it’s safe to merge your changes.
* Authenticate with Bitbucket Cloud: Sign in to SonarQube Server with your Bitbucket Cloud credentials.

## Integration solution overview

Integration is performed at two levels:

* Global: Within your SonarQube Server instance, a “Bitbucket Cloud Configuration” record is used to manage the SonarQube Server access to your Bitbucket Cloud workspace. This record stores:
  * Your workspace ID.
  * The client ID and secret of a workspace’s OAuth client which is used by SonarQube Server to access your Bitbucket Cloud workspace, either to report the quality gate to pull requests on the repositories you’re analyzing or to import repositories.
* Project: A project administrator must provide a Bitbucket Cloud API token to import their Bitbucket Cloud repository to SonarQube Server or to bind a project to a repository. SonarQube stores this PAT in its database, enabling it to list and import the repositories the administrator can access. For binding, see [Changing your project binding](/sonarqube-server/project-administration/maintaining-project/changing-project-binding.md#binding-an-unbound-project).

The following diagram shows how SonarQube Server uses the API token and the OAuth client to import Bitbucket Cloud repositories and report the quality gate status to pull requests.

```mermaid
%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#F1F6FC', 'primaryBorderColor': '#126ED3', 'primaryTextColor': '#0A0A0A', 'lineColor': '#126ED3', 'secondaryColor': '#F4F6F8', 'tertiaryColor': '#F4F6F8', 'clusterBkg': '#F4F6F8', 'clusterBorder': '#D4D4D4', 'edgeLabelBackground': '#FFFFFF'}}}%%
flowchart LR
    BBAdmin(["Project administrator<br><i>API token</i>"])
    OAuthClient["OAuth client<br><i>Client ID and secret</i>"]

    subgraph BB["Bitbucket Cloud workspace"]
        Repo["Repository"]
    end

    subgraph SQ["SonarQube Server"]
        Project["Project"]
        Config["Bitbucket Cloud configuration"]
    end

    SQAdmin(["Project administrator"])
    SysAdmin(["System administrator"])

    BBAdmin --> BB
    OAuthClient --> BB
    Repo ==>|"<b>Import a repository</b><br><i>API token, and the OAuth client's client ID and secret</i>"| Project
    SQ ==>|"<b>Report quality gate to pull request</b><br><i>OAuth client's client ID and secret</i>"| BB
    Project -.-|"<i>API token</i>"| SQAdmin
    Config -.-|"<i>OAuth client's client ID and secret</i>"| SysAdmin

    style BB fill:#F4F6F8,stroke:#D4D4D4,color:#0A0A0A
    style SQ fill:#F1F6FC,stroke:#126ED3,color:#0A0A0A

    classDef neutral fill:#FFFFFF,stroke:#D4D4D4,color:#0A0A0A
    classDef subject fill:#FFFFFF,stroke:#126ED3,color:#0A0A0A
    class BBAdmin,OAuthClient,SQAdmin,SysAdmin,Config neutral
    class Repo,Project subject
```

For information about Bitbucket Cloud authentication solution, see [Bitbucket Cloud](/sonarqube-server/instance-administration/authentication/bitbucket-cloud.md).

## Related pages <a href="#related-pages" id="related-pages"></a>

* [Binding to Bitbucket Cloud](/sonarqube-server/instance-administration/devops-platforms/bitbucket-cloud.md)\
  This section explains how to set up the integration of your SonarQube Server instance with Bitbucket Cloud. You need the global Administer System permission in SonarQube to perform this setup.
* [Importing your Bitbucket Cloud repository](/sonarqube-server/project-administration/creating-project/bitbucket-cloud/import-repos.md)\
  Once the integration of your SonarQube Server instance with Bitbucket Cloud has been properly set up, you can import a Bitbucket Cloud repository or monorepo to create the corresponding projects in SonarQube Server.
* [Configuring Bitbucket Cloud project binding](/sonarqube-server/project-administration/creating-project/bitbucket-cloud/configure-binding.md)\
  This page explains how to set up pull request decoration and the blocking of pull requests in case of quality gate failure. You need the Administer permission on the project to perform this setup.
* [Bitbucket Pipelines](/sonarqube-server/analyzing-source-code/ci-integration/bitbucket-pipelines.md)\
  Once you have created your project(s) in SonarQube Server, you can add the SonarQube Server analysis to your Bitbucket pipeline.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sonarsource.com/sonarqube-server/discovering/devops-platforms/bitbucket-cloud.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
