This API is not accessible by this authentication mechanism

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Summary

While making a request to GET a list of workspaces for the user, the user sees the following error message:

1 {"type": "error", "error": {"message": "This API is not accessible by this authentication mechanism"}}

Environment

Bitbucket Cloud Rest API

Diagnosis

This will happen while trying to perform the authentication with any of the following authentication methods:

Cause

This happens because the permission scope of these tokens is valid only on the workspace where they were created. Since this endpoint will fetch information from multiple workspaces the request will fail.

Solution

There are two other authentication methods that will work in this case:

  1. Using an OAuth token with the Authorization Code Grant method. You will have to add the account scope to the token.

  2. Basic Auth using an App Password. Here is a quick example:

    1 2 3 curl -u {bitbucket-username}:{app-password} --request GET \ --url 'https://api.bitbucket.org/2.0/workspaces' \ --header 'Accept: application/json'

Updated on March 21, 2025

Still need help?

The Atlassian Community is here for you.