How to retrieve list of branches after getting a list of repos?

Hi,

I can retrieve a list of repos with:
https://api.bitbucket.org/2.0/repositories?role=contributor

This gives me uuid but not username. Even if it did give me username this seems like:

https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/{username}/{repo_slug}/refs/branches#get

Requires username, which seems like a bad idea to store and use to query the repo since I would imagine the repo can be moved around under different orgs and I’m guessing username could also confusingly refer to org name? Not that username is available in the first response anyway.

GitHub and GitLab can query repo stuff using the repo id only, which makes a lot of sense.

So once we get a repo, how are we supposed to query what branches are there?

Thanks!