Help! API implementation Bug!

The API should check for an input email from API for and return breaches associated.
I can say i am almost success coz emails with less than 2 characters returns a success like gg@gmail.com but emails more than 3 returns this error:

{ "statusCode": 401, "message": "Access denied due to missing hibp-api-key." }

API SOURCE: Have I Been Pwned: API v3

Part i am trying to implement from source:

Getting all pastes for an account

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 paste model

Each paste contains a number of attributes describing it. In the future, these attributes may expand without the API being versioned. The current attributes are:
AttributeTypeDescriptionSourcestringThe paste service the record was retrieved from. Current values are: Pastebin, Pastie, Slexy, Ghostbin, QuickLeak, JustPaste, AdHocUrl, PermanentOptOut, OptOutIdstringThe ID of the paste as it was given at the source service. Combined with the “Source” attribute, this can be used to resolve the URL of the paste.TitlestringThe title of the paste as observed on the source site. This may be null and if so will be omitted from the response.DatedateThe date and time (precision to the second) that the paste was posted. This is taken directly from the paste site when this information is available but may be null if no date is published.EmailCountintegerThe number of emails that were found when processing the paste. Emails are extracted by using the regular expression \b+(?!^.{256})[a-zA-Z0-9.-+]+@[a-zA-Z0-9.-]+.[a-zA-Z]+\b

Sample paste response

Searching an account for pastes always returns a collection of the paste entity. The collection is sorted chronologically with the newest paste first.
[ { “Source”:“Pastebin”, “Id”:“8Q0BvKD8”, “Title”:“syslog”, “Date”:“2014-03-04T19:14:54Z”, “EmailCount”:139 }, { “Source”:“Pastie”, “Id”:“7152479”, “Date”:“2013-03-28T16:51:10Z”, “EmailCount”:30 } ]

Backed Code: NOTE i have just hidden API key and not XXXXX… as in the code

import {fetch} from 'wix-fetch';
export function getCurrentTemp(email) {
const url2 = "https://haveibeenpwned.com/api/v3/pasteaccount/"+email;
return fetch(url2, {method: 'get',
headers: {
'contentType': 'application/json',
'hibp-api-key':'xxxxxxxxxxxxxxxxxxxxx'
} })
.then(response => response.json())
//.then(function(res) {
///  console.log(res);//una get aje elements za wix? from the form?
//$w("#textRate").text = res.toString();
//})
//return fetch(fullUrl, {method: 'get'})
//.then(response => response.json())
//.then(json => json.main = json.toString());
//.then(json => $w("#textRate").text = json.rates[symbol].toString());
//.then(json=>$w("#textTemp").text = json.toString());
}

Front End Code:

import {getCurrentTemp} from 'backend/serviceModule';
//...
//export function buttonFetchRate_click(event) {
//getCurrentTemp($w("#textInputCity").value)
//.then(email => $w("#textTemp").text = email);
//}
export function buttonFetch_click(event, $w) {
//Add your code for this event here:
console.log("Retrieving information for " + $w("#emailInput").value);
$w("#textResults").text = "Retrieving information for " + $w("#emailInput").value;
getCurrentTemp($w("#emailInput").value)
.then(textResults => {
console.log
$w("#textResults").text =    "ID: " + textResults.Id+ "\n"
+ "Title: " + textResults.Title+ "\n"
+ "Source: " + textResults.Source+ "\n"
+ "date: " + textResults.Date+ "\n"
+ "Email Count: " + textResults.EmailCount+ "\n";
});
}

Corvid Error

@givemeawhisky
@Yisrael (Wix)
@Alexander (Wix)
@Anat Wix
@Brett Haralson (Wix)
@Amit (Wix)
@Mantas Sutkus (Wix)

Help!!

Ninjas…any assitance @givemeawhisky

If you are getting an error about your API key, then I would check that option out with your own API provider.

See here for more info about the hibp API.
https://www.troyhunt.com/authentication-and-the-have-i-been-pwned-api/
The API is Revving to Version 3 (and Has Some Breaking Changes)
With this change, I’m revising the API up to version 3. All documentation on the API page now reflects that and also reflects a few breaking changes, the first of which is obviously the requirement for auth. When using V3, any unauthenticated requests will result in an HTTP 401.

Also, note that the key is now a pay to use key only and you can’t get it for free, you have to have a subscription setup for the key.
https://haveibeenpwned.com/API/Key