I was able to resolve this. I created a subaccount API key that I used for authentication before generating a secret key for the primary API key (by default Mailjet creates a key but not a secret for that key, which is a manual action). Now I just generated a secret key for the primary API key and used this instead of the subaccount key and it worked.