How to get current product / variant id, to send to an external API on button click

Hey there! Can I ask if there is any way to get the current product / variant ID?

I’m trying to create a button on each product page that when clicked, will make an API external call with the selected product / variant. What would be the best way to extract such data?