Bitbucket Cloud: API token or access token?
Bitbucket Cloud has two kinds of token that replace app passwords. An Atlassian API token belongs to your account and carries the scopes you gave it. A repository, project or workspace access token belongs to one repository, project or workspace, not to a person, and is meant for scripts and CI. They are sent differently: an API token with your e-mail (REST API) or a Bitbucket user name (Git), an access token as Bearer for the REST API and with the user name x-token-auth for Git.
Side by side
| Atlassian API token | Repository, project or workspace access token | |
|---|---|---|
| Belongs to | Your Atlassian account | One repository, project or workspace, not a user |
| Can reach | Git and the Bitbucket APIs, within the scopes it was made with | Only its own repository, project or workspace; it cannot log in to bitbucket.org or manage other workspaces, projects or repositories |
| Created at | id.atlassian.com → Security → API tokens, Create API token with scopes | Settings → Security → Access tokens, in the repository, project or workspace, Create access token |
| Expiry | 1 to 365 days, one year by default | "No expiry" or a date; if a workspace admin requires an expiry, a date within the admin's range |
| Shown | Once, it cannot be recovered | Once, it cannot be retrieved later |
| Git over HTTPS: user name | Your Bitbucket user name (case sensitive), or x-bitbucket-api-token-auth, or x-token-auth | x-token-auth |
| Git over HTTPS: what it needs | read:repository:bitbucket to clone; also write:repository:bitbucket to push | The Repository Read permission to clone; also Repository Write to push |
| REST API | HTTP Basic with the e-mail of your Atlassian account; since August 18, 2026 also Authorization: Bearer, without the e-mail | Authorization: Bearer |
| Plan | Any | Workspace and project tokens are a Premium feature, as Atlassian's pages for them say |
Sources: Atlassian's Using API tokens, Manage API tokens, Repository access tokens, Using access tokens, Create a project access token, Create a workspace access token, and the changelog entry for Bearer.
To use either from a JetBrains IDE: Pull Request Inbox for Bitbucket, a plugin for JetBrains IDEs, takes an Atlassian API token with your e-mail, or an access token with the e-mail left empty.
Commands
An API token, REST API, with the e-mail of your Atlassian account:
curl -u 'YOUR_ATLASSIAN_EMAIL:YOUR_API_TOKEN' https://api.bitbucket.org/2.0/user
An access token, REST API (the call is Atlassian's example for a repository token):
curl -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' https://api.bitbucket.org/2.0/repositories/WORKSPACE/REPOSITORY
Git with an API token. Leave the token out of the URL and enter it at the password prompt; Atlassian advises against keeping it in the remote URL:
git clone https://YOUR_BITBUCKET_USERNAME@bitbucket.org/WORKSPACE/REPOSITORY.git
Git with an access token: the user name x-token-auth, the token at the prompt:
git clone https://x-token-auth@bitbucket.org/WORKSPACE/REPOSITORY.git
For a repository access token, Atlassian also says to set the repository's Git user e-mail to BOT_ID@bots.bitbucket.org, where the bot ID is the token's ID, not its name. That address cannot send or receive mail; it only ties Git operations to the token.
Which one
- Your own work from a laptop or an IDE: an API token. For everyday interactive Git, Atlassian recommends SSH keys or Git Credential Manager; access tokens are for non-interactive use such as scripts, build tools and CI/CD.
- A script or CI job that must touch one repository only: a repository access token. It cannot reach anything else, and it does not belong to a person's account.
- One credential for the repositories of a project or a workspace: a project or workspace access token (Premium).
When a token is refused
- HTTP 401 "Token is invalid, expired, or not supported for this endpoint": which token, and how it has to be sent.
- HTTP 403 "Your credentials lack one or more required privilege scopes": which scope is missing.
- Git answers "error: 410", or says account passwords are not supported: app passwords are gone, account passwords.
Bitbucket pull requests in IntelliJ IDEA
Pull Request Inbox for Bitbucket, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, signs in to Bitbucket Cloud's REST API with your Atlassian e-mail and an API token in HTTP Basic; when you leave the e-mail empty, it sends the token as a Bearer token, for a repository, project or workspace access token. It does not use the token for Git: pull, push and checkout go through your Git and its credential helper. The review inbox, diffs and discussions are free; approving, commenting and merging are Pro (US$1.50 a month, with a 30-day trial).
Get it on JetBrains Marketplace
Bitbucket and Atlassian 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: "Token is invalid, expired, or not supported for this endpoint" · "Your credentials lack one or more required privilege scopes" · "error: 410" after app passwords · Git Credential Manager 3.0.0 and Bitbucket OAuth · "remote: Invalid username or password" · 日本語