# Bitbucket Integration Setup

### Getting Started <a href="#h_01h9ktqg11tjdq3b4rwjd6s8kw" id="h_01h9ktqg11tjdq3b4rwjd6s8kw"></a>

BalkanID recommends creating a separate service account for the purposes of this integration, instead of using personal or employee named accounts.&#x20;

{% hint style="warning" %}
Two extra configuration fields were introduced recently namely,`Bitbucket App Password` and `Bitbucket Account Username` , which utilizes v1 APIs and requires different credentials, steps have been mentioned below.&#x20;

Workspace access token needs new additional scopes namely, `Projects > Admin, and Repositories > Admin.`&#x20;

Since these are breaking changes to the integration, if you already have an existing Bitbucket integration, you would need to delete the current Bitbucket integration and add a new app Integration for Bitbucket. \
\
![](/files/IUl5FIGkO9AAW7Uw9LNd)
{% endhint %}

#### Requirements: <a href="#h_01hq2kk4rs2swrg2rgymrd6pz5" id="h_01hq2kk4rs2swrg2rgymrd6pz5"></a>

* ***Bitbucket Access token of Workspace (Organization)***
* ***Bitbucket API Url (example: “***[***https://api.bucket.org***](https://api.bucket.org/)***”)***
* ***Username of Workspace ID (example: “myworkspace”)***
* ***Bitbucket Account Username (example: "janesmith")***
* ***BitBucket App Password***

#### Get Access Token of Workspace <a href="#h_01h9ktqg11d5a5dy2s0tj83q8z" id="h_01h9ktqg11d5a5dy2s0tj83q8z"></a>

1. On the Bitbucket Workspace Page, navigate to *Settings*.<br>

   <figure><img src="/files/BNsoyIxV3ONREkBKXIOo" alt=""><figcaption></figcaption></figure>
2. Go To *Access Tokens*.<br>

   <figure><img src="/files/Xub3f0xXk59Ya1iNmq6h" alt=""><figcaption></figcaption></figure>
3. Click on **Create Workspace Access Token.**
4. Give the following Perms `Accounts > Read`,`Repositories > Read` and `Projects > Read`.<br>

   <figure><img src="/files/zKqVb7HEgYqQbgifMVFG" alt="" width="375"><figcaption></figcaption></figure>
5. Copy the *Workspace Access Token*.<br>

   <figure><img src="/files/7zICuUPOWo86gVavCUuD" alt=""><figcaption></figcaption></figure>
6. Store the generated Access Token securely.

#### Get Workspace ID <a href="#h_01hq2knrttgewvx6ytnja7xy84" id="h_01hq2knrttgewvx6ytnja7xy84"></a>

1. Go to the *Workspace settings*.<br>

   <figure><img src="/files/R5ULpzgpW47EWsWql8wo" alt=""><figcaption></figcaption></figure>
2. Copy the *Workspace ID.*<br>

   <figure><img src="/files/JAotWzTxFEKPUexK7Fw8" alt=""><figcaption></figcaption></figure>
3. Store the Workspace ID in a secure location.

#### Get Bitbucket  Account Username  <a href="#h_01h9ktqg1169gs6vzdpxq68s55" id="h_01h9ktqg1169gs6vzdpxq68s55"></a>

1. This is your account username, You can go to <https://bitbucket.org/account/settings/> and copy your username under Bitbucket Profile Settings

   <figure><img src="/files/eIPVy7rdAcGGHiprOTjY" alt=""><figcaption></figcaption></figure>

#### Get Bitbucket Account App Password <a href="#h_01h9ktqg1169gs6vzdpxq68s55" id="h_01h9ktqg1169gs6vzdpxq68s55"></a>

1. Go to <https://bitbucket.org/account/settings/app-passwords/> or  Settings > Bitbucket Personal Settings > Access Management > App Password

   <figure><img src="/files/cvSRzMRqUdHhRKIK7aUU" alt="" width="188"><figcaption></figcaption></figure>
2. Click on Create App Password and give the respective permissions.

   <figure><img src="/files/Cq9gSXzUhrLlWNRiRweR" alt="" width="563"><figcaption></figcaption></figure>
3. Copy the App Password somewhere securely

#### Get Bitbucket URL <a href="#h_01h9ktqg1169gs6vzdpxq68s55" id="h_01h9ktqg1169gs6vzdpxq68s55"></a>

<figure><img src="/files/IMSoZwVPAuU1oj9OFFTM" alt=""><figcaption></figcaption></figure>

To configure your integration, paste the URL in the following format: `https://api.your_bitbucket_domain.org`.

Simply replace `your_bitbucket_domain.org` with the actual domain URL of your Bitbucket instance as shown in the image.

### Configure Bitbucket within your BalkanID tenant <a href="#h_01h9ktqg118b9fxxyxcjbtp8km" id="h_01h9ktqg118b9fxxyxcjbtp8km"></a>

1. Login to the BalkanID application and switch to the tenant you would like to add your integration to.
2. Head to *Integrations* > **Add Integration**, select **Bitbucket**.<br>

   <figure><img src="/files/McjLF5Ym1K9qtPjCP439" alt=""><figcaption></figcaption></figure>

   <figure><img src="/files/NvCcnGauAp8nHGzzAbUH" alt=""><figcaption></figcaption></figure>
3. Set up the *Primary Application owner (mandatory)* and the *Description*, if any. Set up Secondary Application Owner(s), if any. <br>

   Select the Extraction Type. From here, you can configure your application using one of the following methods:

   1. **Direct integration** - Provide your Bitbucket Access Token, URL, Workspace, Account Username and Account App Password obtained above to set up a direct connection with BalkanID.
   2. **SCIM integration** - Provide SCIM server credentials to set up a SCIM connection with BalkanID.&#x20;
   3. **Manual file upload** - Upload Entity and Entity Relations through a .CSV file upload. Contact the team for assistance with this. &#x20;
   4. **Automated upload using API -** You can upload data using our [Bulk APIs](https://developer.balkan.id/) with the help of an API key which will be provided to you. Please refer to the [entity](https://developer.balkan.id/bulk-entities-upload-api-early-access-12828095e0) and [entity relation](https://developer.balkan.id/bulk-entity-relations-upload-api-early-access-12828102e0) upload docs for specific instructions on uploading your data through the API.&#x20;

   <figure><img src="/files/XfQ56fIvooPw2VWbfEpq" alt="" width="563"><figcaption></figcaption></figure>
4. Click on next to move onto *Optional Configuration.*
5. Fill **Optional configuration,** if required.  <br>

   <figure><img src="/files/hEYrxYyaWzDoo1ItfjBJ" alt="" width="563"><figcaption></figcaption></figure>
6. Once you filled in the information, click **Save**. Your integration is now configured and you will see the status of the integration displayed alongside other integrations on the *Integrations* page. When data is available, the integration Status column will read **Connected** and the integration Message will read **Data available**.

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.balkan.id/getting-started/setting-up-your-tenant/application-integrations/direct-application-integration/bitbucket-integration-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
