Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

I am trying to create an app for my workspace usin atlassian-python-api package but can't call APIs.

Ishita Chauhan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 4, 2023

Hi everyone, I am new here. So it might be the case that I am missing something. It would be of great help if someone could guide me through the process. I wrote the following python code to try and get a list of all the users associated with my organization:


from atlassian import Bitbucket
import os

class Driver():
    def __init__(self):
    self.username = "admin"
    self.app_password = os.environ.get('BITBUCKET_APP_PASSWORD')

    self.bitbucket = Bitbucket(

    def getVendorData(self):
       response = self.bitbucket.get_users()


I have created the BITBUCKET_APP_PASSWORD for an admin account and have granted it literally all the permissions. Bit when I try to run the `getVendorData` method I get:

requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url:


Note: The app I am working on is still in a testing phase so I am using a free Bitbucket test workspace.


Thank you for your time

2 answers

1 vote
Aron Gombas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 5, 2023

I think that the problem is not with the permissions, but your code can't authenticated using the given username and password.

  1. Are you 100% sure that "admin" should be used here? AFAI Bitbucket Cloud is using email addresses to identify user accounts...
  2. Are you sure that the password is correctly set in the local environment variable? Maybe printing this out from the script could confirm this.
0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 7, 2023

Hello @Ishita Chauhan ,

Welcome to Atlassian Community!

From the logs you have shared seems like this library is trying to use Bitbucket API v1.0 endpoints, which were deprecated a few years ago (see Users endpoint 1.0).

In this case, you would need to use the endpoints available in Bitbucket API v2.0. If your goal is to list all the members within a workspace, the following 2.0 endpoint might be of help : 

You can also check all the other available endpoints in the Bitbucket API 2.0 Reference documentation.

Also, I see that in your script you are using the username "admin". The username used in the authentication must be the same username of the account under which you created the app password. You can check the username of your account on the website by clicking on your personal avatar in the top right corner, selecting Personal Settings, and looking for the field Username. This should be the username used in your script.

Hope that helps!  Let me know in case you have any questions.

Thank you, @Ishita Chauhan !

Patrik S

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events