Hi, I'm having trouble using an HTTP Access Token with Bitbucket REST API v2.
- read:account (Classic)
- read:repository:bitbucket / write:repository:bitbucket
- read:pullrequest:bitbucket / write:pullrequest:bitbucket
401: "Token is invalid, expired, or not supported for this endpoint."curl -H "Authorization: Bearer <token>" https://api.bitbucket.org/2.0/user
curl -H "Authorization: Bearer <token>" "https://api.bitbucket.org/2.0/repositories?role=member&pagelen=1"
I think the key issue is the auth method, not the scopes.
Bitbucket’s current docs distinguish between:
- API tokens, which authenticate with Basic auth using your Atlassian email as the username and the token as the password
- OAuth/access tokens, which use `Authorization: Bearer ...`
So if the token you created came from the Bitbucket API Tokens page, using it as a Bearer token on `/2.0/user` and `/2.0/repositories` would explain the “not supported for this endpoint” response.
I would try:
- Basic auth with your Atlassian email + that API token
- not `Authorization: Bearer ...`
So for example, the likely fix is to stop treating that token like OAuth and instead use it as a Basic-auth password. That would also explain why App Password basic auth works on the same endpoints.
Hello @Chatree Kunjai
The issue is the authentication scheme.
You mixing up Token type and auth Method.
The confusing part is that Atlassian’s REST examples often show Authorization: Bearer <access_token> on those endpoints. That is valid for OAuth/access-token flows, but not for the user API token shown in your screenshot. Atlassian also documents that repository, project, and workspace access tokens are a different token family, tied to that repo/project/workspace rather than to your user account.
Access tokens | Bitbucket Cloud | Atlassian Support
For the token shown in your screenshot, use Basic auth, not Bearer.
If you specifically want Bearer, then use OAuth or a Bitbucket access token, not a user API token.
One nuance though: for GET /2.0/user, Bitbucket’s REST reference lists the API token scope as read:user:bitbucket. In your post you mentioned read:account (Classic), so if /user still fails after switching to Basic auth, I would double-check the scopes on the token and recreate it with the exact read:user:bitbucket permission if needed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.