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

# Bitbucket

> Code repository and collaboration platform

## Overview

Connect your Bitbucket workspace to give TierZero access to your repositories, commits, pull requests, and pipelines. TierZero uses Bitbucket to correlate code changes with incidents and analyze CI/CD pipeline results.

## Prerequisites

* Administrative access to your Bitbucket workspace
* Permission to create OAuth consumers

## Setup Instructions

### Step 1: Navigate to Integration Settings

1. Log into your TierZero dashboard
2. Go to **Settings → Integrations**
3. Click **Connect** next to Bitbucket

### Step 2: Create an OAuth Consumer

1. In Bitbucket, go to your workspace **Settings → Apps and features → OAuth consumers**
2. Click **Add consumer**
3. Check **This is a private consumer**
4. Set the callback URL to the URL provided in TierZero's setup dialog
5. Grant the following permissions:

| Permission        | Level | Purpose                                                   |
| ----------------- | ----- | --------------------------------------------------------- |
| **Account**       | Read  | Required for authentication during the OAuth flow         |
| **Repositories**  | Write | Read code, push commits, and access repository metadata   |
| **Pull requests** | Write | Read and create pull requests, post comments              |
| **Pipelines**     | Write | Read pipeline status and logs, trigger and stop pipelines |

6. Click **Save**

### Step 3: Enter Credentials

1. Copy the **Key** and **Secret** from the created OAuth consumer
2. Paste them into TierZero's Bitbucket setup fields
3. Click **Connect**

## What TierZero Accesses

* **Repository contents**: Code files, branches, and directory structure
* **Commit history**: Recent commits, diffs, and authors
* **Pull requests**: Open PRs, comments, and approval status
* **Pipelines**: Pipeline run status, logs, and artifacts

## Security

* TierZero uses Bitbucket's OAuth 2.0 flow
* Tokens are encrypted at rest and refreshed automatically
* Revoke access by deleting the OAuth consumer in Bitbucket workspace settings

## Troubleshooting

### OAuth Authorization Fails

* Verify the callback URL matches exactly what's shown in TierZero's setup dialog
* Ensure the OAuth consumer is marked as private
* Check that all required permissions are granted
