API to change default branch?

We have a repository where our patches are rebased ( at least once a week, usually) on top of an upstream branch to create a new production branch with a new name.

This new branch becomes the new integration branch for all patches, including older ones.

The name of the branch is specified in a file in a different repository, so having that repository’s hook that does other checks of the pushed commits also update the submodule’s default branch would be very useful.

However, while I have found APIs that can update settings for protected branches, I have not been able to find any API that can change the default branch (changing the HEAD file in the repo does not work, AFAICT).

Does anyone have any suggestions for how to automate this update?

Thanks in advance.

Yngve N. Pettersen