> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/pr-and-release-gating/bitbucket-pr-gating/bitbucket-ci-pr-gating-via-aikido-dashboard-with-a-workspace-access-token.md).

# Bitbucket Premium: PR Gating Setup

Configure Bitbucket pull request scanning to publish scan results and comments for issues from Aikido. No pipeline code needed.

{% hint style="warning" %}
This setup is for **Bitbucket Premium**.

Use it when you want to authenticate via a **Workspace Access Token**. It also supports required checks before merge (PR gating).

If you’re on **Bitbucket Free or Standard**, use the [**user-based setup**](/pr-and-release-gating/bitbucket-pr-gating/bitbucket-ci-pr-gating-via-aikido-dashboard.md) instead.
{% endhint %}

## Set up Bitbucket PR Scanning <a href="#setting-up-bitbucket-ci" id="setting-up-bitbucket-ci"></a>

{% stepper %}
{% step %}
**Create a Workspace Access Token**

In Bitbucket, go to `Workspace settings > Access tokens`.

Select **Create access token**.

<div data-with-frame="true"><figure><img src="https://3149773201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-9e3c0f0582cc4b8750f089b7253c2561804e3e26%2FScreenshot%202026-02-27%20at%2011.50.37.png?alt=media" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Give it the right access**

Name the token (for example, `AikidoSec`). Set an expiry date that matches your rotation policy.

Enable these scopes:

* **Repositories:** Read & Write
* **Pull Requests:** Read & Write
* **Webhooks:** Read & Write
* **Pipelines:** Read & Write

<div data-with-frame="true"><figure><img src="https://3149773201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-bff3fd48b0f998b51133f9bf345639150c3b7fe6%2FScreenshot%202026-02-27%20at%2012.25.21.png?alt=media" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Copy the access token**

Copy the generated token. Paste it in step 5.

The token is only shown once. You can’t retrieve it later.

<div data-with-frame="true"><figure><img src="https://3149773201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-0de419ea6322b8f54782292fb82c622bf93bba1d%2FScreenshot%202026-02-27%20at%2012.06.22.png?alt=media" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Enable the integration**

In Aikido, open the [Integrations](https://app.aikido.dev/settings/integrations?section=ci) page. Then select **Bitbucket** under **PR Quality Gating**.

<div data-with-frame="true"><figure><img src="https://3149773201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-40075f81a6a797407276d4cf64fd9e8d4a5eb9a9%2FScreenshot%202026-02-26%20at%2016.57.41.png?alt=media" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Add the token to Aikido**

Paste the Workspace Access Token in Aikido. Aikido will validate the token and its permissions.

<div data-with-frame="true"><figure><img src="https://3149773201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-3867f5232e14ac12e26d9bd978fa7da633a02588%2FScreenshot%202026-02-27%20at%2012.07.45.png?alt=media" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Configure your first repository**

After authorization, Aikido opens the [Bitbucket PR Checks](https://app.aikido.dev/settings/integrations/bitbucket/checks) page.

Start with **one repository** first. Confirm everything works before rolling out broadly.

<div data-with-frame="true"><figure><img src="https://3149773201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-ff730017744cac5b9148a817045c11610fd86445%2FScreenshot%202026-02-26%20at%2017.02.36.png?alt=media" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Verify with a new PR**

Open a new PR in the repo you configured. Then confirm the checks run.

<div data-with-frame="true"><figure><img src="https://3149773201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-568bd026adfc6c847c8d7e1a0811434658ef04bd%2FScreenshot%202026-02-26%20at%2018.04.55.png?alt=media" alt=""><figcaption></figcaption></figure></div>

Comments and check updates should appear as the Workspace Access Token identity (for example, `AikidoSec`).

<figure><img src="https://3149773201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-6f526277eecb2d594f46f86871ab328396d00235%2FScreenshot%202026-02-26%20at%2018.09.19.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Require the scan as a Merge Check**

If you want to block merging until the scan succeeds, configure **required checks** in Bitbucket.

In Bitbucket, go to `Repository settings > Workflow > Branch restrictions`. Add or update a restriction for your target branch (for example, `main`).

Atlassian reference: [Suggest or require checks before a merge](https://support.atlassian.com/bitbucket-cloud/docs/suggest-or-require-checks-before-a-merge/).
{% endstep %}

{% step %}
**Enable for all repositories**

Once you’re happy with the results, go back to the [Bitbucket PR Checks](https://app.aikido.dev/settings/integrations/bitbucket/checks) page and enable checks for the rest of your repositories.

<div data-with-frame="true"><figure><img src="https://3149773201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-4d6f5bf3c25c48beba52c724565e081059b0d921%2FScreenshot%202026-02-26%20at%2018.13.59.png?alt=media" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Set the default for new repositories**

In the top-right, open `Actions` and select `Set Default for New Repos`.

See [Default PR/MR gating configuration for new repositories](/pr-and-release-gating/aikido-ci-gating-functionality/default-pr-mr-gating-configuration-for-new-repositories.md) for UI guidance.
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.aikido.dev/pr-and-release-gating/bitbucket-pr-gating/bitbucket-ci-pr-gating-via-aikido-dashboard-with-a-workspace-access-token.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
