Exclude commits to branches in API call?

I am using the https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commits end point to return a list of recent commits. I want to get a list of all commits that are only on rev master so I am using GET /repositories/{username}/{repo_slug}/commits/master.

How I can modify this to exclude all commits that are on a branch. I do not know the names of the branches ahead of time. I want only the changes that are on master.

I don’t think this is possible with raw git even!

git log master --not --branches

Nope, doesn’t work (because “master” is a branch and so immediately gets exluded).

Maybe in two calls?

  1. git log --simplify-by-decoration master

  2. grab first decoration, rerun “git log” with first decoration as exclude?

Anyway, regardless, really doesn’t look like this is possible with the Bitbucket Cloud API, let alone raw git.