Set Up Bitbucket Integration

Connect Bitbucket Cloud workspaces to Dash0 so Agent0 can clone repositories and work with pull requests as the person who asked.

Connect Bitbucket Cloud to Dash0 so Agent0 can read source code, propose fixes, and open pull requests during investigations. Bitbucket Data Center and Bitbucket Server are not supported.

The Bitbucket integration has two parts, and both are required:

  • The organization connection: An administrator connects one or more Bitbucket Cloud workspaces, each with a token that is not tied to a person. Dash0 creates a webhook in each workspace, so Bitbucket can send pull request, push, and build status events to Dash0.
  • Your personal connection: Each member connects their own Bitbucket account. Agent0 uses that grant to act in Bitbucket as the person who asked, so Bitbucket attributes every clone, push, pull request, and comment to them, and their own Bitbucket permissions limit it.
Important

Agent0 has no shared bot account for Bitbucket. The workspace tokens cannot act for a person, so if you have not connected your own Bitbucket account, Agent0 cannot reach private Bitbucket repositories for you.

Tip

To create a Bitbucket integration, navigate to Settings → Integrations , click + Add, and select Bitbucket from the integration type list.

Prerequisites

Before setting up the Bitbucket integration:

  • Bitbucket Cloud. Dash0 connects to workspaces on bitbucket.org.
  • Organization administrator role in Dash0.
  • Workspace administrator in Bitbucket for each workspace you connect, so you can create its token.

Step 1: Connect Your Organization

A Dash0 organization administrator does this once.

Create a Token for Each Workspace

Dash0 connects each workspace with a token that is not tied to a person, so the integration keeps working when team members leave. Which token you can use depends on the workspace's Bitbucket plan.

Premium plan: workspace access token

  1. In Bitbucket, open the workspace's Workspace settings → Access tokens and choose Create access token.
  2. Select these scopes: repository, pullrequest, webhook, repository:write, and pullrequest:write.

Free or Standard plan: bot account API token

These plans have no workspace access tokens, so Dash0 uses the API token of a bot account instead.

  1. Create an Atlassian account for the bot with a shared mailbox, such as bitbucket-bot@example.com.
  2. Invite the bot to the workspace as an administrator, so Dash0 can create the workspace webhook. The bot uses a seat.
  3. Signed in as the bot, open Atlassian account → Security → API tokens and choose Create API token with scopes.
  4. Select Bitbucket as the app, then these scopes: read:workspace:bitbucket, read:user:bitbucket, read:repository:bitbucket, read:pullrequest:bitbucket, read:webhook:bitbucket, write:repository:bitbucket, write:pullrequest:bitbucket, and write:webhook:bitbucket.
Note

Bitbucket has no narrower write scope, so Dash0 asks for the write scopes as well. It uses them to post build statuses and pull request comments.

Add the Integration in Dash0

  1. Navigate to Settings → Integrations .
  2. Click + Add and select Bitbucket.
  3. Under Workspaces, add each workspace you want to connect:
    • Workspace slug: The part after bitbucket.org/ in the workspace URL.
    • Credential: Workspace access token or Bot account API token.
    • Bot account email: For a bot account API token, the Atlassian account email of the bot.
    • Access token or API token: The token you created.
  4. Under Visible in datasets, select the datasets in which the workspaces' pull requests appear in AI SDLC Insights. Anyone with access to these datasets can see their pull requests, reviews, and comments.
  5. Click Connect.

You can add up to 10 workspaces to one integration, each with its own token. An organization has one Bitbucket integration.

What Dash0 Verifies at Connect Time

Dash0 calls the Bitbucket API for each workspace before saving, and refuses the connection if a check fails:

  • Workspace access: The token must be able to read the workspace.
  • Token scopes: When Bitbucket reports the token's scopes, every scope listed in Create a Token for Each Workspace must be present. When Bitbucket does not report them, Dash0 checks that the token can read repositories, pull requests, and webhooks instead, and shows the write scopes as not verified.

Verification captures metadata that appears for each workspace on the integration page, including Last verified, Token scopes, and Write scopes.

Dash0 verifies again only when you change a workspace, a credential type, a bot account email, or a token. Editing anything else keeps the stored metadata and makes no API call.

The Workspace Webhook

When you connect, Dash0 creates one webhook in each workspace. There is nothing to configure in Bitbucket. The webhook subscribes to these events:

  • Pull request created, updated, approved, unapproved, merged, and declined
  • Pull request comment created, updated, and deleted
  • Pull request changes requested and changes request removed
  • Repository push
  • Build status created and updated

Dash0 signs the webhook with a secret that only Dash0 and Bitbucket know, and rejects a delivery whose signature does not match. To rotate the secret, open the integration's Webhooks section, click Generate new secret, and save. If Bitbucket refuses the new secret, the webhook keeps signing with the previous one, so events keep arriving, and Dash0 shows a warning with Try again.

If Bitbucket does not let the token create a webhook, Dash0 still saves the integration and marks that workspace's webhook as Not created. Dash0 then shows a command that a workspace owner can run with their own Atlassian API token that has the write:webhook:bitbucket scope. Until the webhook exists, Dash0 receives no events from that workspace.

Step 2: Connect Your Own Bitbucket Account

