Everything an AI agent can do with the Bitbucket API.

A reference guide for building AI agents: every method, how to authenticate, and the permissions each one needs.

Endpoints38
API version2.0
Last updated23 June 2026
Orientation

How the Bitbucket API works.

The Bitbucket API is how an app or AI agent works with a Bitbucket Cloud workspace: reading repositories and commits, opening and merging pull requests, creating and updating issues, and running build pipelines. Access is granted through a token and a set of scopes that decide what each call can read or write, and an agent is limited to the workspaces and repositories that token reaches. Bitbucket can also push events to a webhook URL when something happens in a repository.

38Endpoints
9Capability groups
21Read
17Write
12Permissions
Authentication
Every write and most private reads need a token. Bitbucket Cloud supports OAuth 2.0, where an app exchanges an authorization code for a bearer token sent as 'Authorization: Bearer ', and API tokens and repository or workspace access tokens for scripts and automation. App passwords, the older Basic-auth credential, stop creating on 9 September 2025 and stop working entirely on 9 June 2026, so new integrations should use API tokens or OAuth. As of 4 May 2026 all OAuth-authenticated requests must go to one host with the token in the Authorization header.
Permissions
Bitbucket uses OAuth 2.0 scopes to gate each endpoint, and a request must carry the scope the endpoint requires. Reads use a base scope such as repository, pullrequest, issue, or pipeline; writes need the matching write scope, such as repository:write, pullrequest:write, or issue:write. Some actions need more: creating or updating a repository needs repository:admin, and managing webhooks needs webhook. A scope applies across every workspace and repository the token can see, so the token's reach, not the scope alone, sets the boundary.
Versioning
The Bitbucket Cloud REST API exposes a single version, 2.0. Bitbucket does not issue new dated versions of this API, so changes arrive as additive endpoints and fields, or as announced deprecations with their own timelines, rather than a version bump. The largest current migration is the move from app passwords to API tokens, finishing on 9 June 2026.
Data model
The API is resource-oriented JSON over HTTPS at one host. Most resources nest under a workspace and a repository, identified by a repo_slug, covering pull requests, commits, branches, issues, pipelines, and webhooks, while account-level resources include the current user, workspaces, and the projects inside a workspace. Many objects are addressed by a UUID, and list responses use a cursor-paged envelope with a next link.
Connect & authenticate

Connection & authentication methods.

How an app or AI agent connects to Bitbucket determines what it can reach. There are several routes, each governed by the token behind it and the scopes that token carries.

Ways to connect

REST API

The Bitbucket Cloud REST API answers at https://api.bitbucket.org/2.0 and returns resource-oriented JSON over HTTPS. It is the main way an app or AI agent reads and changes repositories, pull requests, issues, and pipelines.

Best forConnecting an app or AI agent to Bitbucket.
Governed byThe token and the OAuth scopes it carries.
Docs ↗

Atlassian Rovo MCP server (Model Context Protocol)

The Atlassian Rovo MCP Server is generally available and supports Bitbucket Cloud, letting an AI client browse repositories, create commits, open pull requests, and check pipeline results over the Model Context Protocol. It is hosted by Atlassian at https://mcp.atlassian.com/v1/mcp, and Bitbucket Cloud tools currently use API token authentication enabled by an organization admin.

Best forConnecting an AI agent to Bitbucket over MCP.
Governed byThe token and the OAuth scopes it carries.
Docs ↗

Webhooks

Webhooks deliver the chosen repository events to a receiver URL, so an app or AI agent is told when something happens instead of polling. When a secret is set, the X-Hub-Signature HMAC header on each delivery confirms it came from Bitbucket.

Best forReceiving repository events without polling.
Governed byThe webhook scope and the token that registered the webhook.
Docs ↗
Authentication

OAuth 2.0

An OAuth 2.0 app exchanges an authorization code for a short-lived bearer token tied to the scopes the user granted, and refreshes it as needed. It is the fit for an app acting on behalf of a user, since access is limited to the granted scopes and can be revoked. From 4 May 2026 these requests must be sent to api.bitbucket.org with the token in the Authorization header.

