how to get group membership listing from APIs
Asked by alex:

I am attempting to use one of the APIs to get a list of users that are members of a specific group.  

It appears the /groups endpoint was deprecated in 1.0, and is not available in 2.0 API get, but there is also mention at the below link that the group endpoints are still available (as do a number of other community conversations).   

<https://support.atlassian.com/bitbucket-cloud/docs/groups-endpoint/>  

Does this endpoint still exist?  
How can I access it?  

% curl -X 'GET' -H "Authorization: Bearer TOKEN" <https://api.bitbucket.org/1.0/groups> \| jq  

{  
"type": "error",  
"error": {  
"message": "Token is invalid or not supported for this endpoint."  
}  
}  
%  

If it is a matter of permissions, where do those need to be set, as this token has full admin across all available resources for testing this.


Answers:
author: Patrik S
body: Hello [@alex](/t5/user/viewprofilepage/user-id/5101603) ,

Thank you for reaching out to Atlassian Community!

The [/1.0/groups](https://support.atlassian.com/bitbucket-cloud/docs/groups-endpoint/) endpoint is indeed still available until equivalent endpoints are still under the works for the 2.0 API.

From the error you shared, it seems like the access token you are using is either invalid or does not have the required scopes.

I was able to get the members of a group by making a request to the group's endpoint as in the following example:

```
curl -X GET https://api.bitbucket.org/1.0/groups/<workspace>/<groups>/members \

 --header 'Authorization: Bearer ACCESS_TOKEN'
```

It's also possible to use Basic authentication by providing your bitbucket account username and an [app password](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/) :

```
curl -u USERNAME:APP_PASSWORD  -X GET https://api.bitbucket.org/1.0/groups/<workspace>/<group>/members
```

In this case, could you please confirm how exactly are you generating this access token? Is it by using an [OAuth consumer](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/) ?

Thank you, [@alex](/t5/user/viewprofilepage/user-id/5101603) !

Patrik S

comments: author: alex
body: Thanks for the reply [@Patrik S](/t5/user/viewprofilepage/user-id/4603309)   

We are generating the token on the Workspace Access Token page:  

<https://bitbucket.org/company/workspace/settings/access-tokens>  

No combination of permissions is appearing to work.

We are also set up with SSO through atlassian cloud so basic auth isn't an option.  

Really appreciate the time on this as it's the last piece of an audit puzzle :)


author: Patrik S
body: Hello [@alex](/t5/user/viewprofilepage/user-id/5101603)

Unfortunately Workspace, Project, and Repository Access tokens are not currently supported on 1.0 endpoints.

In this case, you would need to either :

* Use Oauth by [Creating an Oauth Consumer](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/) and exchanging it for an access token using [Client Credentials Grant](https://developer.atlassian.com/cloud/bitbucket/rest/intro/#3--client-credentials-grant--4-4-). This access token can be used for requests to the 1.0 endpoint.
* Use basic authentication with your username and App Password:  
  **Username** : your bitbucket username (not email address). You can find the username by accessing <https://bitbucket.org/account/settings/> and looking for the field *++username++* .  
  **App Password** : you can create an app password following the instructions in [this documentation](https://support.atlassian.com/bitbucket-cloud/docs/create-an-app-password/).  

  The fact that you are using SSO will not prevent you from using basic authentication, because the app password is not related to the password you use to login in to the UI.

Let me know in case you have any questions.

Thank you, [@alex](/t5/user/viewprofilepage/user-id/5101603) !

Patrik S


Tags: api

bitbucket-cloud

cloud