# Bitbucket
URL: https://docs.clearly-ai.com/docs/integrations/code/bitbucket
Description: Connect Clearly AI to Bitbucket.
## Overview [#overview]

Connect Bitbucket to Clearly AI so Clearly AI can use your repositories as project context and review the code in those repositories.

The Bitbucket integration uses **Shared API Token** authentication: a Bitbucket personal access token.

For background on authentication choices across integrations, see [Integrations](https://docs.clearly-ai.com/docs/integrations).

## Instructions [#instructions]

### Prerequisites [#prerequisites]

* Access to **Integrations** in **Organization settings**
* A Bitbucket account that can access the repositories you want Clearly AI to review
* The Bitbucket workspace Clearly AI should use for repository operations
* A Bitbucket personal access token with access to the repositories Clearly AI should read

<Steps>
  <Step>
    ### Open the Bitbucket integration [#open-the-bitbucket-integration]

    In Clearly AI, open **Organization settings**, select **Integrations**, then click **Set up** on the Bitbucket card.
  </Step>

  <Step>
    ### Enter the workspace [#enter-the-workspace]

    In **Workspace**, enter the default Bitbucket workspace Clearly AI should use for repository operations.
  </Step>

  <Step>
    ### Enter your token [#enter-your-token]

    Under **Authentication**, in **Shared API Token**, paste your Bitbucket personal access token.
  </Step>

  <Step>
    ### Add the credential [#add-the-credential]

    Check **I understand** under the shared-credential notice, then click **Add workspace credential**. Clearly AI tests the credential and enables the integration only when the test passes. Projects can then add Bitbucket repositories as sources. The repositories Clearly AI can review depend on the access granted to your token.
  </Step>
</Steps>

## FAQs [#faqs]

<Accordions>
  <Accordion title="Why does Add workspace credential fail?">
    Confirm the personal access token is still active and has access to the repositories Clearly AI needs to read.
  </Accordion>

  <Accordion title="Why do the wrong repositories appear after the connection succeeds?">
    Confirm the **Workspace** value matches the Bitbucket workspace you want Clearly AI to use.
  </Accordion>

  <Accordion title="Why are some repositories missing?">
    Confirm the Bitbucket account tied to the token can access those repositories.
  </Accordion>
</Accordions>

## Related [#related]

* [Integrations](https://docs.clearly-ai.com/docs/integrations) - Choose an authentication method for an integration
* [GitHub](https://docs.clearly-ai.com/docs/integrations/code/github) - Connect Clearly AI to GitHub using a Shared API Token or OAuth 2.0
* [Concepts](https://docs.clearly-ai.com/docs/concepts) - Learn how integrations provide project context in Clearly AI