TokenOAuth bearer token
Best forApps acting on behalf of a user
Docs ↗

API token

An API token is used with Basic authentication, where the username is the Atlassian account email and the password is the token. It must be created with an expiry of up to one year and can carry chosen scopes. It is the replacement for app passwords in scripts and CI jobs.

TokenScoped API token
Best forScripts and CI jobs
Docs ↗

Repository, project, and workspace access tokens

An access token is a single-purpose bearer token bound to one repository, project, or workspace, with its own scopes and no tie to a user account. It suits automation that should act on just one resource, since its reach is fixed to that resource.

TokenResource-scoped bearer token
Best forAutomation scoped to one resource
Docs ↗

App password (deprecated)

An app password is the older Basic-auth credential, a single-purpose password with chosen permissions. It is being retired: no new ones can be created from 9 September 2025, and all stop working on 9 June 2026, so it should not be used for new integrations.

TokenBasic-auth app password
Best forLegacy integrations only, being retired
Docs ↗
Capability map

What an AI agent can do in Bitbucket.

The Bitbucket API is split into areas an agent can act on, such as repositories, pull requests, commits, branches, issues, and pipelines. Each area has its own methods and its own scopes, and some grant access to far more than others.

Endpoint reference

Every Bitbucket API method.

Filter by method, access, or permission, or search any path. Select a row for version detail, rate limits, the related webhook event, and the source.

MethodEndpointWhat it doesAccessPermissionVersion

Repositories

List the repositories in a workspace, read a single repository, and create or update one.4

The repository scope grants read access to every repository the token can see in the workspace.

Acts onrepository
Permission (capability)repository
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit1,000 to 10,000 requests per hour

The baseline read scope for repository data.

Acts onrepository
Permission (capability)repository
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit1,000 to 10,000 requests per hour

Creating a repository needs repository:admin, not just repository:write.

Acts onrepository
Permission (capability)repository:admin
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Updating repository settings needs repository:admin.

Acts onrepository
Permission (capability)repository:admin
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Pull requests

List, read, create, and update pull requests, merge, approve, decline, and request changes, and list and create their comments and commits.12

The pullrequest scope also grants the repository scope's read access.

Acts onpull request
Permission (capability)pullrequest
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Read access to one pull request.

Acts onpull request
Permission (capability)pullrequest
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Creating a pull request needs pullrequest:write.

Acts onpull request
Permission (capability)pullrequest:write
VersionAvailable since the API’s base version
Webhook eventpullrequest-created
Rate limitStandard limits apply

Editing a pull request needs pullrequest:write.

Acts onpull request
Permission (capability)pullrequest:write
VersionAvailable since the API’s base version
Webhook eventpullrequest-updated
Rate limitStandard limits apply

Merging commits to the destination branch and needs pullrequest:write.

Acts onpull request
Permission (capability)pullrequest:write
VersionAvailable since the API’s base version
Webhook eventpullrequest-fulfilled
Rate limitStandard limits apply

Recording an approval needs pullrequest:write.

Acts onpull request
Permission (capability)pullrequest:write
VersionAvailable since the API’s base version
Webhook eventpullrequest-approved
Rate limitStandard limits apply

Declining a pull request needs pullrequest:write.

Acts onpull request
Permission (capability)pullrequest:write
VersionAvailable since the API’s base version
Webhook eventpullrequest-rejected
Rate limitStandard limits apply

Recording a request for changes needs pullrequest:write.

Acts onpull request
Permission (capability)pullrequest:write
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Reading pull request comments needs the pullrequest scope.

Acts onpull request
Permission (capability)pullrequest
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Bitbucket gates creating a pull request comment on the pullrequest scope rather than pullrequest:write.

Acts onpull request
Permission (capability)pullrequest
VersionAvailable since the API’s base version
Webhook eventpullrequest-comment-created
Rate limitStandard limits apply

Reading a pull request's commits needs the pullrequest scope.

