I want to return all users in our bitbucket projects which are project administrators using a rest API as I couldn't find an option on audit logs
Hey Thembela — great question. Bitbucket’s REST API doesn’t provide a single direct endpoint to list all project admins across all projects, but here’s a workaround approach that works well:
Get all projectsUse this to list your projects:
<span>GET /rest/api/1.0/projects </span>
This returns a list of project keys.
Get project permissionsFor each project key, run:
<span>GET /rest/api/1.0/projects/{projectKey}/permissions/users </span>
This will return all users with any level of access. You'll need to filter by PROJECT_ADMIN permission from the response.
PROJECT_ADMIN
(Optional) Also check group permissionsIf you’re assigning admin rights via groups, also run:
<span>GET /rest/api/1.0/projects/{projectKey}/permissions/groups </span>
Then map users from those groups separately.
This process can be scripted using Python or any HTTP client to loop through all projects and compile a full list of admins.
Let me know if you’d like a script template happy to send one over or walk through it in DM if that helps
@Vitalii Rybka
Thank you very much for your response.
It looks like you're new here. Sign in or register to get started.