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

# Bitbucket

> Comprehensive Guide to Configuring Bitbucket with Corgea

The Bitbucket integration with Corgea enables you to scan projects and create pull requests for code fixes directly from the Corgea platform.

<Steps>
  <Step title="Create a Dedicated User for Corgea (Optional)">
    While not required, we recommend creating a dedicated Bitbucket user account for Corgea integration. This helps distinguish Corgea's automated actions from your personal account activity and provides better auditability.

    <Frame>
      <img src="https://mintcdn.com/corgea/1YT68j9GOThy2yLb/images/bitbucket_user.png?fit=max&auto=format&n=1YT68j9GOThy2yLb&q=85&s=e6294580d18378439c15ea8cc252d23a" style={{ borderRadius: '0.5rem' }} alt="Create Bitbucket User" width="1916" height="864" data-path="images/bitbucket_user.png" />
    </Frame>
  </Step>

  <Step title="Generate an API Access Token">
    Navigate to the <a href="https://id.atlassian.com/manage-profile/security/api-tokens" target="_blank">Atlassian API Tokens page</a> and click "Create API token with scopes" to begin.

    <Warning>
      **API tokens are not the same as workspace tokens.** API tokens are associated with your Atlassian user account. You can generate and manage your personal API tokens from the link provided above.
    </Warning>

    <Frame>
      <img src="https://mintcdn.com/corgea/1YT68j9GOThy2yLb/images/bitbucket_create_access_token.png?fit=max&auto=format&n=1YT68j9GOThy2yLb&q=85&s=d2c2690dcd87c35b1651ece83f037c9f" style={{ borderRadius: '0.5rem' }} alt="Create API Token" width="904" height="333" data-path="images/bitbucket_create_access_token.png" />
    </Frame>

    Provide a descriptive name for your token and set the expiration date to one year from today. This ensures the token remains valid for an extended period while maintaining security best practices.

    <Frame>
      <img src="https://mintcdn.com/corgea/1YT68j9GOThy2yLb/images/bitbucket_token_name.png?fit=max&auto=format&n=1YT68j9GOThy2yLb&q=85&s=86506d715f1fbf86a5ef1ca858b4acc2" style={{ borderRadius: '0.5rem' }} alt="Token Name and Expiration" width="813" height="839" data-path="images/bitbucket_token_name.png" />
    </Frame>

    Select **Bitbucket** from the applications list to grant Bitbucket access to this token.

    <Frame>
      <img src="https://mintcdn.com/corgea/1YT68j9GOThy2yLb/images/bitbucket_app_selection.png?fit=max&auto=format&n=1YT68j9GOThy2yLb&q=85&s=eed318e49348eea6d137a651c8b8238f" style={{ borderRadius: '0.5rem' }} alt="Select Bitbucket App" width="789" height="673" data-path="images/bitbucket_app_selection.png" />
    </Frame>

    Configure the required scopes for Corgea integration. Enable the following scopes:

    <div class="alert alert-info" role="alert">
      <strong>Required Scopes:</strong>

      <ul class="mb-0 mt-2">
        <li><code>Repositories: "read:repository:bitbucket", "write:repository:bitbucket"</code></li>
        <li><code>Pull requests: "read:pullrequest:bitbucket", "write:pullrequest:bitbucket"</code></li>
        <li><code>Webhooks: "read:webhook:bitbucket", "write:webhook:bitbucket", "delete:webhook:bitbucket"</code></li>
        <li><code>General Info: "read:user:bitbucket", "read:workspace:bitbucket"</code></li>
      </ul>
    </div>

    <Frame>
      <img src="https://mintcdn.com/corgea/1YT68j9GOThy2yLb/images/bitbucket_token_scopes.png?fit=max&auto=format&n=1YT68j9GOThy2yLb&q=85&s=c91333a78a6849ae68c22f5e412356c5" style={{ borderRadius: '0.5rem' }} alt="Token Scopes" width="1022" height="787" data-path="images/bitbucket_token_scopes.png" />
    </Frame>

    Review your configuration and click "Create token" to generate the access token.

    <Frame>
      <img src="https://mintcdn.com/corgea/1YT68j9GOThy2yLb/images/bitbucket_create_token.png?fit=max&auto=format&n=1YT68j9GOThy2yLb&q=85&s=391d9ebffbe9a06bbdcc1da964bbc0df" style={{ borderRadius: '0.5rem' }} alt="Create Token" width="781" height="866" data-path="images/bitbucket_create_token.png" />
    </Frame>

    After the token is created, click the copy button to copy the token value. You'll need this token in the next step, and it won't be displayed again.

    <Frame>
      <img src="https://mintcdn.com/corgea/1YT68j9GOThy2yLb/images/bitbucket_copy_token.png?fit=max&auto=format&n=1YT68j9GOThy2yLb&q=85&s=56a741f0624cf8e64937ab63911f2fc3" style={{ borderRadius: '0.5rem' }} alt="Copy Token" width="691" height="798" data-path="images/bitbucket_copy_token.png" />
    </Frame>
  </Step>

  <Step title="Configure Bitbucket Integration in Corgea">
    Access your Corgea dashboard at `corgea.app` or `{your-instance}.corgea.app` and navigate to the Integrations page using the sidebar or integrations link.

    <Frame>
      <img src="https://mintcdn.com/corgea/1YT68j9GOThy2yLb/images/bitbucket_integration_page.png?fit=max&auto=format&n=1YT68j9GOThy2yLb&q=85&s=bf73904b1aca7582ef3bb21b875a5df5" style={{ borderRadius: '0.5rem' }} alt="Corgea Integrations Page" width="1897" height="840" data-path="images/bitbucket_integration_page.png" />
    </Frame>

    In the "Code Repository Integrations" section, locate Bitbucket and click the plus (+) icon to create a new integration.

    <Frame>
      <img src="https://mintcdn.com/corgea/1YT68j9GOThy2yLb/images/bitbucket_new_integration.png?fit=max&auto=format&n=1YT68j9GOThy2yLb&q=85&s=2540b183bd20606f310c7e707db71b67" style={{ borderRadius: '0.5rem' }} alt="New Integration" width="1675" height="457" data-path="images/bitbucket_new_integration.png" />
    </Frame>

    Complete the integration form with the following information:

    * **Workspace slug**: Your Bitbucket workspace identifier
    * **Email address**: The email associated with the Bitbucket account used to generate the API token
    * **Access token**: The API token you copied in the previous step
    * **Integration name** (optional): A custom name to identify this integration if you manage multiple Bitbucket workspaces

    <Frame>
      <img src="https://mintcdn.com/corgea/1YT68j9GOThy2yLb/images/bitbucket_create_modal.png?fit=max&auto=format&n=1YT68j9GOThy2yLb&q=85&s=3c61d1f0340dddd0bd12f89eede8f529" style={{ borderRadius: '0.5rem' }} alt="Create Integration Modal" width="835" height="701" data-path="images/bitbucket_create_modal.png" />
    </Frame>

    Corgea validates your credentials automatically. If any information is incorrect, you'll receive an error message with details about what needs to be corrected.

    <Frame>
      <img src="https://mintcdn.com/corgea/1YT68j9GOThy2yLb/images/bitbucket_modal_validation.png?fit=max&auto=format&n=1YT68j9GOThy2yLb&q=85&s=a895ec1f7b3e0ccb9cfe3e0940e19bed" style={{ borderRadius: '0.5rem' }} alt="Validation" width="910" height="720" data-path="images/bitbucket_modal_validation.png" />
    </Frame>

    Upon successful validation, you'll see a confirmation message indicating that the integration is complete. Webhooks are automatically configured during this process, so no manual webhook setup is required. You can view the integration details, including webhook status, from the integrations page.

    <Frame>
      <img src="https://mintcdn.com/corgea/1YT68j9GOThy2yLb/images/bitbucket_success_message.png?fit=max&auto=format&n=1YT68j9GOThy2yLb&q=85&s=bb62edb596c23ba63a62942e39112b4f" style={{ borderRadius: '0.5rem' }} alt="Success Message" width="1700" height="629" data-path="images/bitbucket_success_message.png" />
    </Frame>
  </Step>
</Steps>
