Skip to content

Bitbucket cloud api tokens docs #858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/screenshots/Bitbucket-cloud-form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added docs/assets/screenshots/api-token-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 27 additions & 17 deletions docs/getting-started/integrate-source-code/Bitbucket-Cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,44 @@ You can set up multiple Space-level and one default Bitbucket Cloud integration
### Initial setup

1. On the _Source control_ tab, click **Set up integration**, then choose **Bitbucket Cloud** on the dropdown.
![Create a Bitbucket integration](<../../assets/screenshots/Screenshot from 2021-06-10 16-05-39.png>)
![Create a Bitbucket integration](<../../assets/screenshots/Bitbucket-cloud-form.png>)
2. **Integration name**: Enter a name for your integration. It cannot be changed later because the Spacelift webhook endpoint is generated based on this name.
3. **Integration type**: Default (all spaces) or [Space-specific](../../concepts/spaces/README.md). Each Spacelift account can only support one default integration per VCS provider, which is available to all stacks and modules in the same Space as the integration.

### Create your app password
!!! warning "Migration from App Passwords to API Tokens"
Previously, this integration used Bitbucket App Passwords for authentication. Atlassian has deprecated App Passwords and [replaced them with API tokens](https://www.atlassian.com/blog/bitbucket/bitbucket-cloud-transitions-to-api-tokens-enhancing-security-with-app-password-deprecation){: rel="nofollow"}.

You will need to create an [app password](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/){: rel="nofollow"} for this integration on the Bitbucket Cloud site.
### Create your API token

1. Navigate to _Personal settings_ > _App passwords_.
2. Click **Create app password**.
3. Fill in the details to create a new app password:
![App password creation](<../../assets/screenshots/Screenshot from 2021-06-10 16-16-53.png>)
1. Label: Enter a descriptive name (label) for the password.
2. Permissions: Check the **Read** box for _Repositories_ and _Pull requests_ to grant read access.
4. Click **Create**.
5. Copy the app password details to finish the integration in Spacelift.
![Created new app password](<../../assets/screenshots/Screenshot from 2021-06-10 16-39-03.png>)
You will need to create an [API token](https://support.atlassian.com/bitbucket-cloud/docs/using-api-tokens){: rel="nofollow"} for this integration on the Bitbucket Cloud site.

1. Navigate to **Atlassian account settings** > **Security** > **Create API token with scopes**.
2. Fill in the details to create a new API token:
1. Choose a name for your API token.
2. Set an expiration date.
3. Select **Bitbucket** as the app.

![Api token app](<../../assets/screenshots/api-token-app.png>)

4. Select read permissions for:
- Repository
- Pull requests

![Api token permissions](<../../assets/screenshots/api-token-permissions.png>)

3. Click **Create**.
4. Copy the API token details to finish the integration in Spacelift.

### Copy details into Spacelift

Now that your personal access token has been created, return to the integration configuration screen in Spacelift.
Now that your API token has been created, return to the integration configuration screen in Spacelift.

1. **Username**: Enter your Bitbucket Cloud username.
2. **App password**: Paste the [app password](#create-your-app-password) that Spacelift will use to access your Bitbucket Cloud repository.
1. **Email**: Enter your Bitbucket Cloud email address.
2. **API token**: Paste the [API token](#create-your-api-token) that Spacelift will use to access your Bitbucket Cloud repository.
3. **Labels**: Organize integrations by assigning labels to them.
4. **Description**: A markdown-formatted free-form text field to describe the integration.
5. Click **Set up** to save your integration details.
![Filled integration details](<../../assets/screenshots/Screenshot from 2021-06-11 10-50-38.png>)
![Filled integration details](<../../assets/screenshots/Bitbucket-cloud-form-filled.png>)

### Set up webhooks

Expand All @@ -52,7 +62,7 @@ For every Bitbucket Cloud repository being used in Spacelift stacks or modules,

1. On the _Source code_ page, click the **three dots** next to the integration name.
2. Click **See details** to find the _webhook endpoint_ and _webhook secret_.
![Find webhook endpoint and secret](<../../assets/screenshots/Screenshot from 2021-06-11 14-52-40.png>)
![Find webhook endpoint and secret](<../../assets/screenshots/Bitbucket-cloud-integration-details.png>)

#### Configure webhooks in Bitbucket Cloud

Expand Down
33 changes: 22 additions & 11 deletions docs/integrations/source-control/bitbucket-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,55 @@ In order to set up the integration from the Spacelift side, please navigate to t
This form will appear:

<p align="center">
<img src="../../assets/screenshots/Screenshot from 2021-06-10 16-05-39.png" width="450" alt="VCS form" />
<img src="../../assets/screenshots/Bitbucket-cloud-form.png" width="450" alt="VCS form" />
</p>

Explanation of the fields:

- **Integration name** - the friendly name of the integration. The name cannot be changed after the integration is created. That is because the Spacelift webhook endpoints are generated based on the integration name.
- **Integration type** - either default or [Space](../../concepts/spaces/README.md)-specific. The default integration is available to **all** stacks and modules. There can be only one default integration per VCS provider. Space-level integrations however are only available to those stacks and modules that are in the same Space as the integration (or [inherit](../../concepts/spaces/access-control.md#inheritance) permissions through a parent Space). For example if your integration is in `ParentSpace` and your stack is in `ChildSpace` with inheritance enabled, you'll be able to attach the integration to that stack. Refer to the [Spaces documentation](../../concepts/spaces/access-control.md) to learn more about Space access controls and inheritance.
- **Username** - a username of your Bitbucket account.
- **App password** - app passwords are user-based access tokens for scripting tasks and integrating tools. You can find a little how-to below: [Creating an App Password](#creating-an-app-password).
- **Email** - an email of your Bitbucket account.
- **API token** - API tokens are user-based access tokens for scripting tasks and integrating tools. You can find a little how-to below: [Creating an API Token](#creating-an-api-token).
- **Labels** - a set of labels to help you organize integrations.
- **Description** - a markdown-formatted free-form text field that can be used to describe the integration.

### Choosing the right Integration type

Space-level integrations will be listed to users with **read** access to the integration Space. Integration details however contain sensitive information so they are only visible to those with **admin** access. On the other hand, default integrations are visible to all users of the account, but only **root** Space admins can see the details of them. Visit the [Spaces](../../concepts/spaces/README.md) documentation to learn more about access controls.

### Creating an App Password
!!! warning "Migration from App Passwords to API Tokens"
Previously, this integration used Bitbucket App Passwords for authentication. Atlassian has deprecated App Passwords and [replaced them with API tokens](https://www.atlassian.com/blog/bitbucket/bitbucket-cloud-transitions-to-api-tokens-enhancing-security-with-app-password-deprecation){: rel="nofollow"}.

### Creating an API Token

In order to get the [API token](https://support.atlassian.com/bitbucket-cloud/docs/using-api-tokens){: rel="nofollow"} you'll need to go to Bitbucket Cloud and navigate to **Atlassian account settings** -> **Security** -> **Create API token with scopes**. In the form, you will need to:

1. Choose a name for your API token
2. Set an expiration date
3. Select **Bitbucket** as the app

In order to get the [App password](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/){: rel="nofollow"} you'll need to go to the Bitbucket Cloud site and navigate to **Personal settings** -> **App passwords** (it's under Access management) -> **Create app password**. There, you will need to give your new app password a label and give it read access to repositories and pull requests:
![Api token app](<../../assets/screenshots/api-token-app.png>)

![App password creation](<../../assets/screenshots/Screenshot from 2021-06-10 16-16-53.png>)
4. Select read permissions for:
- Repository
- Pull requests

This will give you an app password token which you can put into the **App Password** field in the integration configuration.
![Api token permissions](<../../assets/screenshots/api-token-permissions.png>)

![Created new app password](<../../assets/screenshots/Screenshot from 2021-06-10 16-39-03.png>)
This will generate an API token which you can put into the **API Token** field in the integration configuration.

### Finishing the setup

After doing all this you should have all fields filled in.

<p align="center">
<img src="../../assets/screenshots/Screenshot from 2021-06-11 10-50-38.png" width="450" alt="Filled in Bitbucket Cloud integration form" />
<img src="../../assets/screenshots/Bitbucket-cloud-form-filled.png" width="450" alt="Filled in Bitbucket Cloud integration form" />
</p>

Once you've finished saving the form, you can find your **webhook endpoint** after clicking the 3 dots next to the integration name on the **Source code** page, and then clicking **See details**.

<p align="center">
<img src="../../assets/screenshots/Screenshot from 2021-06-11 14-52-40.png" width="450" alt="Integration details" />
<img src="../../assets/screenshots/Bitbucket-cloud-integration-details.png" width="450" alt="Integration details" />
</p>

For each repository you want to use with Spacelift, you now have to go into its **Repository settings -> Webhooks -> Add webhook**, and configure the webhook accordingly, by activating the following events:
Expand Down