How can I change a master on my own initiative

I need to change master from A to B on my own, is there any method, for example a http command?

You need to restart the current elected master node, there is no other way.