> ## Documentation Index
> Fetch the complete documentation index at: https://docs.refacto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Bitbucket Cloud

> Connect Refacto to your Bitbucket Cloud repositories.

Follow these steps to connect Refacto to your Bitbucket Cloud workspace.

<Steps>
  <Step title="Invite the Refacto Bot" icon="user">
    Invite the **Refacto Bot User** to your Bitbucket workspace to allow secure access to repositories during pull request reviews.

    * The bot requires **read access** to temporarily clone repositories for analysis.
    * Since **Bitbucket App Passwords are deprecated from September 2025**, Refacto uses an **SSH-based authentication mechanism**.
    * Add the bot to your workspace using the provided email and grant it read permissions for all repositories (recommended) or only those you want Refacto to review.

    **Bot Email:** `security@refacto.ai`
  </Step>

  <Step title="Create an API Token" icon="key">
    You need to create a **Bitbucket API token** with appropriate permissions.

    ⚠️ You must have **Administrator access** to the Bitbucket Cloud workspace to create webhooks at the workspace level.

    1. Log in to **Bitbucket Cloud** and navigate to\
       **Settings → Atlassian Account Settings → Security**,\
       or open [https://id.atlassian.com/manage-profile/security/api-tokens](https://id.atlassian.com/manage-profile/security/api-tokens)

           <img src="https://mintcdn.com/devdynamics/efRIRd6AXS02AyKu/images/installation/bitbucket_cloud/bitbucket-security.png?fit=max&auto=format&n=efRIRd6AXS02AyKu&q=85&s=2727434a63e3e2c97c25c9b36d1cd85f" alt="Bitbucket Security Page" width="2880" height="1800" data-path="images/installation/bitbucket_cloud/bitbucket-security.png" />
    2. Click **Create API token with scopes**.
    3. Give it a name (e.g., **Refacto Integration**) and set an expiry (recommended **360 days**).

           <img src="https://mintcdn.com/devdynamics/efRIRd6AXS02AyKu/images/installation/bitbucket_cloud/bitbucket-token-name-expiry.png?fit=max&auto=format&n=efRIRd6AXS02AyKu&q=85&s=1962145d3212f501e10d9e4cf8da7ca3" alt="Bitbucket Name And Expiry" width="2880" height="1800" data-path="images/installation/bitbucket_cloud/bitbucket-token-name-expiry.png" />
    4. Under **Select the app**, choose **Bitbucket**.

           <img src="https://mintcdn.com/devdynamics/efRIRd6AXS02AyKu/images/installation/bitbucket_cloud/bitbucket-app-select.png?fit=max&auto=format&n=efRIRd6AXS02AyKu&q=85&s=dd69eac181e2867dc3a62ec7506126a5" alt="Bitbucket App Select" width="1416" height="1798" data-path="images/installation/bitbucket_cloud/bitbucket-app-select.png" />
    5. Under **Select Bitbucket scopes**, check the following scopes:

       * **read:user:bitbucket**, **read:account**
       * **read:webhook:bitbucket**, **write:webhook:bitbucket**, **delete:webhook:bitbucket**
       * **read:workspace:bitbucket**, **read:project:bitbucket**, **read:repository:bitbucket**
       * **read:pullrequest:bitbucket**
       * **read:issue:bitbucket**

           <img src="https://mintcdn.com/devdynamics/efRIRd6AXS02AyKu/images/installation/bitbucket_cloud/bitbucket-token-permissions.png?fit=max&auto=format&n=efRIRd6AXS02AyKu&q=85&s=321d9af342e6c81f3469309330301d09" alt="Bitbucket Token Permissions" width="2880" height="1800" data-path="images/installation/bitbucket_cloud/bitbucket-token-permissions.png" />
    6. Under **Review your API token**, verify details and click **Create Token**.

           <img src="https://mintcdn.com/devdynamics/efRIRd6AXS02AyKu/images/installation/bitbucket_cloud/bitbucket-review-permissions.png?fit=max&auto=format&n=efRIRd6AXS02AyKu&q=85&s=caf86df9f919e978b259e13c412099f6" alt="Bitbucket Token Permissions" width="2880" height="1800" data-path="images/installation/bitbucket_cloud/bitbucket-review-permissions.png" />

    <Note>
      Copy and save the token — it’s shown only once.
    </Note>
  </Step>

  <Step title="Fill in the Setup Form" icon="check">
    On the Bitbucket Cloud setup page in Refacto, provide the following:

    * **Workspace Slug** – The workspace identifier in your Bitbucket URL.\
      Example:

      > [https://bitbucket.org/bluetowers](https://bitbucket.org/bluetowers) → workspace slug is **bluetowers**
    * **API Token Owner’s Email** – The email of the user who created the token.
    * **API Token** – The token you generated above.

    Click **Save & Sync Repos** when done.
  </Step>

  <Step title="Go to Integrations" icon="window">
    * Navigate to the **Integrations** page in your Refacto dashboard.
    * Click **Connect** on **Bitbucket Cloud**.

          <img src="https://mintcdn.com/devdynamics/efRIRd6AXS02AyKu/images/installation/bitbucket_cloud/bitbucket-integration-connect.png?fit=max&auto=format&n=efRIRd6AXS02AyKu&q=85&s=6ea79908a2a6efa84e5aba4b559ee731" alt="Bitbucket Integration Page" width="2880" height="1800" data-path="images/installation/bitbucket_cloud/bitbucket-integration-connect.png" />
  </Step>

  <Step title="Open Bitbucket Setup Form" icon="clipboard-list">
    * After clicking **Connect**, you’ll be redirected to the **Bitbucket Cloud setup form** in Refacto.
    * This form requires three fields: **Workspace Slug**, **API Token Owner’s Email**, and **API Token**.
    * To get these values, please follow the next steps:

      * Create an **API Token**
      * Invite the **Refacto Bot User**

          <img src="https://mintcdn.com/devdynamics/AEdIsxYZmFmBoNYW/images/installation/bitbucket_cloud/bitbucket-initial-form2.png?fit=max&auto=format&n=AEdIsxYZmFmBoNYW&q=85&s=80c60b38b64d9ca07d57a8833ac5924b" alt="Bitbucket Setup Form" width="2880" height="1800" data-path="images/installation/bitbucket_cloud/bitbucket-initial-form2.png" />
  </Step>

  <Step title="Done" icon="party-horn">
    Your Bitbucket Cloud integration is now active.
  </Step>
</Steps>
