> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/b/bitbucket-cloud.md).

# BitBucket Cloud

Bitbucket Cloud hosts Git repositories for Atlassian customers. OctoXLabs reads the repositories your account can reach as source code assets, and the workspace members as users.

## Use cases

* List private repositories (Source codes).

```
Adapters = bitbucket-cloud AND Visibility = Private
```

* Find repositories that are forks (Source codes).

```
Adapters = bitbucket-cloud AND IsForked = true
```

## Before you begin

### Network

| Source              | Destination       | Port | Protocol |
| ------------------- | ----------------- | ---- | -------- |
| OctoXLabs connector | api.bitbucket.org | 443  | HTTPS    |

### Required permissions

| Scope or role               | Permission | Needed for                                                          |
| --------------------------- | ---------- | ------------------------------------------------------------------- |
| Workspaces (App password)   | Read       | Workspace list and members                                          |
| Repositories (App password) | Read       | Repositories, branches, pull requests, commits, forks, source files |

## Create credentials in BitBucket Cloud

{% stepper %}
{% step %}

### Create a Bitbucket account

If you have none, create an Atlassian account with your email address.
{% endstep %}

{% step %}

### Create an app password

In Bitbucket, open **Settings > App passwords**. Create a password, give it a label and select the permissions you need, for example Read under Workspaces.
{% endstep %}

{% step %}

### Use it in OctoXLabs

Enter your Bitbucket username and the password or API token. They are sent together with Basic authentication.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter          | Required | Type    | Default | Description                                                             |
| ------------------ | -------- | ------- | ------- | ----------------------------------------------------------------------- |
| Username           | Yes      | String  |         | Personal Bitbucket username.                                            |
| API Token          | Yes      | String  |         | Personal API token or app password.                                     |
| HTTPS Proxy        | No       | String  |         | Proxy URL.                                                              |
| Per Page           | No       | Integer | 25      | Items per request.                                                      |
| Fetch Users        | No       | Boolean | True    | Collect workspace members as users.                                     |
| Fetch Source Codes | No       | Boolean | True    | Collect repositories as source code assets.                             |
| Timeout            | No       | Integer | 30      | Seconds to wait for API responses.                                      |
| Thread Count       | No       | Integer | 32      | Parallel threads for repository details. Min 1, max 32.                 |
| Sleep Time         | No       | Integer | 0       | Delay in seconds between thread batches. Raise it on rate limit errors. |

## Troubleshooting

| Error message                | Cause                                                                                                                                  | Fix                                                                                                  |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| Status Code: `, URL, Method` | The API answered with an unexpected HTTP status. The shared request code raises it and logs the status, URL, method and response body. | Check the URL, the credentials and the permissions listed above, then run the connection test again. |

## Change history

{% hint style="info" %}
Available starting from version 5.5.0.
{% endhint %}