Acts onpull request
Permission (capability)pullrequest
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Returns plain-text diff output rather than JSON. Needs the pullrequest scope.

Acts onpull request
Permission (capability)pullrequest
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Commits

List commits in a repository and read a single commit.2

Reading commit history needs the repository scope.

Acts oncommit
Permission (capability)repository
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Reading one commit needs the repository scope.

Acts oncommit
Permission (capability)repository
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Branches

List branches, read a single branch, and create or delete a branch.4

Listing branches needs the repository scope.

Acts onbranch
Permission (capability)repository
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Reading one branch needs the repository scope.

Acts onbranch
Permission (capability)repository
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Creating a branch needs repository:write.

Acts onbranch
Permission (capability)repository:write
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Deleting a branch needs repository:write.

Acts onbranch
Permission (capability)repository:write
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Issues

List, read, create, and update issues in a repository's issue tracker.4

The issue tracker is optional per repository; the issue scope grants read access where it is enabled.

Acts onissue
Permission (capability)issue
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Creating an issue needs issue:write.

Acts onissue
Permission (capability)issue:write
VersionAvailable since the API’s base version
Webhook eventissue-created
Rate limitStandard limits apply

Reading one issue needs the issue scope.

Acts onissue
Permission (capability)issue
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Updating an issue needs issue:write.

Acts onissue
Permission (capability)issue:write
VersionAvailable since the API’s base version
Webhook eventissue-updated
Rate limitStandard limits apply

Pipelines

List pipelines, read a single pipeline, run a pipeline, and stop a running pipeline.4

Reading pipeline runs needs the pipeline scope.

Acts onpipeline
Permission (capability)pipeline
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Starting a pipeline run is gated on the pipeline scope.

Acts onpipeline
Permission (capability)pipeline
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Reading one pipeline needs the pipeline scope.

Acts onpipeline
Permission (capability)pipeline
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Stopping a pipeline needs pipeline:write.

Acts onpipeline
Permission (capability)pipeline:write
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Webhooks

List a repository's webhooks, create a webhook, and delete one.3

Both reading and managing webhooks use the single webhook scope.

Acts onwebhook
Permission (capability)webhook
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit1,000 requests per hour

A secret on the webhook produces an X-Hub-Signature HMAC header for verification. Needs the webhook scope.

Acts onwebhook
Permission (capability)webhook
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit1,000 requests per hour

Deleting a webhook needs the webhook scope.

Acts onwebhook
Permission (capability)webhook
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit1,000 requests per hour

Workspaces & projects

List the workspaces a user belongs to, read a workspace, and list and read the projects inside a workspace.4

Listing the user's workspaces needs the account scope.

Acts onworkspace
Permission (capability)account
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Public workspaces are readable without a scope; a private workspace needs a token with access to it.

Acts onworkspace
Permission (capability)None required
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

A project groups repositories inside a workspace; listing projects needs the project scope.

Acts onproject
Permission (capability)project
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Reading one project needs the project scope.

Acts onproject
Permission (capability)project
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Users

Read the profile of the authenticated user.1

Reading the current user's account needs the account scope.

Acts onuser
Permission (capability)account
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply
No endpoints match those filters.
Webhooks

Webhook events.

Bitbucket can notify an app or AI agent when something happens in a repository, instead of the app repeatedly asking. Bitbucket posts the event payload to a webhook URL that has been registered for the chosen events.

EventWhat it signalsTriggered by
repo:pushFires when commits are pushed to a repository, including new branches and tags.In-app only
pullrequest:createdFires when a pull request is created in a repository./repositories/{workspace}/{repo_slug}/pullrequests
pullrequest:updatedFires when a pull request's title, description, reviewers, or destination is updated./repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}
pullrequest:approvedFires when a user approves a pull request./repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/approve
pullrequest:fulfilledFires when a pull request is merged./repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/merge
pullrequest:rejectedFires when a pull request is declined./repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/decline
pullrequest:comment_createdFires when a comment is added to a pull request./repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments
issue:createdFires when an issue is created in a repository's issue tracker./repositories/{workspace}/{repo_slug}/issues
issue:updatedFires when an issue is updated, such as a change to its state, assignee, or content./repositories/{workspace}/{repo_slug}/issues/{issue_id}
No events match that search.
Rate limits & pagination

