> For the complete documentation index, see [llms.txt](https://docs.winga.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.winga.me/import-guides/importing-from-bitbucket.md).

# Importing from Bitbucket

Winga can read a Bitbucket repository's pipeline variables and turn them into feature flags. This guide covers connecting Bitbucket to your workspace and running the import.

***

### 1. Connect Bitbucket

Open your workspace and go to **Connections** from the workspace navigation. On the Connections page, find the **Bitbucket** card under *Available integrations* and press **Connect**.

Bitbucket connects through **OAuth**. A short pre-flight dialog reminds you to make sure you're signed into the correct Bitbucket account at `bitbucket.org` before continuing, then redirects you to Bitbucket to authorize the connection. After you approve, Bitbucket returns you to Winga and you confirm which account was connected. You need the **owner** or **admin** role in the workspace to add or remove a connection.

> **OAuth scopes are subject to change.** Winga requests the minimum scopes needed to read your pipeline variables. In particular, the `account` scope may be dropped after live verification confirms it is not required by the Bitbucket pipeline variables API. Do not treat the current scope set as final.

***

### 2. Start the import

The import wizard lives on a project's **Flags** page. Open the project you want to import into, go to its **Flags** page, and start an import. Choose **Import from Bitbucket**, then pick the repository to import from. Bitbucket repositories are identified by a `<workspace>/<repo-slug>` path.

***

### 3. How pipeline variables are partitioned

Winga reads your repository's pipeline variables from the Bitbucket API and splits them into two groups based on each variable's `secured` flag:

* **Unsecured variables** import **with their values**. Bitbucket returns the value for these, so their parsed value can be seeded as the flag's default if you choose to import values.
* **Secured variables** import as **name only**. Bitbucket never returns the plaintext of a secured variable through its API, so Winga imports the key with an empty value. You set the real value yourself after the flag is created.

Because of this split, the **Import values too** option in the configure step is only available when the repository has at least one unsecured variable. A repository with only secured variables imports the names so you can recreate the flags, and you fill in values manually.

***

### 4. Review and configure

After the variables are fetched, the review step lists every key. Deselect any you don't want, then move to the configure step to:

* choose which environments the imported flags are enabled in, and
* optionally import the parsed values as flag defaults (off by default — only enable this for test or example values, never production secrets).

Press **Import** to create the flags.
