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

# Set up Bitbucket

> Connect Bitbucket to your Upsun Dispatch organization so Upsun Dispatch can review Bitbucket pull requests and open pull requests from Issue to code.

Connect Bitbucket as a version control system integration so Upsun Dispatch can connect Bitbucket repositories and run the built-in [Code review](https://developer.upsun.com/dispatch/docs/workflows/code-review.md) workflow on Bitbucket pull requests.

With a repository push token, [Issue to code](https://developer.upsun.com/dispatch/docs/workflows/issue-to-code.md) can also push branches and open Bitbucket pull requests. Without a push token, Issue to code stops at the start, before planning, and asks for one. Code review can still run with only a read token.

## Connect Bitbucket

**1. Open Bitbucket integration settings**

In the Upsun Dispatch console, open your organization settings, go to **Integrations**, and choose **Bitbucket**.

**2. Install the app in Bitbucket**

A Bitbucket workspace admin installs the Upsun Dispatch app from Bitbucket by selecting **Install app**.

**3. Connect the Bitbucket workspace**

A Bitbucket workspace owner connects the Bitbucket workspace to your Upsun Dispatch organization by entering its workspace ID. Bitbucket asks the owner to sign in only to verify ownership.

**4. Connect repository with read access**

Select **Connect repository** and provide a repository access token with the **Repositories: Read** scope. This is enough for Code review.

**5. Optional: add a push token**

Add a repository push token with the **Repositories: Write** scope so Issue to code can push branches and open Bitbucket pull requests. Without this token, Issue to code stops at the start, before planning, and asks for one.

After the repository is connected, Upsun Dispatch can receive supported Bitbucket repository activity and use that repository for workflow runs.

## Review Bitbucket pull requests

When Bitbucket is connected, Upsun Dispatch can run Code review on Bitbucket pull requests.

Code review can start in two ways:

* **Automatic reviews** start from supported Bitbucket pull request activity when Code review trigger mode is automatic.
* **Manual reviews** start from whole-message comments on a Bitbucket pull request, such as `@upsun-dispatch review`, `@upsun-dispatch full review`, or `@upsun-dispatch cancel`.

Keep manual commands as the entire comment body. Extra text in the same comment is treated as an ordinary comment instead of a Code review request.

For full review behavior, including trigger settings, full versus incremental reviews, summaries, and review limits, see [Code review](https://developer.upsun.com/dispatch/docs/workflows/code-review.md).

## Use Issue to code with Bitbucket

Bitbucket is a version control system integration. It is independent from ticketing integrations, so your organization can use Bitbucket for pull request review while using a separate ticketing integration to start Issue to code.

Issue to code can open Bitbucket pull requests when the repository has a push token with the **Repositories: Write** scope. If a repository has no push token, Issue to code stops at the start, before planning, and asks for one instead of publishing changes to that Bitbucket repository.

For Issue to code behavior, see [Issue to code](https://developer.upsun.com/dispatch/docs/workflows/issue-to-code.md).

## Manage the Bitbucket connection

Return to **Settings > Integrations > Bitbucket** to view the Bitbucket connection, connect additional Bitbucket repositories, and add repository tokens when needed.

For the broader integrations list, see [Integration overview](https://developer.upsun.com/dispatch/docs/integrations.md).

## Troubleshooting

### Bitbucket does not appear in integrations

Open **Settings > Integrations** for the organization where you want to connect the repository. If Bitbucket is still not available there, confirm that you are using the intended Upsun Dispatch organization.

### A pull request comment does not start a review

Check that the comment is on a Bitbucket pull request and that the entire comment body is a supported command, such as `@upsun-dispatch review`. Comments with additional text do not start Code review.

### Issue to code asks for a push token

Add a repository push token with the **Repositories: Write** scope for the Bitbucket repository. Issue to code needs this token before planning so it can push branches and open pull requests.

### Review results are not visible

Confirm that the Bitbucket repository is connected and that Code review is enabled for the repository or organization settings you expect. For workflow settings, see [Workflows in Upsun Dispatch](https://developer.upsun.com/dispatch/docs/workflows.md#workflow-settings).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.