InTouch Hub · Blue Isle Software

Bitbucket

Manage Bitbucket repositories, pull requests, and pipelines via the Bitbucket Cloud REST API.

Provided free and as is, without warranty of any kind — including merchantability, fitness for a particular purpose, and the accuracy or completeness of any result. See the licence. You are responsible for checking what this produces before relying on it.

developer-devopsemailgitlogpipelinepipelinespullrequests

Bitbucket

Manage Bitbucket Cloud repositories, pull requests, and pipelines via the Bitbucket Cloud REST API.

Base URL: https://api.bitbucket.org/2.0
Auth: HTTP Basic — your Atlassian account email + a Bitbucket API token.


Operations

Operation Endpoint Description
list-repos GET /repositories/{workspace} List all repos in a workspace (newest first)
get-repo GET /repositories/{workspace}/{repoSlug} Get a single repository's metadata
list-prs GET /repositories/{workspace}/{repoSlug}/pullrequests List pull requests filtered by state
create-pr POST /repositories/{workspace}/{repoSlug}/pullrequests Open a new pull request
list-pipelines GET /repositories/{workspace}/{repoSlug}/pipelines List recent pipeline runs
trigger-pipeline POST /repositories/{workspace}/{repoSlug}/pipelines Trigger a pipeline on a branch

API Token Setup

  1. Log in to Bitbucket Cloud.
  2. Go to Personal settings (avatar menu) → Personal Bitbucket settingsAPI tokens.
  3. Click Create token, give it a name, and select the scopes you need:
  4. Repositories: Read — for list-repos, get-repo
  5. Pull requests: Read — for list-prs
  6. Pull requests: Write — for create-pr
  7. Pipelines: Read — for list-pipelines
  8. Pipelines: Write — for trigger-pipeline
  9. Copy the token — it is shown only once.
  10. In InTouch, use your Atlassian account email as username and the token as apiKey.

Input Parameters

Parameter Required Default Description
username yes Your Atlassian account email
apiKey yes Bitbucket API token
operation yes One of the operations listed above
workspace yes Workspace slug from your Bitbucket URL
repoSlug yes* Repository slug (*required for all ops except list-repos)
state no OPEN PR state filter: OPEN, MERGED, DECLINED, SUPERSEDED
title yes* PR title (*required for create-pr)
sourceBranch yes* Source branch (*required for create-pr)
destBranch no main Destination branch for create-pr
description no PR description for create-pr
pipelineBranch yes* Branch to run (*required for trigger-pipeline)

Examples

List repos in a workspace

[
  {
    "name": "list_repos",
    "type": "bitbucket",
    "input": {
      "username": "[email protected]",
      "apiKey": "{{credential.bitbucket_token}}",
      "operation": "list-repos",
      "workspace": "my-team"
    }
  }
]

Open a pull request

[
  {
    "name": "open_pr",
    "type": "bitbucket",
    "input": {
      "username": "[email protected]",
      "apiKey": "{{credential.bitbucket_token}}",
      "operation": "create-pr",
      "workspace": "my-team",
      "repoSlug": "my-service",
      "title": "feat: add retry logic",
      "sourceBranch": "feature/retry",
      "destBranch": "main",
      "description": "Adds exponential backoff to the HTTP client."
    }
  }
]

Trigger a pipeline

[
  {
    "name": "run_pipeline",
    "type": "bitbucket",
    "input": {
      "username": "[email protected]",
      "apiKey": "{{credential.bitbucket_token}}",
      "operation": "trigger-pipeline",
      "workspace": "my-team",
      "repoSlug": "my-service",
      "pipelineBranch": "main"
    }
  }
]

Output

Field Description
result Raw JSON response body from the Bitbucket API
status HTTP status code as a string (e.g. "200", "201", "401")
ok "true" if status is 2xx, "false" otherwise
operation The operation that was executed

Publishes

The keys a later task may reference as {{taskName.key}}. Referencing anything not listed here resolves to nothing at run time.

Input Properties

Every property this tool accepts, from its own tool.iml.

Property Type Required Default Description
username string yes Atlassian account email used to authenticate. Combined with apiKey for HTTP Basic auth.
apiKey string yes DEPRECATED — bind an API Key credential to the task with credentialName instead. A key pasted here is stored in the workflow definition in clear and appears in every export of it. Still honoured for workflows built before the change.
operation string yes One of: list-repos, get-repo, list-prs, create-pr, list-pipelines, trigger-pipeline
workspace string no Bitbucket workspace slug (required for all operations). Found in your workspace URL: bitbucket.org/{workspace}/.
repoSlug string no Repository slug (required for all operations except list-repos). The short identifier in the repo URL, e.g. 'my-service'.
state string no OPEN PR state filter for list-prs: OPEN, MERGED, DECLINED, or SUPERSEDED. Defaults to OPEN.
title string no Pull request title — required for create-pr.
sourceBranch string no Source branch name — required for create-pr.
destBranch string no main Destination branch name for create-pr. Defaults to 'main'.
description string no Pull request description — optional for create-pr.
pipelineBranch string no Branch to run the pipeline on — required for trigger-pipeline.