# On-Premises BitBucket

### Prerequisites

* The server's IP address, where the agent will be running, must be whitelisted in Bitbucket Cloud/Server.

## **Follow these steps to seamlessly integrate with BitBucket:**

## **Step 1. Generate an API Token**

1. Navigate to **Settings > Manage accounts** in BitBucket.

   <figure><img src="https://4171758421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS4rgvJ71tpXan8RhYTT4%2Fuploads%2Fgit-blob-7d4f406474b2bfdb5ca23381996dbabb88f4be41%2Fon-premises-bitbucket-click-manage-account.png?alt=media" alt=""><figcaption></figcaption></figure>
2. Click on `HTTP access tokens`.<br>

   <figure><img src="https://4171758421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS4rgvJ71tpXan8RhYTT4%2Fuploads%2Fgit-blob-a90ef3dd0f052843fe348477767364512069fe4d%2Fon-premises-bitbucket-goto-http-access-tokens.png?alt=media" alt=""><figcaption></figcaption></figure>
3. Click on `Create token`.<br>

   <figure><img src="https://4171758421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS4rgvJ71tpXan8RhYTT4%2Fuploads%2Fgit-blob-2e78260c2be7a7dec03da95f57d8b7d57b4b2734%2Fon-premises-bitbucket-click-create-token.png?alt=media" alt=""><figcaption></figcaption></figure>
4. Provide a name for the token, such as `dd-api-token`.
5. Give read access to `projects` and `repositories`.
6. Set the token to `Do not expire`.

   * **Note: if the token expires, you'll have to perform the integration once again!!**

   <figure><img src="https://4171758421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS4rgvJ71tpXan8RhYTT4%2Fuploads%2Fgit-blob-6d9b78adc616067e617a81648e7ff034ca492691%2Fon-premises-bitbucket-fill-create-token-form.png?alt=media" alt=""><figcaption></figcaption></figure>
7. Copy the generated token.

   <figure><img src="https://4171758421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS4rgvJ71tpXan8RhYTT4%2Fuploads%2Fgit-blob-44fa998f5e2f7b9e29821e9ab96503ee5d86157f%2Fon-premises-bitbucket-copy-generated-token.png?alt=media" alt=""><figcaption></figcaption></figure>

## **Step 2. Install On-Premises Agent**

* You can refer [On-Premises Agent Installation](https://docs.devdynamics.ai/installations/on-premises-agent-installation-guide) Guide to successfully setup agent.

With these steps completed, the integration with on-premises BitBucket is successfully done!!
