I would like to use my API Key in the header as opposed to as a query parameter.
In Stack Overflow Enterprise, I pass the value as X-API-Key in the headers. This does not work for the public Stack Overflow API.
Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.Visit Stack Exchange
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It only takes a minute to sign up.Sign up to join this community
As far as I know (I've seen quite a lot of API implementations), this is not possible. You either provide it in the URL (for GET calls) or in the request body (for POST calls).
This might be an XY problem; why do you want to avoid using query parameters? Because you have some logging mechanism, and you want to exclude the token? Then you could adjust the logging mechanism. You're probably using an HTTPS connection, which means everything after the domain name in the URL cannot be eavesdropped (unless you deliberately installed a tampered MITM certificate).
keyas query parameters.