Skip to content

Token Scopes

When you authenticate with an API token, you choose which scopes the token grants. This page maps every bb command to the minimum scope required to run it, so you can mint a token with exactly the permissions a workflow needs and nothing more.

Bitbucket Cloud API token scopes follow the format <action>:<resource>:bitbucket. The CLI uses these scopes:

ScopeGrants
read:user:bitbucketRead your own user profile (required by bb auth status, used to verify any login)
read:repository:bitbucketList and view repositories, list default reviewers
write:repository:bitbucketCreate repositories, manage default reviewers
admin:repository:bitbucketDelete repositories
read:pullrequest:bitbucketList, view, and diff pull requests; read comments, activity, checks, and reviewers
write:pullrequest:bitbucketCreate, edit, approve, decline, merge, and mark PRs ready; add/edit/delete comments; add/remove reviewers
read:snippet:bitbucketList and view snippets
write:snippet:bitbucketCreate, edit, and delete snippets
CommandRequired scopes
bb auth loginread:user:bitbucket (verifies the credentials)
bb auth logout(none — local-only for API tokens; OAuth revoke uses the existing token)
bb auth statusread:user:bitbucket
bb auth token(none — prints the locally-stored token)
CommandRequired scopes
bb repo listread:repository:bitbucket
bb repo viewread:repository:bitbucket
bb repo cloneread:repository:bitbucket (plus your normal git auth)
bb repo createwrite:repository:bitbucket
bb repo deleteadmin:repository:bitbucket
bb repo default-reviewers listread:repository:bitbucket
bb repo default-reviewers addwrite:repository:bitbucket
bb repo default-reviewers removewrite:repository:bitbucket

Read-only PR commands — list, view, diff, checkout, activity, checks, comments list, reviewers list — only need read:pullrequest:bitbucket (plus read:repository:bitbucket for repository context).

CommandRequired scopes
bb pr listread:pullrequest:bitbucket, read:repository:bitbucket
bb pr viewread:pullrequest:bitbucket, read:repository:bitbucket
bb pr diffread:pullrequest:bitbucket, read:repository:bitbucket
bb pr checkoutread:pullrequest:bitbucket, read:repository:bitbucket
bb pr activityread:pullrequest:bitbucket, read:repository:bitbucket
bb pr checksread:pullrequest:bitbucket, read:repository:bitbucket
bb pr comments listread:pullrequest:bitbucket, read:repository:bitbucket
bb pr reviewers listread:pullrequest:bitbucket, read:repository:bitbucket
bb pr createwrite:pullrequest:bitbucket, read:repository:bitbucket
bb pr editwrite:pullrequest:bitbucket, read:repository:bitbucket
bb pr readywrite:pullrequest:bitbucket, read:repository:bitbucket
bb pr approvewrite:pullrequest:bitbucket, read:repository:bitbucket
bb pr declinewrite:pullrequest:bitbucket, read:repository:bitbucket
bb pr mergewrite:pullrequest:bitbucket, read:repository:bitbucket
bb pr comments addwrite:pullrequest:bitbucket, read:repository:bitbucket
bb pr comments editwrite:pullrequest:bitbucket, read:repository:bitbucket
bb pr comments deletewrite:pullrequest:bitbucket, read:repository:bitbucket
bb pr reviewers addwrite:pullrequest:bitbucket, read:repository:bitbucket
bb pr reviewers removewrite:pullrequest:bitbucket, read:repository:bitbucket
CommandRequired scopes
bb snippet listread:snippet:bitbucket
bb snippet viewread:snippet:bitbucket
bb snippet createwrite:snippet:bitbucket
bb snippet editwrite:snippet:bitbucket
bb snippet deletewrite:snippet:bitbucket

These don’t hit the API and don’t need any scope:

  • bb config (all subcommands)
  • bb completion
  • bb (root, including the version-check)

Pick the profile that matches your workflow and grant only those scopes when creating the token.

Read-only automation (status checks, dashboards)

Section titled “Read-only automation (status checks, dashboards)”
read:user:bitbucket
read:repository:bitbucket
read:pullrequest:bitbucket
read:user:bitbucket
read:repository:bitbucket
read:pullrequest:bitbucket
write:pullrequest:bitbucket
read:user:bitbucket
read:repository:bitbucket
write:repository:bitbucket
admin:repository:bitbucket

If a command exits with 2003 API_FORBIDDEN, your token is missing the scope listed in the table above. Mint a new token with the required scope (you can’t add scopes to an existing token) and re-authenticate:

Terminal window
bb auth logout
bb auth login -u your-username -p new-token