Manage Bitbucket repositories, pull requests, and pipelines via the Bitbucket Cloud REST API.
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 — for list-repos, get-repo
- Pull requests: Read — for list-prs
- Pull requests: Write — for create-pr
- Pipelines: Read — for list-pipelines
- Pipelines: Write — for trigger-pipeline
- Copy the token — it is shown only once.
- 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 |