Search code examples
asp.net-mvcapi-key

Where should I place my API keys?


I'm building a Web API that will require a developer or API key for access. Is it better to require the API key be in the querystring or in the request headers?

ASP.NET Web API 4


Solution

  • In general I think a request header is optimal, but if you're planning to have your API called from a browser you should use a request parameter: it is often harder to do request headers from browser code than from server side code.