---
title: "Bitbucket Data Center"
canonical_url: "https://docs.getdx.com/connectors/bitbucket-data-center/"
md_url: "https://docs.getdx.com/connectors/bitbucket-data-center.md"
last_updated: "2026-06-18"
---

# Bitbucket Data Center
By integrating Bitbucket Data Center with DX, you can analyze pull requests, repositories, and pipelines data. Please refer to the API documentation below and our [schema explorer](https://docs.getdx.com/schema/) to see what data DX imports—note that DX does not read or access your source code.

## Prerequisites

To connect Bitbucket Data Center to DX, you need:

- a Bitbucket service account
- if your Bitbucket instance is behind a firewall or has IP restrictions, you need to allowlist [DX IP addresses](https://docs.getdx.com/allowlisting-dx/)

## Setup instructions

Follow the steps below to connect Bitbucket Data Center to DX.

### Data connection

#### Step 1

Create a user account in Bitbucket Data Center to use as a service account, and grant the user access to the projects that you would like imported into DX.

#### Step 2

- Navigate to the connections page in DX and select "+ Connection" in the top right.
- Enter the credentials you have generated in the previous steps—refer to the information below for errors and troubleshooting.

### Webhooks

DX supports Bitbucket webhooks ingestion to sync pull request data in real-time. This is recommended in order to ensure real-time data accuracy in DX.

To enable webhook ingestion, follow the steps below:

1. Go to Repository settings > Webhooks > Create Webhook
2. For URL, enter https://yourinstance.getdx.net/webhooks/bitbucket_data_center with your unique subdomain
3. Enter your webhooks secret from DX—this can be found and copied in the Connections admin page.
4. Enable the following Pull Request events:
   - Opened
   - Modified
   - Approved
   - Declined
   - Unapproved
   - Merged
5. (Optional) Test the connection by clicking on Test connection.
6. Click save.

Here's an example of what your settings should look like:

![](https://docs.getdx.com/assets/images/connectors/bitbucket-data-center/webhooks.png){class="max-w-xl mx-auto"}

## API reference

The table below lists the specific API endpoints that are used by DX.


| Endpoint | Documentation |
|----------------------------------------------------------------------------------------------------------|---------------|
| /projects | [Link](https://docs.atlassian.com/bitbucket-server/rest/5.15.0/bitbucket-rest.html#idm121705890544) |
| /projects/{key}/repos | [Link](https://docs.atlassian.com/bitbucket-server/rest/5.15.0/bitbucket-rest.html#idm121706014864) |
| /projects/{project_key}/repos/{repo}/pull-requests | [Link](https://docs.atlassian.com/bitbucket-server/rest/5.15.0/bitbucket-rest.html#idm121738915296) |
| /projects/{project_key}/repos/{repo}/pull-requests/{pull_request_source_id}/diff | [Link](https://docs.atlassian.com/bitbucket-server/rest/5.15.0/bitbucket-rest.html#idm121705482256) |
| /projects/{project_key}/repos/{repo}/pull-requests/{pull_request_id}/activities | [Link](https://docs.atlassian.com/bitbucket-server/rest/5.15.0/bitbucket-rest.html#idm121739161936) |
| /admin/users | [Link](https://docs.atlassian.com/bitbucket-server/rest/5.15.0/bitbucket-rest.html#idm121709701312) |


## Errors

The table below lists potential error codes when adding a connection in DX.


| Error | Description |
|------------------------|--------------------------------------------------------------------------|
| `invalid_credentials` | Your API credentials entered are not valid. |
| `invalid_permissions` | Your API token does not have the permissions required by DX. |
| `no_resources` | DX cannot access any projects or repositories. |


## Curl commands

#### When connection verification fails

When DX verifies a Bitbucket Data Center connection, it checks access to projects. If your connection is failing, you can test these endpoints directly using the curl commands below to troubleshoot the issue.

<div>
  <p class="mb-4 text-sm text-gray-700">Replace YOUR_BITBUCKET_URL, YOUR_USERNAME, and YOUR_PASSWORD with your actual values before running these commands.</p>

  <h4>1. Test Projects Access</h4>
  <p>This verifies that your credentials can access projects:</p>
  <div class="code-block-wrapper">
    <button class="copy-button" title="Copy to clipboard">
      <svg class="copy-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
      <svg class="check-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>
    </button>
    <pre><code class="language-bash">curl -u YOUR_USERNAME:YOUR_PASSWORD -H 'Accept: application/json' 'YOUR_BITBUCKET_URL/rest/api/1.0/projects'</code></pre>
  </div>

  <h4>2. Test Users Access</h4>
  <p>This verifies that your credentials can access user information:</p>
  <div class="code-block-wrapper">
    <button class="copy-button" title="Copy to clipboard">
      <svg class="copy-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
      <svg class="check-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>
    </button>
    <pre><code class="language-bash">curl -u YOUR_USERNAME:YOUR_PASSWORD -H 'Accept: application/json' 'YOUR_BITBUCKET_URL/rest/api/1.0/admin/users'</code></pre>
  </div>
</div>

If you receive a 401 Unauthorized error, your credentials are invalid. If you receive a 403 Forbidden error, your service account doesn't have the required permissions. If you receive a 404 Not Found error, check that your Bitbucket Server URL is correct.

## Data Cloud API

Once the initial connection is created successfully, Bitbucket Data Center credentials can be managed via the Data Cloud API.

- [credentials.create](https://docs.getdx.com/datacloudapi/methods/credentials.create/)
- [credentials.update](https://docs.getdx.com/datacloudapi/methods/credentials.update/)
- [credentials.info](https://docs.getdx.com/datacloudapi/methods/credentials.info/)
- [credentials.list](https://docs.getdx.com/datacloudapi/methods/credentials.list/)
- [credentials.delete](https://docs.getdx.com/datacloudapi/methods/credentials.delete/)

### Credential fields


| Field | Type | Description |
| ----- | ---- | ----------- |
| `settings.bitbucket_data_center_username` | `String` | The service account username. |
| `secrets.bitbucket_data_center_password` | `String` | The service account password. |


```json
{
  "id": 456,
  "settings": {
    "bitbucket_data_center_username": "dx-service-account"
  },
  "secrets": {
    "bitbucket_data_center_password": "fake-password-here"
  }
}
```
---

## Sitemap

[Overview of all docs pages](/llms.txt)
