Bitbucket Cloud
CodeRabbit integrates with Bitbucket Cloud to enhance code review and collaboration by:
- Automatically initiating code reviews for newly created merge requests.
- Displaying review comments and suggestions directly on merge requests.
- Enabling seamless interaction with the CodeRabbit bot for real-time feedback and assistance.
This guide will assist you in effectively integrating CodeRabbit with Bitbucket Cloud.
Configure API Token
To enable CodeRabbit to interact with your Bitbucket repositories, an API token is required. This token grants thenecessary permissions for interacting with the Bitbucket merge request and discussion APIs.
- Create a new Bitbucket account specifically for CodeRabbit and treat it as a service account.
- Name the account "CodeRabbit".
- If your Bitbucket workspace requires two-step verification, then you must also enable two-step verification on thisnew account.
- Generate an API Token to enable seamless integration between CodeRabbit and your Bitbucket repositories.
We recommend creating a new user as a service account, associating this user to the workspace you'd like to installCodeRabbit on, and providing CodeRabbit with the API token to allow access. During the installation process, CodeRabbitwill automatically configure the required webhook for seamless integration.
If you wish to change the review user, you must provide the API token for the new user who will post reviews andcomments. However, this requires manually removing the previous user from the projects and associated webhooks. Oncethis is done, you will need to reinstall the CodeRabbit app for each project.
Recommendations
- Create a dedicated user for CodeRabbit - This ensures the user is exclusively for CodeRabbit, allowing betteraccess control.
- Use "CodeRabbit" as the username - This makes the user easily recognizable for future reference.
- Use a dedicated email address - This helps in easy identification and management.
- Use the CodeRabbit logo as the profile picture - This further ensures easy recognition. You can download our logofromhere.
- Developer Access Ensure the service account user has developer access to the projects that you wish to installCodeRabbit on.
Key Points to Remember
- Code reviews will be attributed to the owner of the API token.
Generating an API token
Bitbucket provides an option to generate an API token for a new user. Follow these steps to generate the token:
- Log in using the user designated for CodeRabbit reviews. This user serves as a service account for managing reviewsand related activities.
- Go toAPI Tokens.
- ClickCreate API token with scopes.
- Enter a name easily recognizable for this API token usage and an expiration date based on your plan of using theproduct.
- On next step selectBitbucket
- Ensure the following scopes are selected:
- read:account
- read:user:bitbucket
- write:issue:bitbucket
- read:issue:bitbucket
- read:workspace:bitbucket
- admin:project:bitbucket
- write:webhook:bitbucket
- read:webhook:bitbucket
- read:pipeline:bitbucket
- read:runner:bitbucket
- read:repository:bitbucket
- write:repository:bitbucket
- read:pullrequest:bitbucket
- write:pullrequest:bitbucket
- ClickCreate
- Note down the API token as it will only be displayed once.
Where to Provide CodeRabbit the API Token
By default, if no API token is provided, CodeRabbit will prompt you to provide one during the installation process.However, if you wish to provide the token beforehand, you can do so by navigating to theOrganization Settings tab,and selecting theBitbucket User tab on the sidebar. Once entering the API token, the token will be validated andsaved for future use.
You can confirm the correct user is being selected by verifying the user ID shown on the UI with the user ID of theservice account user you created.
Installing CodeRabbit into your Bitbucket Repositories
- Go to theRepositories page in the CodeRabbit app.
- Select the checkbox next to the repositories where you want to install CodeRabbit. To install it on all repositoriesat once, select the checkbox at the top.
- SelectInstall Repositories.

The webhookhttps://coderabbit.ai/bitbucketHandler will now be installed for the projects selected.

Troubleshooting
If you are experiencing issues with the webhook, such as CodeRabbit not being able to access the repository, or notreviewing pull requests, you can manually delete the webhook to the repository.
Then refresh the repository page in the CodeRabbit app and you can reinstall the webhook.
If you cannot install the webhook please check that your Bitbucket user has the necessary permissions to install thewebhook and the API Token is properly configured.