How do I use API to operate 2nd HAswitch

I have 2 HA instances.
I am certain that it is possible to use restful switch in 1st HA to ON/Off switch in 2nd HA but cannot figure out how. Any help?

I currently use mqtt to do this and previously used statestream but believe API helps remove failure points and most reliable option