canonical: https://jentic.com/apis/bitbucket.org/bitbucket

# Bitbucket API

The Bitbucket API manages Git repositories, code review, and continuous integration across a workspace. It lists and administers repositories, opens and merges pull requests, and reads commits and their comments so an agent can drive a code-review flow. It also creates and tracks issues, triggers and inspects Pipelines builds, and manages branch restrictions, webhooks, and repository settings. The surface is organised around workspaces and repositories addressed in the URL path, covering the full lifecycle of hosted Git repositories, pull requests, and CI pipelines rather than project-portfolio or documentation tooling.

## For AI agents

Drive Bitbucket source control: list repositories, open and merge pull requests, read commits, manage issues, and trigger and inspect Pipelines builds.

## Scope

Does not handle cross-project portfolio reporting, external CI runners, or user identity management. Use for Bitbucket repositories, pull requests, issues, and Pipelines only.

## Capabilities

- List and administer repositories within a workspace
- Open, list, and merge pull requests on a repository
- Read commits and post commit comments during code review
- Create and track issues on a repository's issue tracker
- Trigger Pipelines builds and inspect their status
- Manage branch restrictions and repository configuration

## Use cases

### AI agent pull-request automation

An AI coding agent needs to open and manage pull requests as part of a change workflow without a developer clicking through the Bitbucket UI. Through Jentic the agent opens a pull request on a repository, reads its state, and merges it once checks pass. Because repositories are addressed by workspace and repository in the URL path, a rule can pin the agent to a single repository for the whole flow.

Example prompt: Search Jentic for 'open a Bitbucket pull request', call POST `/repositories/{workspace}/{repo_slug}/pullrequests` to open it, then POST `/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/merge` once it is approved.

### CI build orchestration

A release workflow needs to kick off a Bitbucket Pipelines build and report its outcome. The pipelines endpoints trigger a build for a repository and return its status, so an agent can start a build after merging and surface success or failure. This lets a team run deploys from chat or an agent instead of the Bitbucket console.

Example prompt: Call POST `/repositories/{workspace}/{repo_slug}/pipelines` to trigger a build, then poll GET `/repositories/{workspace}/{repo_slug}/pipelines` to read its status.

### Issue triage from reports

A support-to-engineering workflow needs to turn user reports into tracked issues on the right repository. The issues endpoints create and list issues, so an agent can file a well-formed issue and check whether a similar one already exists. This keeps bug reports flowing into the repository's tracker without manual copying.

Example prompt: Call GET `/repositories/{workspace}/{repo_slug}/issues` to check for duplicates, then POST `/repositories/{workspace}/{repo_slug}/issues` to file the new report.

### Release note assembly from commits

A release workflow needs to summarise what changed since the last tag. The commits endpoint returns the commit history for a repository, so an agent can gather commit messages and assemble draft release notes. Pairing it with the pull-request list shows which merged pull requests contributed those commits.

Example prompt: Call GET `/repositories/{workspace}/{repo_slug}/commits` to read recent commits, then GET `/repositories/{workspace}/{repo_slug}/pullrequests` to attribute them to merged pull requests.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/repositories/{workspace}` | List repositories in a workspace |
| GET | `/repositories/{workspace}/{repo_slug}` | Get a repository |
| POST | `/repositories/{workspace}/{repo_slug}/pullrequests` | Open a pull request |
| POST | `/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/merge` | Merge a pull request |
| GET | `/repositories/{workspace}/{repo_slug}/commits` | List commits |
| POST | `/repositories/{workspace}/{repo_slug}/issues` | Create an issue |
| POST | `/repositories/{workspace}/{repo_slug}/pipelines` | Trigger a Pipelines build |
| GET | `/repositories/{workspace}/{repo_slug}/pipelines` | List Pipelines builds |

## Why Jentic

- **Setup:** Wiring the Bitbucket API by hand means choosing among OAuth2, basic, and apikey credentials, then addressing every call by workspace and repository yourself. Through Jentic you install once, import it from the API Directory, store the credential once, and your agent calls it.
- **Permission scoping:** Bitbucket puts the workspace and repository in the URL path (`/repositories/{workspace}/{repo_slug}/...`), so a rule can pin your agent to one repository: it can read and open pull requests there and nothing outside it. You choose the operations it may call, so destructive ones like repository deletion or branch-restriction changes are not included unless you add them.
- **Credential handling:** Your Bitbucket credential is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'open a pull request' or 'trigger a Pipelines build', and Jentic returns the matching Bitbucket operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **GitHub** — GitHub is the leading alternative hosted Git platform with repositories, pull requests, and Actions CI
- **GitLab** — GitLab offers Git hosting, merge requests, and built-in CI as an alternative to Bitbucket
- **CircleCI** — CircleCI runs external CI pipelines that can build and deploy Bitbucket repositories
- **Jira** — Jira tracks the issues and sprints that Bitbucket pull requests and commits deliver against
- **Snyk** — Snyk scans Bitbucket repositories for vulnerabilities during code review and CI

## FAQ

### Is there a Bitbucket API MCP server?

You don't need an MCP server to give your agent the Bitbucket API. Jentic connects it directly from the API Directory: import it, store your credential once, and your agent opens pull requests, triggers builds, and reads commits on demand without loading another server's tool definitions into its context.

### What authentication does the Bitbucket API use?

The Bitbucket API supports OAuth2, HTTP basic authentication, and an apikey credential sent in the Authorization header, per its OpenAPI spec. When you call it through Jentic, whichever credential you configure is stored encrypted by your own Jentic One instance and injected at execution time, so it never appears in the agent's prompt or logs.

### Can I open and merge pull requests with the Bitbucket API?

Yes. POST `/repositories/{workspace}/{repo_slug}/pullrequests` opens a pull request on a repository, and POST `/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/merge` merges it once it is approved, so an agent can run a full review-to-merge flow scoped to one repository.

### What are the rate limits for the Bitbucket API?

The OpenAPI spec does not specify rate limits for the Bitbucket API. Bitbucket applies per-account and per-endpoint request limits, so check the provider's documentation at https://support.atlassian.com/bitbucket-cloud for current limits before running high-volume automation.

### How do I open a pull request through Jentic?

Search Jentic for 'open a Bitbucket pull request', load the matching operation, and call POST `/repositories/{workspace}/{repo_slug}/pullrequests` with the source and destination branches. To run it on your own infrastructure, install Jentic One from its GitHub repo.

### Can I limit what my agent is allowed to do with the Bitbucket API?

Yes. Write a rule that allows only the pull-request read and create operations under one workspace and repository path, so the agent can list and open pull requests for that repo and touch nothing else. Destructive operations like repository deletion or branch-restriction changes stay out unless you add them, and every call is logged.
