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

# Bitbucket

> Connect Bitbucket to ApiTraffic to auto-track commits, tags, and releases

Connecting Bitbucket authorizes ApiTraffic (via OAuth) to see the repositories you have access to and to register push, tag, and release webhooks on the repositories you assign to a bucket.

> [!NOTE]
>
> You must be an ApiTraffic account **admin**, and have **admin** permission on any Bitbucket repository you want to track (required to add repository webhooks). Bitbucket Cloud is supported today; Bitbucket Server / Data Center is not yet.

## 1. Start the connection

In ApiTraffic, go to **Settings → Integrations → Git** and click **Connect Bitbucket**.

![Connect Bitbucket button in ApiTraffic git integration settings](https://app.apitraffic.io/images/docs/git/bitbucket-connect-button.png)

## 2. Authorize ApiTraffic

You'll be redirected to Bitbucket to grant access to the requested scopes (read your repositories and manage their webhooks). Click **Grant access**.

![Bitbucket OAuth consent screen for ApiTraffic](https://app.apitraffic.io/images/docs/git/bitbucket-authorize.png)

## 3. Assign a repository to a bucket

Back in ApiTraffic, your connection now shows as **Active**. Pick a repository and choose the **bucket** whose API traffic that code powers. ApiTraffic registers the push webhook on that repository automatically.

![Assigning a Bitbucket repository to an ApiTraffic bucket](https://app.apitraffic.io/images/docs/git/bitbucket-assign-bucket.png)

## 4. Map branches to environments

Add one or more rows mapping a branch (or pattern) to an environment. First matching rule (by priority) wins; you can mark one row as the default fallback.

![Mapping Bitbucket branches to ApiTraffic environments](https://app.apitraffic.io/images/docs/git/bitbucket-branch-mapping.png)

## 5. Verify

Push a commit to a mapped branch. Within a few seconds a `git.push` marker appears on that bucket's charts.

![A git.push marker appearing after a Bitbucket push](https://app.apitraffic.io/images/docs/git/bitbucket-verify-marker.png)

## Disconnecting

* **In ApiTraffic:** Settings → Integrations → Git → **Disconnect** removes the link, deletes the webhooks ApiTraffic created, and stops tracking.
* **In Bitbucket:** you can also revoke the ApiTraffic authorization under **Bitbucket → Personal settings → App authorizations**.

## Troubleshooting

> **A repository I want isn't listed**
>
> ApiTraffic only lists repositories your Bitbucket user can access. Confirm your access, then refresh the ApiTraffic repository list.

> **No marker after pushing**
>
> Confirm the branch you pushed to is mapped to an environment — unmapped branches are intentionally ignored — and that the ApiTraffic webhook still exists under the repository's **Repository settings → Webhooks**.

> **Connection shows an error / expired**
>
> OAuth tokens expire. ApiTraffic refreshes them automatically, but if the refresh fails (for example access was revoked) the connection is marked **Error**. Click **Reconnect** to re-authorize.


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