Recover the Default Group for the workspace
Asked by Jos? Antonio Garcel D?az:

Hello, these last days we have been *playing* with the bitbucket API to adjust it to our needs. One of them is to know the default permissions granted to a new member.

I noticed that members are added to the default group, so we can achieve that by checking that group permissions.

However, we are not being able to recover which one of the groups of the workspace is the one selected as default. We can see it on the Web though.

Is there any workaround to achieve this? Thank you,


Answers:
author: Theodora Boudale
body: Hi [@Jos? Antonio Garcel D?az](/t5/user/viewprofilepage/user-id/5152767)!

I don't think that it's possible to get via API which group is the default one at the moment, I will double-check with the development team and I'll let you know.

Please keep in mind the following about the default group:

The default group is the group where a user gets added if they are invited to a repo by a non-admin of the workspace. For example:

1. UserA is an admin of repo <https://bitbucket.org/my-workspace/my-repo/>, but not an admin of the workspace <https://bitbucket.org/my-workspace>
2. UserA invites UserB to said repo, via Repository settings \> User and group access and grants UserB write access to the repo
3. UserB accepts the invitation
4. UserB then gets added to the default group

Even if the default group doesn't have access to any repo, UserB will continue to have access to <https://bitbucket.org/my-workspace/my-repo/> as they were granted explicit access to said repo.

You can use the following API endpoint to get all explicit user permissions for a given repository:

* <https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-permissions-config-users-get>

Or the following API endpoint to get the explicit user permission for a given user and repository:

* <https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-permissions-config-users-selected-user-id-get>

The following API endpoints will return explicit group permissions for a given repository, and explicit group permission for a given group slug and repository respectively:

* <https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-permissions-config-groups-get>
* <https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-permissions-config-groups-group-slug-get>

If you have any questions, please feel free to let me know.

Kind regards,  
Theodora

comments: author: Jos? Antonio Garcel D?az
body: Hey [@Theodora](/t5/user/viewprofilepage/user-id/3526241), I'm very grateful for getting your response, very clarificating. We were hopping to be able to recover the default goup though, so now we'll try to handle it in a different manner.

If you get an update on this from your Dev team I'll happy to know about.

Thanks again,


author: Theodora Boudale
body: Hi [@Jos? Antonio Garcel D?az](/t5/user/viewprofilepage/user-id/5152767)!

I had an update from the development team and I'm afraid that there is no API endpoint that provides a workspace's default group at the moment.

I went ahead and created a feature request about this in our issue tracker:

* <https://jira.atlassian.com/browse/BCLOUD-22522>

Please make sure to vote (by selecting the **Vote for this issue** link) and comment on it to give it more weight and further express your interest. You can also add yourself as a watcher (by selecting the **Start watching this issue** link) if you'd like to get notified via email on updates. Implementation of features is done as per our policy [here](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html) and any updates will be posted in the feature request.

In the meantime, we have an internal API endpoint that you can use to retrieve the default group:

```
https://bitbucket.org/api/internal/workspaces/<workspace-slug>/default-group
```

Example:

```
curl -u BB_Username:App_Passowrd -X GET https://bitbucket.org/api/internal/workspaces/<workspace-slug>/default-group
```

The **App_Passowrd** needs to have at least **Account: Write** permissions to access that.

Please keep in mind though that since this is an internal API endpoint, we don't guarantee its behavior.

If you have any questions, please feel free to let me know.

Kind regards,  
Theodora


author: Jos? Antonio Garcel D?az
body: Hey [@Theodora](/t5/user/viewprofilepage/user-id/3526241). Just voted the issue!

We will try your workaround ASAP.

We really appreciated your support, thanks again.


author: Theodora Boudale
body: You are very welcome [@Jos? Antonio Garcel D?az](/t5/user/viewprofilepage/user-id/5152767), I'm glad to have helped!

Please feel free to reach out if you ever need anything else!


Tags: bitbucket-cloud

cloud

group

workspace