Lesstep
Bitbucket Cloud and Data Center · REST API · Checked November 2, 2026

Bitbucket pull requests from the command line

Bitbucket has no official command-line tool for pull requests, nothing like GitHub's gh pr create or the Azure CLI's az repos pr create. The Atlassian CLI (acli) has command groups for Jira, administration and Rovo Dev, and none for Bitbucket (its command reference). What works is one call to Bitbucket's REST API, which curl can make. The examples below follow Atlassian's API references for Bitbucket Cloud and Bitbucket Data Center 10.2.

Bitbucket Cloud

Create an API token with scopes, with Bitbucket as the app. For creating a pull request, Atlassian's reference lists read:pullrequest:bitbucket and write:pullrequest:bitbucket. With an API token, the user name for the REST API is your Atlassian account email, not your Bitbucket username (Using API tokens). You can also send the token as Authorization: Bearer, without the email.

curl --request POST \
  --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repository}/pullrequests' \
  --user 'you@example.com:{api_token}' \
  --header 'Content-Type: application/json' \
  --data '{
    "title": "Login page",
    "source": { "branch": { "name": "feature/login" } },
    "destination": { "branch": { "name": "main" } },
    "reviewers": [ { "uuid": "{504c3b62-8120-4f0c-a7bc-87800b9d6f70}" } ],
    "close_source_branch": true
  }'

Bitbucket Data Center

Create a personal HTTP access token and send it as Authorization: Bearer. Atlassian's reference says the account needs read permission (REPO_READ) on both repositories.

curl --request POST \
  --url 'https://bitbucket.example.com/rest/api/latest/projects/PRJ/repos/my-repo/pull-requests' \
  --header 'Authorization: Bearer {token}' \
  --header 'Content-Type: application/json' \
  --data '{
    "title": "Login page",
    "fromRef": { "id": "refs/heads/feature/login", "repository": { "slug": "my-repo", "project": { "key": "PRJ" } } },
    "toRef": { "id": "refs/heads/main", "repository": { "slug": "my-repo", "project": { "key": "PRJ" } } },
    "reviewers": [ { "user": { "name": "charlie" } } ]
  }'

When a reviewer is refused

One reviewer that Bitbucket will not take makes the whole call fail, and no pull request is created.

What the call does not do

Community tools wrap these same calls, such as the two above; none of them is from Atlassian.

Mention someone in a comment (Cloud)

Pull request comments mention people by their Atlassian account ID, written @{account ID} in the comment's raw text. The workspace's members list gives each member's account_id (Atlassian's knowledge base, How to @ mention users in Pull Request comments through the Bitbucket Cloud Rest API):

curl --user 'you@example.com:{api_token}' \
  https://api.bitbucket.org/2.0/workspaces/{workspace}/members

curl --request POST --user 'you@example.com:{api_token}' \
  --header 'Content-Type: application/json' \
  --data '{"content": {"raw": "@{557058:0a1b2c3d} please take a look"}}' \
  https://api.bitbucket.org/2.0/repositories/{workspace}/{repository}/pullrequests/{id}/comments

Changed files, and merged pull requests between two branches (Cloud)

The files a pull request changes are in its diffstat, the address in links.diffstat.href of the pull request; Bitbucket redirects it to the repository's diffstat, so let curl follow (Atlassian's knowledge base, Find list of changed files within a Pull Request). Each entry gives the status, the lines added and removed, and the old and new path:

curl --location --user 'you@example.com:{api_token}' \
  https://api.bitbucket.org/2.0/repositories/{workspace}/{repository}/pullrequests/{id}/diffstat

The list of pull requests returns only open ones unless you ask with state, so for the ones merged from one branch into another, add state=MERGED and filter both branches in q (Pull requests in the REST API reference; the knowledge base's version):

curl --get --user 'you@example.com:{api_token}' \
  --data-urlencode 'state=MERGED' \
  --data-urlencode 'q=source.branch.name="feature/one" AND destination.branch.name="main"' \
  --data-urlencode 'fields=values.id,values.title,values.merge_commit.hash' \
  https://api.bitbucket.org/2.0/repositories/{workspace}/{repository}/pullrequests

Creating Bitbucket pull requests from IntelliJ IDEA

Pull Request Inbox for Bitbucket, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, adds Git → Create Bitbucket Pull Request… for Bitbucket Cloud and Data Center. It opens a pull request from the branch you are on, into the repository's main branch unless you pick another, optionally as a draft. It asks the default reviewers itself, on Cloud and on Data Center, leaving you out, and offers people from the repository's recent pull requests. If Bitbucket still refuses one of them, it creates the pull request without them and shows Bitbucket's reason. If the branch is not on Bitbucket yet, it says so and opens the IDE's push dialog first. Creating, approving and merging pull requests are Pro (US$1.50 a month, with a 30-day trial); the review inbox is free.

Get it on JetBrains Marketplace

Bitbucket, Jira and Rovo are trademarks of Atlassian; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by Atlassian or JetBrains.

More: "This API is not accessible by this authentication mechanism" · git push without "Create pull request for" · "Something went wrong" when creating a pull request (Cloud) · Check out a Bitbucket pull request locally · Bitbucket default reviewers · Bitbucket draft pull requests · 日本語