API call on button click

It looks like you have created a server connect inside flow. You might need to enable output to access that data inside that. And bind the value via the flow.

Else, the better way is to create a server connect on the page. Keep it as “no-auto-load”. On click, just load the server connect.
Don’t forget to bind that value as shown above by Ken.