Rate limits, pagination & request size.

Bitbucket limits how fast an app or AI agent can call, through an hourly request quota that depends on how the call is authenticated and which resource it touches.

Request rate

Bitbucket Cloud sets hourly request limits that depend on how a call is authenticated and which resource it touches, measured over a one-hour rolling window. Anonymous requests are capped at 60 per hour, counted against the calling IP address. Authenticated requests are counted against the user, and the ceiling varies by resource: repository data access scales from 1,000 to 10,000 requests per hour, webhook operations get 1,000 per hour, and application property access gets 2,000 per hour, while Git operations over HTTPS or SSH get 60,000 per hour and raw file downloads get 5,000 per hour. Standard and Premium workspaces with at least 100 paid users earn an extra 10 requests per hour per paid user, up to a maximum of 10,000 per hour. Responses carry X-RateLimit-Limit and X-RateLimit-Resource headers, and X-RateLimit-NearLimit turns true when under 20 percent of the quota remains.

Pagination

List endpoints return a paged envelope with a values array, a size or pagelen field, and a next field holding the full URL of the following page. Pagination is cursor-based, so the next URL should be followed as given rather than built by hand, and it is absent on the final page. The pagelen query parameter sets the page size, which defaults to a per-endpoint value and is capped per endpoint.

Request size

Requests and responses are JSON over HTTPS. Diffs, patches, and raw file contents are returned as plain text rather than JSON. Archive downloads are limited to 1,500 files per hour, and individual endpoints set their own ceilings on fields such as comment and description length.

Errors

Status codes & error handling.

The status codes an agent should handle, and what to do about each.

StatusCodeMeaningWhat to do
401UnauthorizedAuthentication is missing, or the credentials are invalid or expired. A common cause is sending an app password after it has been disabled, or an API token with the wrong username.Send valid credentials: an OAuth bearer token, or an API token used as the password with the Atlassian account email as the username.
403ForbiddenThe request is authenticated but not permitted. The token is missing the scope the endpoint requires, or the user lacks access to the resource.Grant the missing scope, such as pullrequest:write or repository:admin, or give the token access to the repository.
404Not FoundThe resource does not exist, or the token cannot see a private resource. Bitbucket returns 404 rather than 403 for a private resource the token cannot access, so it does not reveal the resource exists.Confirm the workspace, repo_slug, and id in the path, and that the token has access to the resource.
429Too Many RequestsAn hourly rate limit was exceeded for the identity and resource being called.Slow down and retry after the window resets. Watch the X-RateLimit-NearLimit header, which turns true when under 20 percent of the quota remains.
500Internal Server ErrorAn unexpected error occurred on Bitbucket's side while handling the request.Retry the request after a short delay, and if it persists, check the Bitbucket status page.
Versioning & freshness

Version history.

Bitbucket Cloud exposes a single REST API version, 2.0, served from one host. It does not mint new dated versions, so changes ship as additive updates and announced deprecations rather than a version bump.

Version history

What changed, and when

Latest version2.0
2.0Current version
Bitbucket Cloud REST API 2.0

Version 2.0 is the current Bitbucket Cloud REST API, served from one host. Bitbucket does not mint new dated versions of it, so changes ship as additive endpoints and fields, or as deprecations with their own announced timelines, rather than a version bump. Two such migrations dominate the recent timeline: the retirement of app passwords in favor of API tokens, and a change to where OAuth requests must be sent.

What changed
  • App passwords: no new ones can be created from 9 September 2025, and all are disabled on 9 June 2026, replaced by API tokens with scopes
  • OAuth 2.0: from 4 May 2026 all OAuth-authenticated requests must be sent to api.bitbucket.org with the access token as a bearer token in the Authorization header
  • Atlassian Rovo MCP Server reached general availability and added Bitbucket Cloud support
