Bitbucket API
Manage repositories, pull requests and pipelines on Bitbucket.
What it does
The Bitbucket Cloud REST API (v2.0) manages repositories, pull requests, commits, branches, pipelines, webhooks, snippets and workspace membership on bitbucket.org. Responses are JSON with cursor-style pagination.
Base URL
Authentication
Use an API token or repository/workspace Access Token as a Bearer token (Authorization: Bearer …), or OAuth 2.0 for apps acting on behalf of users. Older app passwords with HTTP Basic still work but are being phased out. Public repos allow some unauthenticated reads.
Code examples
curl -H "Authorization: Bearer $BITBUCKET_TOKEN" \ "https://api.bitbucket.org/2.0/repositories/atlassian?pagelen=5"
import requests
url = "https://api.bitbucket.org/2.0/repositories/myworkspace"
while url:
r = requests.get(url, headers={"Authorization": f"Bearer {TOKEN}"}, timeout=10)
page = r.json()
for repo in page["values"]:
print(repo["full_name"])
url = page.get("next") # cursor paginationRate limits & quotas
Rate limits are per authenticated user (and per IP for anonymous traffic) — on the order of 1,000 requests/hour for most endpoints, lower for anonymous. Over the limit returns HTTP 429 with a Retry-After header.
Key response fields
| values[] | The current page of results |
| next | Full URL of the next page, or absent on the last page |
| pagelen / size | Page size and (sometimes) total count |
| full_name | workspace/repo |
Common errors
| 401 | Missing/expired token or app password. |
| 403 | Token scope or workspace permission insufficient. |
| 404 | Private resource without access, or wrong workspace slug. |
| 429 | Rate limited — wait Retry-After seconds. |
When to use it (and alternatives)
Use it for Bitbucket Cloud automation. If you also touch Jira or Confluence, the same Atlassian account and OAuth app can cover all three. For GitHub or GitLab hosting see their APIs.
FAQ
Are app passwords still supported?
They work for now but Atlassian is deprecating them in favour of API tokens and scoped access tokens. New integrations should use tokens with a Bearer header.
How does pagination work?
Follow the next field in each response, which is a complete URL for the following page. Stop when it is missing. Control page size with pagelen.
Can I filter results server-side?
Yes — many endpoints accept a q parameter with Bitbucket’s query language and sort for ordering, which is far cheaper than paging through everything.
New to APIs?
Short guides for working with this API — and any other.