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

# Connect Bitbucket with API Token – StackOne Hub

> Link a Bitbucket account in the StackOne Hub using API Token. End-user guide to authorize the integration and start using Bitbucket actions.

Select Actions to adjust the guideSome actions may require additional configuration in the provider to be accessible. Choose the actions you need and the guide will be updated.

Select all
Clear

ActionScope(s)

Loading actions...No actions match your search.

Dynamic Guide URL

Copy URL

Scopes Selected

<pre role="textbox" aria-readonly="true" tabIndex="0" />

Separator

Copy scopes

## Creating a scoped API token

An API token acts with the Bitbucket permissions of the Atlassian account that creates it, so sign in as the account the connection should use.

**1. Start a scoped API token**

Sign in to your [Atlassian account](https://id.atlassian.com/manage-profile/security/api-tokens) to open the **API Tokens** page.

<ul>
  <li>Click **Create API token with scopes**.</li>
</ul>

![The Atlassian API Tokens page with the Create API token with scopes button highlighted](https://mintcdn.com/stackone-60/CujQRlriSUMfjXZA/connectors/bitbucket/images/api_token-config-create-api-token-with-scopes.png?fit=max\&auto=format\&n=CujQRlriSUMfjXZA\&q=85\&s=cb017843e2dbd11510afe95cb6629502)

**2. Name the token**

On the **Name API token** screen, fill in the token details.

<ul>
  <li>**Name**: `StackOne Integration`</li>
  <li>**Expires on**: The date the token should stop working</li>
  <li>Click **Next**.</li>
</ul>

![The Name API token screen with the Name and Expires on fields and the Next button highlighted](https://mintcdn.com/stackone-60/CujQRlriSUMfjXZA/connectors/bitbucket/images/api_token-config-name-and-expiry.png?fit=max\&auto=format\&n=CujQRlriSUMfjXZA\&q=85\&s=ff5790610dbe9021252b17257df353b2)

**3. Select Bitbucket**

On the **Select the app** screen, choose the app the token can reach.

<ul>
  <li>**Select API token app**: **Bitbucket**</li>
  <li>Click **Next**.</li>
</ul>

![The Select the app screen with Bitbucket selected and the Next button highlighted](https://mintcdn.com/stackone-60/CujQRlriSUMfjXZA/connectors/bitbucket/images/api_token-config-select-bitbucket.png?fit=max\&auto=format\&n=CujQRlriSUMfjXZA\&q=85\&s=a439eee5261c0d79984c1d73a9428ea5)

**4. Select the scopes**

Enables actions: Add Default Reviewer, Approve Commit, Approve Pull Request, Create Branch Restrictions, Create Branches, Create Build, Create Comments, Create Commits, Create Deploy Key, Create Deploy Keys, Create Environment, Create Pipelines, Create Project, Create Pullrequests, Create Repository, Create Schedules, Create Src, Create Ssh Keys, Create Variables, Decline Pull Request, Delete Branch Restrictions, Delete Comments, Delete Default Reviewer, Delete Default Reviewers, Delete Deploy Key, Delete Deploy Keys, Delete Project, Delete Reports, Delete Repository, Delete Schedules, Delete Ssh Keys, Delete Variables, Get Authenticated User, Get Branch Restrictions, Get Branches, Get Branching Model, Get Branching Model Settings, Get Build, Get Comments, Get Commit, Get Default Reviewer, Get Default Reviewers, Get Deploy Key, Get Deploy Keys, Get Deployment, Get Diff, Get Diffstat, Get Environment, Get Log, Get Logs, Get Patch, Get Pipelines, Get Pipelines Config, Get Project, Get Project Branching Model Settings, Get Pullrequests, Get Reports, Get Repository, Get SSH Key, Get Schedules, Get Src, Get Steps, Get Unified Credentials, Get Unified Organization, Get Unified Role, Get Unified User, Get User, Get Variables, Get Workspace, List Branch Restrictions, List Branches, List Branching Model, List Comments, List Commits, List Default Reviewers, List Deploy Keys, List Deployments, List Downloads, List Environments, List Forks, List Permissions, List Pipelines, List Projects, List Pull Request Commits, List Pullrequests, List Reports, List Repositories In Workspace, List Repository Groups, List Repository Permissions, List Schedules, List Src, List Ssh Keys, List Statuses, List Steps, List Unified Organizations, List Unified Resource Types, List Unified Resource Users, List Unified Roles, List Unified Users, List User Repository Permissions, List Variables, List Watchers, List Workspace Members, List Workspace Repository Permissions, List Workspaces, Merge Pull Request, Remove Request Changes, Request Changes, Resolve Pull Request Comment, Stop Pipeline, Unapprove Commit, Unapprove Pull Request, Unresolve Pull Request Comment, Update Branch Restrictions, Update Build, Update Build Number, Update Comments, Update Default Reviewer, Update Deploy Keys, Update Environment, Update Pipelines Config, Update Project, Update Pullrequests, Update Reports, Update Schedules, Update Settings, Update Ssh Keys, Update Variables

On the **Select Bitbucket scopes** screen, tick every scope listed. Use **Search by scope name** to find each one. To receive webhook events, also tick `read:webhook:bitbucket`, `write:webhook:bitbucket` and `delete:webhook:bitbucket`.

<ul>
  <li>Click **Next**.</li>
</ul>

![The Select Bitbucket scopes screen with ticked scope checkboxes and the Next button highlighted](https://mintcdn.com/stackone-60/CujQRlriSUMfjXZA/connectors/bitbucket/images/api_token-config-select-scopes.png?fit=max\&auto=format\&n=CujQRlriSUMfjXZA\&q=85\&s=1ae3efb0b74150fb02cc9899f32e5bac)

<ul>
  <li>
    read:repository:bitbucket
  </li>

  <li>
    write:repository:bitbucket
  </li>

  <li>
    admin:repository:bitbucket
  </li>

  <li>
    delete:repository:bitbucket
  </li>

  <li>
    read:pullrequest:bitbucket
  </li>

  <li>
    write:pullrequest:bitbucket
  </li>

  <li>
    read:project:bitbucket
  </li>

  <li>
    admin:project:bitbucket
  </li>

  <li>
    read:workspace:bitbucket
  </li>

  <li>
    read:user:bitbucket
  </li>

  <li>
    read:pipeline:bitbucket
  </li>

  <li>
    write:pipeline:bitbucket
  </li>

  <li>
    admin:pipeline:bitbucket
  </li>

  <li>
    read:ssh-key:bitbucket
  </li>

  <li>
    write:ssh-key:bitbucket
  </li>

  <li>
    delete:ssh-key:bitbucket
  </li>
</ul>

**5. Create the token**

On the **Review your API token** screen, check the name, expiry and scopes.

<ul>
  <li>Click **Create token**.</li>
</ul>

![The Review your API token screen with the Create token button highlighted](https://mintcdn.com/stackone-60/CujQRlriSUMfjXZA/connectors/bitbucket/images/api_token-config-create-token.png?fit=max\&auto=format\&n=CujQRlriSUMfjXZA\&q=85\&s=787988a4733c35ba9a8f3dd483f100b7)

**6. Copy the token**

On the **Copy API token** screen, the token is shown only once and cannot be retrieved later.

<ul>
  <li>Click **Copy**.</li>
  <li>Copy the **API token** across.</li>
  <li>Your **Email** is the email address of the Atlassian account you signed in with.</li>
  <li>New tokens may take up to a minute to work after they've been created.</li>
</ul>

![The Copy API token screen with the token value hidden and the Copy button highlighted](https://mintcdn.com/stackone-60/CujQRlriSUMfjXZA/connectors/bitbucket/images/api_token-config-copy-api-token.png?fit=max\&auto=format\&n=CujQRlriSUMfjXZA\&q=85\&s=7bfc3aa0d9445ff4bb6468a437cbac35)

**7. Find the Webhook Workspace**

Only needed to receive webhook events. Your **Webhook Workspace** is the workspace slug in the address bar when you open the workspace in Bitbucket. The account that created the token must be an administrator of this workspace.

<ul>
  <li>Format: `https://bitbucket.org/{workspace}/`</li>
  <li>Example: if your URL is `https://bitbucket.org/acme-dev/`, your **Webhook Workspace** is `acme-dev`</li>
</ul>

## Link the Account

**1. Connect**

<ul>
  <li>Click **Connect**.</li>
  <li>If applicable, the provider will redirect you to a sign-in or authorization page. Complete the provider's authorization flow.</li>
  <li>Once authorization is successful, you will see a confirmation popup.</li>
</ul>

**2. Use Actions**

Connect an AI platform to the linked account's actions. See [AI Platforms](https://docs.stackone.com/ai-platforms/overview.md).

Other ways to call actions are listed in [Protocols & SDKs](https://docs.stackone.com/connect/protocols-and-sdks.md).

## Next Steps

> [card] [Webhooks setup](https://docs.stackone.com/connectors/bitbucket/guides/webhook-setup.md)
>
> Configure receiving Events for Bitbucket into StackOne.


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