I am fairly new to web development and using API's, and for some reason I keep getting a 401 "Access denied due to missing hibp-api-key." error when trying to use this one API for the website HaveIBeenPwned. I'm using Postman just to check the API, and here is what I am using: https://haveibeenpwned.com/api/v3/pasteaccount/foo%40bar.com%20hibp-api-key:%20XXXXXXXXXXXX #API Key was redacted at the end, and the email is a test email.
Can anyone tell me what I'm doing wrong, and why it keeps giving me an error? I've checked my API key a million times and I just don't know why this isn't working! Here is the documentation: https://haveibeenpwned.com/API/v3 It says:
The API takes a single parameter which is the email address to be searched for. The email is not case sensitive and will be trimmed of leading or trailing white spaces. The email should always be URL encoded. This is an authenticated API and an HIBP API key must be passed with the request.
GET https://haveibeenpwned.com/api/v3/pasteaccount/{account} hibp-api-key: [your key]
The key needs to be passed in the header per the docs here: https://haveibeenpwned.com/API/v3#Authorisation
The key is then passed in a "hibp-api-key" header:
GET https://haveibeenpwned.com/api/v3/{service}/{parameter}
hibp-api-key: [your key]