Bitbucket
Overview
Integrating StackGuardian with Bitbucket allows you to leverage Infrastructure and Policy as Code from your Bitbucket repositories. To set up the integration, you will need to authenticate StackGuardian Bitbucket connector using one of the following methods:
- API Token
- Access Token
- App Password (Legacy support – soon to be deprecated by Bitbucket)
This document explains all three authentication methods and how to configure the Bitbucket connector in StackGuardian.
Key Features
Create API Token
To integrate Bitbucket, you first need to create an API Token in Bitbucket with limited permissions. Follow these steps to create an API Token in Bitbucket:
- Login to Bitbucket
- Navigate to Settings (upper-right corner of the top navigation bar).
- Under Personal Settings, go to Atlassian account settings.
- Select Security from the top navigation bar.
- Under API tokens, click on Create and manage API tokens.
- Click on Create API token with scopes.
- Provide a Name for the API token.
- Set an Expires on date (this is the date when the API Token will expire. Choose a long validity period so that StackGuardian integration continues to work).
- Click on Next.
- On the Select the app page, under Select API token app, select Bitbucket.
- Click on Next.
- Under Select bitbucket scopes, Select all of the following scopes (these scopes are required to get read access to the Bitbucket repositories):
- Account:
Read - Me:
Read - Project:bitbucket:
Read - Pullrequest:bitbucket:
Read - Repository:bitbucket:
Read - User:bitbucket:
Read - Workspace:bitbucket:
Read
- Account:

- Click on Next.
- Review the details of your API Token and click Create token if it all looks good.

- Copy the generated API Token and securely store it. The API Token is displayed only once and cannot be retrieved later.

Create Access Token
To integrate Bitbucket, you first need to create an Access Token in Bitbucket with limited permissions (it’s possible to create an Access Token for a project, a repository or a workspace).
1. Access Token for Repository
Follow these steps to create an Access Token for a repository in Bitbucket:
- Login to Bitbucket.
- Navigate to target repository for the Access Token (this repository is the only one that the Access Token can access).
- On the sidebar, select Repository Settings.
- Under Security, select Access Tokens.
- Click on Create Access Token.
- Provide a Name for the Access Token.
- Under Expiry, set an Expires on date (select the date which your Access Token will expire. Choose a long validity period, so that StackGuardian integration continues to work).
- Select the permissions the Access Token needs (for detailed descriptions of each permission, see Repository-level access token permissions):
- Repositories:
Read
- Repositories:

- Click on Create to generate the new Access Token.
- Copy the generated Access Token and securely store it. The Access Token is displayed only once and cannot be retrieved later.

2. Access Token for Project
Follow these steps to create an Access Token for a project in Bitbucket:
- Login to Bitbucket.
- Navigate to target project for the Access Token (this project is the only one that the access token can access).
- On the sidebar, select Project Settings.
- Under Security, select Access Tokens.
- Click on Create Access Token.
- Provide a Name for the Access Token.
- Under Expiry, set an Expires on date (select the date which your Access Token will expire. Choose a long validity period, so that StackGuardian integration continues to work).
- Select the permissions the Access Token needs. (for detailed descriptions of each permission, see Repository-level access token permissions):
- Projects:
Read - Repositories:
Read
- Projects:

- Click on Create to generate the new Access Token.
- Copy the generated Access Token and securely store it. The Access Token is displayed only once and cannot be retrieved later.

3. Access Token for Workspace
Follow these steps to create an Access Token for a workspace in Bitbucket:
- Login to Bitbucket.
- Navigate to target workspace for the Access Token (this workspace is the only one that the Workspace Access Token can access).
- On top bar navigation, Select Settings.
- On dropdown menu, select Workspace Settings.
- Under Security, select Access Tokens.
- Click on Create Access Token.
- Provide a Name for the Access Token.
- Under Expiry, set an Expires on date (select the date which your Access Token will expire. Choose a long validity period, so that StackGuardian integration continues to work).
- Select the permissions the Access Token needs (for detailed descriptions of each permission, see Repository-level access token permissions):
- Account:
Read - Projects:
Read - Repositories:
Read
- Account:

- Click on Create to generate the new Access Token.
- Copy the generated Access Token and securely store it. The Access Token is displayed only once and cannot be retrieved later.

Create App Password (will soon be deprecated)
Bitbucket will deprecate App Passwords on 9th June 2026. Instead, use API or Access Tokens. For the App Password deprecation timeline and more information, visit the Bitbucket blog.
To integrate Bitbucket, you first need to create an App Password in Bitbucket with limited permissions. Follow these steps to create an App Password in Bitbucket:
- Log in to Bitbucket.
- Navigate to Settings (upper-right corner of the top navigation bar).
- Under Personal Settings, select Personal Bitbucket settings.
- On the left sidebar, click on App Passwords.
- Click on Create App Password.
- Provide a Label for the app password.
- Under Permissions, select the following:
- Account:
Read - Projects:
Read
- Account:

- Click on Create to generate the new App Password.
- Copy the generated App Password and securely store it. The App Password is displayed only once and cannot be retrieved later.

Create a Bitbucket VCS Connector on the StackGuardian Platform
To create a Connector, open the StackGuardian Platform and follow these steps:
- Go to the "Connectors > Version Control Providers" tab in the StackGuardian Orchestrator.
- Select "Connect to Bitbucket."
- Enter a Connector name, Description, Tag.
- Select one Bitbucket authentication type.
- Provide the required authentication information based on your chosen method:
- API Token: Enter Bitbucket User Name, Bitbucket Email, and paste the API Token that was created earlier in Bitbucket.

- Access Token: paste the Access Token that was created earlier in Bitbucket (only Access Token is required).

- App Password: Enter Bitbucket User Name, and paste the App Password that was created earlier in Bitbucket.

- Click on Create.

Update a Bitbucket VCS Connector on StackGuardian Platform
To update a Connector, open the StackGuardian Platform and follow these steps:
- Go to the "Connectors > Version Control Providers" tab in the StackGuardian Orchestrator.
- Select the Connector you want to update.
- Switch the authentication type to the one you want (Updating or switching the authentication type clears previously saved credentials; you must re-enter all required fields for the selected type to proceed).
- Enter Bitbucket Username, Bitbucket Email (only for API Token), and paste the new API Token or Access token that was created earlier in Bitbucket.
- Click on Save.

Migration Guide for App Password
Bitbucket will deprecate App Passwords on 9th June, 2026. To ensure uninterrupted access to your Bitbucket repositories via StackGuardian, we recommend you to migrate any existing Bitbucket VCS connectors that use App Passwords to either API Tokens (recommended) or Access Tokens, as soon as possible. After the deprecation, connectors using App Passwords will no longer work and all Workflows and Templates relying on them will stop working. For more information, see Bitbucket's official announcement.
1. Step-by-step guide to help you do this Migration:
-
Identify Connectors Using App Passwords
- Navigate to Connectors → Version Control Providers in StackGuardian.
- Review which connectors use App Password authentication.
-
Generate a Bitbucket API Token (Recommended) or Access Token
- Log in to Bitbucket.
- Create a new API Token or Access token with the required scopes for StackGuardian.
- Copy the token securely.
-
Update StackGuardian Connector
When updating a Bitbucket authentication type (App Password, API token or Access Token) it is also required to update your User Name and Email.
- Select the existing connector using App Password.
- Switch authentication type from App Password to API Token or Access token.
- Enter Bitbucket Username, Bitbucket Email (only for API Token), and paste the new API Token or Access token that was created earlier in Bitbucket.
- Click on Save.
