API Error 6103

I am trying to use the API and I am running into an issue that I am getting the error ‘code’: 6103, ‘message’: ‘Invalid format for X-Auth-Key header’.
The API token is fine because I am able to test it and it passes.

I have tried using curl or python but I always get the same response. Has anyone run into this issue before and how have you fixed it.\

It works with my global API key but it does not work if I create an API token with DNS edit for the zone

Shouldnt the API token be passed via Authorization instead of X-Auth-Key?

You would be correct.