Authenication with InsightAppSec API Key

Hello,

I am trying to automate connection to InsightAppSec with API key and the API key is not authenticating me. Response url keeps coming back as Login. I do have permissions to login and access the apps.

Not doing much from code pov, making a call to /apps to get the list. Passing X-API-Key in the header.

What am I missing?

thanks