What Atlassian shipped

Atlassian added a Pull Request Mergeability endpoint to the Bitbucket Cloud REST API. The developer changelog entry dated 26 November 2026 says the endpoint gives tools and AI assistants one combined view of what's stopping a pull request (PR) from merging. The announcement on the Inside Atlassian blog ran on 23 November. Before this, a bot that wanted to explain a stuck PR had to piece the answer together from approvals, tasks, build statuses and conflict information. Atlassian's own TWG CLI has had a mergeability command since version 1.3.3 on 28 September 2026. The public REST endpoint opens the same data to any integration.

This guide covers what the endpoint returns, how to call it with an API token, and how to shape the output for a language model that answers "why can't I merge this?" in a team chat or a dashboard.

The endpoint and what it checks

The Bitbucket Cloud OpenAPI specification defines the operation as:

GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/mergeability/checks

The spec describes the checks as a simulation of what the merge endpoint verifies before merging. The response is a pullrequest_mergeability_checks object with a size and a values array. Each entry in values carries four required fields: type, status, required and blocking. status is one of PASSED, FAILED, PENDING, SKIPPED or UNKNOWN. The type field takes seven values:

  • pullrequest_state_check: the PR's state (OPEN, DRAFT, MERGED, DECLINED, SUPERSEDED or UNKNOWN).
  • current_user_permission_check: whether the calling user may merge.
  • git_mergeability_check: a reason of clean, conflicts or merge_impossible.
  • standard_merge_check: configured rules such as approvals, unresolved tasks, builds, change requests and branch freshness, each with check, requirement and observed objects.
  • custom_pre_merge_check and custom_on_merge_check: results from activated custom merge checks, with a message string.
  • merge_queue_check: whether the PR is queued, plus the queue's name and state.

A builder should read the blocking flag before status. The spec says a failed check doesn't always block a merge, so a bot that reports every FAILED entry as a blocker will mislead people. The standard_merge_check objects are the most useful for explanations because requirement and observed put the rule next to the current value, such as the number of approvals required against the number given.

Calling it with an API token

Bitbucket's API token documentation says tokens used against Bitbucket APIs must have scopes. The OpenAPI spec lists the Forge scope read:pullrequest:bitbucket (and the OAuth 2.0 scope pullrequest) for this operation, so a read-only token is enough. The docs show basic authentication with your Atlassian account email and the token. We've used that same pattern with the mergeability path:

curl --request GET \
  --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/mergeability/checks' \
  --user '{atlassian_account_email}:{api_token}' \
  --header 'Accept: application/json'

The token docs also describe a Bearer header (Authorization: Bearer {api_token}), which removes the need to send the email address.

Two checks can be expensive to compute on big repositories. The spec allows a limited q filter that accepts only type!="git_mergeability_check" and check.kind!="maximum_commits_behind", joined with AND. Any other expression returns a 400. The TWG CLI changelog warns that skipping those checks means the result no longer establishes full mergeability. A bot that drops them should say so in its answer.

To try the same data from a terminal first, the TWG CLI command is:

twg bb pull-requests mergeability <id>

Building the explainer

A minimal "what's blocking this PR" assistant needs four steps, all built on documented behaviour:

  1. Fetch the PR's checks with the request above. The spec adds a mergeability_checks link to the pullrequest object's links, so code that already loads the PR can follow that link instead of building the URL by hand.
  2. Filter values to entries where blocking is true. Keep non-blocking failures in a separate list as advisory items.
  3. Pass the filtered JSON to a model with a short instruction to explain each blocker in plain language and suggest who acts next. A standard_merge_check with a missing approval points at reviewers, a git_mergeability_check with conflicts points at the author, and a current_user_permission_check failure points at a repository admin.
  4. Post the answer back to the PR as a comment, or to a chat channel, and re-run on a schedule or on a webhook.

Step 3 is where most of the value comes from. The structured fields mean the model doesn't have to guess at the state of the PR. Its job is limited to turning requirement and observed into a sentence, which a small, cheap model can handle. Keeping the model's input to the blocking entries also keeps token costs predictable on repositories with many merge checks.

For agents that already talk to Atlassian through MCP (the Model Context Protocol, a standard way to expose tools to language models), the blog post says the checks are reachable through Atlassian MCP. The Atlassian MCP supported tools list doesn't name a dedicated mergeability tool as of 29 November, though. Until the list names one, the REST call is the reliable route. One option is to wrap the REST call as your own tool for an agent framework.

Limits and costs

The endpoint is read-only. The announcement says it neither merges the PR nor triggers custom checks. The spec says the list isn't exhaustive. Conditions that can only be tested by attempting the merge, such as dependency-merge requirements, are left out. A clean result is a strong signal and nothing more, so a bot shouldn't promise that a merge will succeed. PRs already in a merge queue skip the Git and other merge checks, and the endpoint returns a 500 when Bitbucket can't fetch custom merge check results. Your code should treat that error as "unknown" and avoid reporting it as a pass.

Atlassian's pages don't mention a separate charge for the endpoint. The constraint that matters is rate limits. Bitbucket's API request limits page counts authenticated requests per user over a rolling hour. Repository data under /2.0/repositories/* gets between 1,000 and 10,000 requests an hour, and higher allowances apply only to Standard or Premium workspaces with 100 or more paid users that use workspace, project or repository access tokens. A watcher that polls every open PR every minute will hit the base limit quickly. Triggering on PR webhooks, or polling only PRs that changed, keeps a small team's bot well inside the allowance. The current_user_permission_check also reflects whoever owns the token, so run the bot under an account that has the same merge rights as your developers. Otherwise the permission results won't match what developers see.

What NZ teams can do with it

Teams in Auckland running Bitbucket Cloud can build this today with an API token and a few dozen lines of glue code. The explainer suits small teams where one person ends up chasing stuck PRs. Running it for a week would show where PRs stall, whether that's approvals, builds or conflicts. If you build one, you can share it on ASAI's projects page.

Sources

Build with people working on the same things

Join the Auckland Society for AI: NZ$599 a year with a ForgeBox and the members' projects area. Our Auckland meetups are open to everyone.

Become a member