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 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
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.
Custom certificate authority
If the source system uses a TLS certificate signed by a private certificate authority (CA), add the CA certificate to the connection so DX can verify the source system’s certificate.
This field trusts certificates presented by the source system only. It does not configure trust for the reverse-tunnel proxy’s outbound connection to DX. If that connection is subject to TLS inspection, configure FRP_TRUSTED_CA_FILE as described in Networks with TLS inspection.
- In DX, go to Admin → Data Cloud → Connections.
- Create a connection, or open an existing connection and select Edit connection.
- Under Custom certificate authority, select Configure custom certificate authority.
- Paste the root and intermediate CA certificates in PEM format. Include each complete
BEGIN CERTIFICATEthroughEND CERTIFICATEblock, concatenated in the same field. Do not include a private key. - Select Save. When editing an existing connection, DX verifies the updated certificate configuration before saving it.
To replace the certificate bundle, edit the field and save again. To remove it, clear the field and save.
Use the authoritative root and intermediate CA certificates provided by your security or PKI team. Avoid adding the source system’s leaf certificate because it typically changes when the certificate is renewed.
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:
- Go to Repository settings > Webhooks > Create Webhook
- For URL, enter https://yourinstance.getdx.net/webhooks/bitbucket_data_center with your unique subdomain
- Enter your webhooks secret from DX—this can be found and copied in the Connections admin page.
- Enable the following Pull Request events:
- Opened
- Modified
- Approved
- Declined
- Unapproved
- Merged
- (Optional) Test the connection by clicking on Test connection.
- Click save.
Here’s an example of what your settings should look like:

API reference
The table below lists the specific API endpoints that are used by DX.
| Endpoint | Documentation |
|---|---|
| /projects | Link |
| /projects/{key}/repos | Link |
| /projects/{project_key}/repos/{repo}/pull-requests | Link |
| /projects/{project_key}/repos/{repo}/pull-requests/{pull_request_source_id}/diff | Link |
| /projects/{project_key}/repos/{repo}/pull-requests/{pull_request_id}/activities | Link |
| /admin/users | Link |
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.
Replace YOUR_BITBUCKET_URL, YOUR_USERNAME, and YOUR_PASSWORD with your actual values before running these commands.
1. Test Projects Access
This verifies that your credentials can access projects:
curl -u YOUR_USERNAME:YOUR_PASSWORD -H 'Accept: application/json' 'YOUR_BITBUCKET_URL/rest/api/1.0/projects'
2. Test Users Access
This verifies that your credentials can access user information:
curl -u YOUR_USERNAME:YOUR_PASSWORD -H 'Accept: application/json' 'YOUR_BITBUCKET_URL/rest/api/1.0/admin/users'
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.
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. |
{
"id": 456,
"settings": {
"bitbucket_data_center_username": "dx-service-account"
},
"secrets": {
"bitbucket_data_center_password": "fake-password-here"
}
}