> 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-community-build/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/introduction.md).

# Introduction to Bitbucket Cloud integration

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

## Key features

With this integration, you’ll be able to:

* **Import your Bitbucket Cloud repositories**: Import your Bitbucket Cloud repositories into SonarQube Community Build to easily set up SonarQube Community Build projects.
* **Analyze projects with Bitbucket Pipelines**: Integrate analysis into your build pipeline and fail your pipeline if the quality gate fails.
* **Authenticate with Bitbucket Cloud**: Sign in to SonarQube Community Build with your Bitbucket Cloud credentials.

{% hint style="info" %}
SonarQube Community Build doesn’t support various features such as the analysis of multiple branches and pull requests. See [Feature comparison table](/sonarqube-community-build/feature-comparison-table.md) to learn which Bitbucket Cloud integration features are supported by the other SonarQube deployments.
{% endhint %}

## Integration solution overview

Integration is performed at two levels:

* Global: Within your SonarQube Community Build instance, a “Bitbucket Cloud Configuration” record is used to manage the SonarQube Community Build 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 Community Build to access your Bitbucket Cloud workspace.
* Project: A project administrator must provide a Bitbucket Cloud API token to import their Bitbucket Cloud repository to SonarQube Community Build. SonarQube stores this PAT in its database, enabling it to list and import the repositories the administrator can access.

The following diagram shows how SonarQube Community Build uses the API token and the OAuth client to import Bitbucket Cloud repositories.

```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 Community Build"]
        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
    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-community-build/instance-administration/authentication/bitbucket-cloud.md).

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

* [Setting up Bitbucket Cloud integration at global level](/sonarqube-community-build/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/global.md)\
  This section explains how to set up the integration of your SonarQube Community Build instance with Bitbucket Cloud. You need the global Administer System permission in SonarQube to perform this setup.
* [Importing Bitbucket Cloud repositories](/sonarqube-community-build/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/import-repos.md)\
  Once the integration of your SonarQube Community Build 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 Community Build.
* [Adding analysis to Bitbucket pipeline](/sonarqube-community-build/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/bitbucket-pipelines.md)\
  Once you have created your project(s) in SonarQube Community Build, you can add the SonarQube Community Build 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-community-build/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/introduction.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.
