Bitbucket Cloud Commits (Default branch)
By integrating Bitbucket Cloud Commits (Default branch) with DX, you can analyze pull requests, and repositories 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 Cloud Commits (Default branch) to DX, you need:
- a Workspace Access Token
- if you cannot create a Workspace Access Token, create an API Token instead
Setup instructions
Follow the steps below to connect Bitbucket Cloud to DX.
Data connection
Step 1
Before setting up a connection for Bitbucket Cloud Commits (Default branch), first set up a Bitbucket connection.
Step 2
- If using a Workspace Access Token, create a token for DX that includes the following scopes:
- repository
- Or, if using an API Token, create a token for DX that includes the following scopes:
read:repository:bitbucket
Step 3
- 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.
- If using a Workspace Access Token, select the
API tokenauthentication method - If using an API Token, select the
Basic authauthentication method
- If using a Workspace Access Token, select the
- Please note that your workspace name should be first path in the URL, i.e., if your workspace URL is
https://bitbucket.org/myworkspace/, your workspace name ismyworkspace.
API reference
The table below lists the specific API endpoints that are used by DX.
| Endpoint | Documentation |
|---|---|
| repositories/{workspace_name}/{repository_slug}/commits | 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 Cloud connection, it checks access to workspace repositories. If your connection is failing, you can test these endpoints directly using the curl commands below to troubleshoot the issue.
Replace YOUR_WORKSPACE_NAME and authentication credentials with your actual values before running these commands.
Choose your authentication method:
Workspace Access Token: Use -H 'Authorization: Bearer YOUR_WORKSPACE_TOKEN'
API Token: Use -u ATLASSIAN_ACCOUNT_EMAIL:API_TOKEN
1. Test Workspace Repositories Access
This verifies that your credentials can access repositories in your workspace:
With Workspace Access Token:
curl -H 'Authorization: Bearer YOUR_WORKSPACE_TOKEN' -H 'Accept: application/json' 'https://api.bitbucket.org/2.0/repositories/YOUR_WORKSPACE_NAME'
With API Token:
curl -u ATLASSIAN_ACCOUNT_EMAIL:API_TOKEN -H 'Accept: application/json' 'https://api.bitbucket.org/2.0/repositories/YOUR_WORKSPACE_NAME'
If you receive a 401 Unauthorized error, your credentials are invalid. If you receive a 403 Forbidden error, your token doesn’t have the required permissions. If you receive a 404 Not Found error or empty results, check that your workspace name is correct.
Note about Authentication: The -u ATLASSIAN_ACCOUNT_EMAIL:API_TOKEN flag uses curl’s built-in basic authentication, which automatically handles the Base64 encoding required for Bitbucket authentication. For workspace access tokens, use the Bearer token format as shown above.
Data Cloud API
Once the initial connection is created successfully, credentials can be managed via the Data Cloud API. This connector uses the same credential fields as Bitbucket Cloud (settings.username, secrets.api_token, or secrets.password).