The API would be provided by something like Mi Casa Verde running on some hardware in your house.
You can do everything the cloud services enable, locally, such as ‘scenes’ where you press a button and multiple things happen at once.
There are of course some trade-offs with Z-wave. It’s proprietary and expensive (compared to other things) to license. You’ll find a much more limited selection of Z-wave devices compared to BT or WiFi.
They make Z-wave controllers for raspberry pi and such. I’ve seen plenty of projects that used Mi Casa Verde to enable phone support and automation without going to someone else’s cloud.
For what it’s worth, I’ve got z-wave switches for nearly every switch in my house, a few electrical outlets, and a few corded adapters.
The adapters and outlets are great come holiday time. The outlets are paired with light switches in kids’ rooms so when we turn on the switch for their white noise machines some under bed night lights come on.
I used to use a Z-Wave thermostat and it worked just fine, I switched to an Ecobee 3 with room sensors to help better manage hot/cold spots.
I tie it all together with a Wink Hub, so it’s going to someone else’s cloud. I like their app on my phone better and it just works and has no monthly cost. They’ve got an API to integrate with, and have generally been nice to work with.
I specifically chose Z-wave though to give me options if they go under or I decide to cut ties and run my own stuff.