Every member connects their own Bitbucket account, including members who are not administrators. Until you do, Agent0 cannot act in Bitbucket for you.

  1. Open the Bitbucket integration in Settings → Integrations .
  2. In the Your Bitbucket account card, click Connect Bitbucket (read & write access), or open More access options and select Connect Bitbucket (read only).
  3. Authorize Dash0 in the Bitbucket window that opens.
  4. The card shows your connected Bitbucket account when the grant succeeds.

What the Grant Covers

The requested scopes depend on the access you choose:

  • Read-only: account, repository, and pullrequest let Agent0 clone repositories and read pull requests. With this grant, Agent0 cannot push, comment, or approve.
  • Read-write: account, repository:write, and pullrequest:write also cover pushes and pull request writes, such as opening or commenting on a pull request.

Either grant covers only what you can already do in Bitbucket, and Bitbucket attributes every action Agent0 takes to you. To change from read-only to read-write access, disconnect and connect again.

Revoke Your Connection

  • In Dash0: Click Disconnect in the Your Bitbucket account card.
  • In Bitbucket: Revoke Dash0's access to your Bitbucket account.

Dash0 renews your grant in the background. When it cannot, because the grant lapsed or was revoked in Bitbucket, the card shows a warning with a Reconnect action. Agent0 reports the same state as a warning when you ask it to do Bitbucket work.

Manage the Integration

View Integration Status

Open the Bitbucket integration in Settings → Integrations  to review the Workspaces, Webhooks, and verification details, along with your own connection in the Your Bitbucket account card. The Webhooks section shows each workspace's webhook and when Dash0 last received an event from it.

Watch for Token Expiry

Atlassian API tokens expire after one year at most. Renew a bot account API token before it expires, and enter the new token in the integration, because an expired token stops Dash0 from reading the workspace.

Remove the Integration

  1. Open the Bitbucket integration in Settings → Integrations .
  2. Click Delete Integration and confirm.

Deleting the integration deletes the stored tokens and webhook secrets, and Dash0 removes the webhooks it created. Remove any webhook you created by hand in Bitbucket yourself. Removing a workspace from the integration also removes the webhook Dash0 created in it.

Troubleshooting

Dash0 Rejects the Connection

  • Missing scope: The token lacks one of the scopes listed in Create a Token for Each Workspace. Create a new token with every scope.
  • Workspace not found or forbidden: Check the workspace slug, and that the token belongs to that workspace. For a bot account API token, check that the bot is a member of the workspace.
  • Authentication failed: Check the token, and for a bot account API token, that the email is the bot's Atlassian account email.
  • Data Center or Server: Dash0 supports Bitbucket Cloud only.

Agent0 Says You Are Not Connected

Agent0 reports the warning bitbucket_user_not_connected when the organization has a Bitbucket integration but you have not completed Step 2. Connect your Bitbucket account and ask again.

Agent0 Says the Connection Needs Reconnecting

Agent0 reports the warning bitbucket_connection_needs_reconnect when your grant has lapsed or was revoked in Bitbucket. Click Reconnect in the Your Bitbucket account card.

Agent0 Cannot Reach Bitbucket at All

Agent0 reports the warning bitbucket_network_level_blocks_clis when the thread's network mode blocks all network access. See Network Modes.

Agent0 Refuses to Write

Agent0 reports the warning bitbucket_clis_readonly_via_mcp when it is invoked through the Dash0 MCP with a read-only action scope. Reads work, and Agent0 refuses writes before it contacts Bitbucket. Run the request from Dash0 Chat or Slack instead. If you connected your own account with read-only access, Agent0 refuses writes too. Disconnect and connect again with read & write access.

An Automation Cannot Reach Bitbucket

Agent0 reports bitbucket_automation_no_acting_user when an automation has no recorded creator. Automations created through the API, CLI, Terraform, or another automation have no creator identity for Bitbucket. Recreate the automation in the Dash0 editor with a user account.

If the automation has a creator but that person has not connected Bitbucket, Agent0 reports bitbucket_user_not_connected instead, and a lapsed or revoked grant produces bitbucket_connection_needs_reconnect. The creator must connect or reconnect their own account, with read-write access for writes.

Dash0 Does Not Receive Webhook Events

  • Webhook not created: Check the workspace's webhook status in the integration's Webhooks section. If it shows Not created, ask a workspace owner to run the command Dash0 shows.
  • Secret mismatch: A webhook created by hand must use the secret Dash0 stored. Generate a new secret, save, and run the command Dash0 shows again.

Security

  • Tokens not tied to a person: The organization connection uses workspace access tokens or bot account API tokens, so it survives team changes.
  • Per-person attribution: Agent0 works in Bitbucket under the requesting person's own grant. Nothing Agent0 does in Bitbucket is anonymous, and nothing exceeds that person's Bitbucket permissions.
  • No bot fallback: If a person has no connection, the operation fails with a message asking them to connect. The workspace tokens are never substituted.
  • Signed webhooks: Deliveries carry an HMAC-SHA256 signature over the request body, which Dash0 compares in constant time.
  • Encrypted secrets: Workspace tokens, webhook secrets, and personal grants are encrypted at rest.

Further Reading

Last updated: