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
- Log in to Bitbucket Cloud.
- Go to Personal settings (avatar menu) → Personal Bitbucket settings → API tokens.
- Click Create token, give it a name, and select the scopes you need:
Repositories: Read— forlist-repos,get-repoPull requests: Read— forlist-prsPull requests: Write— forcreate-prPipelines: Read— forlist-pipelinesPipelines: Write— fortrigger-pipeline- Copy the token — it is shown only once.
- In InTouch, use your Atlassian account email as
usernameand the token asapiKey.
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.
errorokoperationresultstatus
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. |