App password deprecation, phase one
App password creation disabled

From 9 September 2025 Bitbucket Cloud stopped allowing the creation of new app passwords. Existing app passwords kept working through this phase, so running integrations were not interrupted, but new integrations had to adopt API tokens authenticated with an Atlassian account email. It was the first phase of moving Bitbucket Cloud authentication onto scoped, expiring API tokens.

What changed
  • No new app passwords can be created after 9 September 2025
  • Existing app passwords continue to work during this phase
  • New integrations must use API tokens, authenticated with an Atlassian account email and a token set to expire within one year

An integration written against 2.0 keeps working as Bitbucket adds endpoints and fields over time.

Bitbucket Cloud API changelog ↗
Questions

Bitbucket API, answered.

App password, API token, or OAuth, which should I use?+
App passwords are being retired: Bitbucket stopped allowing new ones on 9 September 2025 and disables all of them on 9 June 2026, so they are not a choice for new work. For a script or a CI job, an API token authenticated with an Atlassian account email is the direct replacement, and it must be given an expiry of up to one year. For an app acting on behalf of a user, OAuth 2.0 is the better fit, since it issues a short-lived bearer token tied to the scopes the user granted.
How do Bitbucket scopes work?+
Each endpoint declares the scope it needs, and a token must carry that scope for the call to succeed. Reads use a base scope, such as repository for repository and commit data, pullrequest for pull requests, issue for the issue tracker, or pipeline for builds. Writes need the matching write scope, such as repository:write to push a branch, pullrequest:write to merge or approve, or issue:write to file an issue. A scope is not limited to one repository on its own, it applies to everything the token can see, so the token's repository access sets the real boundary.
What are the rate limits?+
Limits are hourly and depend on identity and resource, over a one-hour rolling window. An anonymous caller gets 60 requests per hour against its IP address. An authenticated caller is counted against the user, with repository data access scaling from 1,000 to 10,000 per hour, webhook operations at 1,000 per hour, Git operations at 60,000 per hour, and raw downloads at 5,000 per hour. Larger paid workspaces earn extra capacity per paid user up to 10,000 per hour. The X-RateLimit-Limit and X-RateLimit-NearLimit response headers report the current state.
How does pagination work?+
List endpoints return an object with a values array and a next field that holds the full URL of the next page. Pagination is cursor-based, so the integration follows the next URL exactly as returned and stops when next is absent, rather than incrementing a page number by hand. The pagelen parameter controls the page size, within a per-endpoint cap.
How do I receive events instead of polling?+
Webhooks deliver events without polling. A webhook is registered on a repository with a receiver URL and a list of event keys, such as repo:push, pullrequest:created, pullrequest:fulfilled for a merge, or issue:created. Bitbucket posts a JSON payload when each event fires, and when a secret is set on the webhook, an X-Hub-Signature HMAC header lets the receiver confirm the payload came from Bitbucket.
Is there an official MCP server for Bitbucket?+
Yes. The Atlassian Rovo MCP Server is generally available and supports Bitbucket Cloud, letting an AI client browse repositories, create commits, open pull requests, and check pipeline results over the Model Context Protocol. It is hosted by Atlassian at a remote endpoint, and Bitbucket Cloud tools currently rely on API token authentication, enabled by an organization admin in the Rovo MCP Server settings.
Related

More developer API guides for agents

What is Bollard AI?

Control what every AI agent can do in Bitbucket.

Bollard AI sits between a team's AI agents and Bitbucket. Grant each agent exactly the access it needs, read or write, resource by resource, and every call is checked and logged.

  • Set read, write, or full access per agent, never a shared Bitbucket token.
  • Denied by default, so an agent reaches only what has been explicitly allowed.
  • Every call recorded in plain English: who, what, where, and the decision.
Bitbucket
Dev Agent
Read repositories ResourceOffReadFull use
Open and merge pull requests ActionOffReadFull use
Run pipelines ActionOffReadFull use
Delete branches ActionOffReadFull use
Per-agent access, set in Bollard AI, not in Bitbucket