2

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.

0

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).

| improve this answer | |
  • I did not want to append the key each time I made a request to Stack Overflow. I wanted to input the key once when registering my REST client. – Millicent Achieng Mar 4 at 15:01
  • Ah, I see. I just build a wrapper around the method that actually calls the API which inserts/adds access_token and key as query parameters. – Glorfindel Mar 4 at 15:03
  • This makes a lot of sense. Thank you. – Millicent Achieng Mar 4 at 16:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .