How do I get all commits in a repository in bitbucket using the rest API

Hi I am using the following call to get a list of commits in a repository:

GET
/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits

But appears that only the commits in a master branch is returned, how do I get all commits in this repo irrespective of what branch they are in.

Thanks

There’s no Bitbucket REST API that supports that.

If it has to be through REST, then getting all branches then paginating through each branches commits may work, although that’s not efficient.