Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the mfa status of bitbucket workspace users

jawad_abbasi
Contributor
August 10, 2023

Hi Community, 

I have an admin rights to the bitbucket workspace and atlassian product but I don't find any way to retrieve the mfa status for all the bitbucket users. Also I don't see any such api available under the documentation. 

 

It'll be helpful for me if someone provide me any bitbucket api to retrieve such user details ? 

 

Thanks & Regards, 

Jawad Abbasi

1 answer

1 accepted

1 vote
Answer accepted
Saxea _Flowie_
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.
August 10, 2023

https://developer.atlassian.com/cloud/bitbucket/rest/api-group-workspaces/#api-workspaces-workspace-members-get can do that, however it will not include the mfa status by default. You need to request the additional fields.

e.g.:

`https://api.bitbucket.org/2.0/workspaces/{workspace}/members?fields=%2Bvalues.user.*%2C%2Bnext`

The response will have a field named `has_2fa_enabled`

jawad_abbasi
Contributor
August 11, 2023

@Saxea _Flowie_ Thank you so much.  I got expected result by using the above api. 

Command : 
curl --request GET --user <username>:<app_pass> --url 'https://api.bitbucket.org/2.0/workspaces/terratrak/members?fields=%2Bvalues.user.display_name%2C%2Bvalues.user.has_2fa_enabled%2C%2Bnext' | jq '.values[] | {Name: .user.display_name, MFA_status: .user.has_2fa_enabled}'


Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events