API login

I see the login requires a 2FA token, which is a bit hard (impossible?) to implement programmatically. I want to create a server which monitors my rigs by gathering stats every minute and then sending an email and text if there is an issue. I can’t be entering a 2FA code every minute - how is this supposed to work?