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

# Bitbucket Data Center

> Configure CodeAnt AI for Self-hosted Bitbucket Data Center

Follow these instructions to configure your self-hosted Bitbucket Data Center using Single Sign-On (SSO):

## Step 1: Access Self-Hosted and Sign In with SSO

* **Access the Self-Hosted Option**
  * Visit [app.codeant.ai](https://app.codeant.ai/) and select the **Self-Hosted** option.
  * Click on **Sign in with SSO**.
  * Enter your company email (note: public emails like gmail.com or yahoo.com won't work).
  * Retrieve the verification code sent to your email and enter it to complete authentication.

## Step 2: Select Bitbucket as Your Version Control Provider

* After signing in with SSO, click on **Change Provider** to select a different version control system.

  <img src="https://mintcdn.com/codeantai/5hlXFJYaiG5gl5rY/images/setup/bitbucket/data_center/change_provider.png?fit=max&auto=format&n=5hlXFJYaiG5gl5rY&q=85&s=f976875d73a9f6dd7ce61a2e8518c1cc" alt="Change Provider" width="3276" height="1742" data-path="images/setup/bitbucket/data_center/change_provider.png" />

* Select **Bitbucket** to connect with your Bitbucket Data Center instance.

  <img src="https://mintcdn.com/codeantai/5hlXFJYaiG5gl5rY/images/setup/bitbucket/data_center/select_provider.png?fit=max&auto=format&n=5hlXFJYaiG5gl5rY&q=85&s=17b136d208d7bb96fef9010b0c8923de" alt="Select Bitbucket Provider" width="1414" height="1310" data-path="images/setup/bitbucket/data_center/select_provider.png" />

## Step 3: Create an HTTP Access Token in Bitbucket Data Center

* Navigate to your Bitbucket Data Center instance.

* Click on your **profile icon** in the top right corner and select **Manage account**.

  <img src="https://mintcdn.com/codeantai/5hlXFJYaiG5gl5rY/images/setup/bitbucket/data_center/manage_account_from_profile.png?fit=max&auto=format&n=5hlXFJYaiG5gl5rY&q=85&s=00ab1e9edfc4b5367c112bc995cf5251" alt="Manage Account" width="1684" height="828" data-path="images/setup/bitbucket/data_center/manage_account_from_profile.png" />

* In the account settings, select **HTTP access tokens** from the left sidebar.

  <img src="https://mintcdn.com/codeantai/5hlXFJYaiG5gl5rY/images/setup/bitbucket/data_center/http_access_token.png?fit=max&auto=format&n=5hlXFJYaiG5gl5rY&q=85&s=e3a10f531a9fd82ea969f83c6cb3f9c1" alt="HTTP Access Tokens" width="1638" height="894" data-path="images/setup/bitbucket/data_center/http_access_token.png" />

* Click on **Create token** and configure the token:

  * **Token name:** CodeAnt AI
  * **Expiry:** Choose the maximum duration available (or select "Do not expire" if available).
  * **Permissions:**
    * **Project permissions:** Project read
    * **Repository permissions:** Repository write

  <img src="https://mintcdn.com/codeantai/5hlXFJYaiG5gl5rY/images/setup/bitbucket/data_center/access_token_permissions.png?fit=max&auto=format&n=5hlXFJYaiG5gl5rY&q=85&s=60687c3e16e6e4aa70ee654928133495" alt="Access Token Permissions" width="1516" height="1510" data-path="images/setup/bitbucket/data_center/access_token_permissions.png" />

* Click **Create** and copy the generated token immediately (you won't be able to see it again).

## Step 4: Enter Your Bitbucket Data Center Details in CodeAnt AI

* Return to the CodeAnt AI setup page.
* Enter the following information:

  * **Domain:** Your company domain (e.g., `codeant.ai`)
  * **Bitbucket Base URL:** The base URL of your self-hosted Bitbucket Data Center instance (e.g., `https://bitbucket.company.com`)
  * **Access token:** Paste the HTTP access token you created in the previous step

  <img src="https://mintcdn.com/codeantai/5hlXFJYaiG5gl5rY/images/setup/bitbucket/data_center/fill_codeant_form.png?fit=max&auto=format&n=5hlXFJYaiG5gl5rY&q=85&s=18e4b189c8ed1211063c7b28fb104e65" alt="Fill CodeAnt Form" width="1334" height="1238" data-path="images/setup/bitbucket/data_center/fill_codeant_form.png" />

## Step 5: Validate and Submit

* Review all the entered information.
* Click **Validate & Submit**.
* If everything is correct, your projects and repositories will be fetched and displayed in CodeAnt AI.

***

# Pull Request Review Configuration

After completing the initial setup, configure webhooks to enable CodeAnt AI's pull request review capabilities. Follow these steps to set up webhooks for your Bitbucket Data Center project:

## Step 1: Navigate to Project Settings

* Go to your Bitbucket Data Center instance.
* Select the **Project** you want to configure.
* Click on **Project settings** (gear icon in the left sidebar).

  <img src="https://mintcdn.com/codeantai/5hlXFJYaiG5gl5rY/images/setup/bitbucket/data_center/webhooks/project_settings.png?fit=max&auto=format&n=5hlXFJYaiG5gl5rY&q=85&s=9e2115bf18b6e0d4fa9a25e897a287ce" alt="Project Settings" width="2206" height="1264" data-path="images/setup/bitbucket/data_center/webhooks/project_settings.png" />

## Step 2: Access Webhooks

* In the project settings sidebar, scroll down to the **WORKFLOW** section.
* Click on **Webhooks**.
* Click the **Create webhook** button in the top right corner.

  <img src="https://mintcdn.com/codeantai/5hlXFJYaiG5gl5rY/images/setup/bitbucket/data_center/webhooks/create_webhook_button.png?fit=max&auto=format&n=5hlXFJYaiG5gl5rY&q=85&s=771f0ec5703d046b61fbc8f86b847787" alt="Create Webhook Button" width="3410" height="1296" data-path="images/setup/bitbucket/data_center/webhooks/create_webhook_button.png" />

## Step 3: Create Webhook for Pull Request Review

Configure the first webhook to handle pull request events:

* **Name:** CodeAnt PR Review
* **URL:** `https://api.codeant.ai/pr/bitbucket/pr_review/processPullRequestBitbucket`
* **Status:** Check **Active**
* **SSL/TLS:** Leave "Skip certificate verification" unchecked (recommended for security)
* **Authentication:** None

  <img src="https://mintcdn.com/codeantai/5hlXFJYaiG5gl5rY/images/setup/bitbucket/data_center/webhooks/pr_review_webhook_info.png?fit=max&auto=format&n=5hlXFJYaiG5gl5rY&q=85&s=85c1710b10a50760116e6a14b0609293" alt="PR Review Webhook Info" width="1448" height="1464" data-path="images/setup/bitbucket/data_center/webhooks/pr_review_webhook_info.png" />

### Select Pull Request Events

Under the **Pull request** section, select the following events:

* **Opened** - A pull request is opened or reopened

* **Modified** - A pull request's description, title, target branch or draft status is changed

* **Source branch updated** - A pull request's source branch has been updated

  <img src="https://mintcdn.com/codeantai/5hlXFJYaiG5gl5rY/images/setup/bitbucket/data_center/webhooks/pr_review_webhook_events.png?fit=max&auto=format&n=5hlXFJYaiG5gl5rY&q=85&s=743e73ebf458a2170357c4d593ab235c" alt="PR Review Webhook Events" width="2204" height="1044" data-path="images/setup/bitbucket/data_center/webhooks/pr_review_webhook_events.png" />

* Click **Save** to create the webhook.

## Step 4: Create Webhook for Pull Request Comments

Configure the second webhook to handle pull request comment events for question answering:

* Click **Create webhook** again to add another webhook.
* **Name:** CodeAnt PR Comment
* **URL:** `https://api.codeant.ai/pr/bitbucket/handle_comment/handleBitBucketPRComment`
* **Status:** Check **Active**
* **SSL/TLS:** Leave "Skip certificate verification" unchecked
* **Authentication:** None

  <img src="https://mintcdn.com/codeantai/5hlXFJYaiG5gl5rY/images/setup/bitbucket/data_center/webhooks/pr_comment_webhook_info.png?fit=max&auto=format&n=5hlXFJYaiG5gl5rY&q=85&s=45f165232905c9fdb482b29563842396" alt="PR Comment Webhook Info" width="1406" height="1224" data-path="images/setup/bitbucket/data_center/webhooks/pr_comment_webhook_info.png" />

### Select Comment Events

Under the **Pull request** section, select the following event:

* **Comment added** - A pull request has comments added

  <img src="https://mintcdn.com/codeantai/5hlXFJYaiG5gl5rY/images/setup/bitbucket/data_center/webhooks/pr_comment_webhook_events.png?fit=max&auto=format&n=5hlXFJYaiG5gl5rY&q=85&s=2864d73dd1f7f9ea6f93cd4d5517d07f" alt="PR Comment Webhook Events" width="2150" height="1192" data-path="images/setup/bitbucket/data_center/webhooks/pr_comment_webhook_events.png" />

* Click **Save** to create the webhook.

## Step 5: Verify Webhook Configuration

After creating both webhooks, you should see them listed in the Webhooks page:

1. **CodeAnt PR URL** - For pull request events (Opened, Modified, Source branch updated)
2. **CodeAnt PR Comment** - For pull request comment events (Comment added)

Both webhooks should show as **ACTIVE** status.

Your pull requests will now be automatically reviewed by CodeAnt AI whenever:

* A new pull request is opened
* An existing pull request is modified or updated
* Comments are added to pull requests (for AI-powered question answering)
