The error you're encountering typically arises when Power BI does not receive the API key name. Ensure that you correctly include both the API key and the API key name in your request. For Azure API Management, the header name for the API key is often "Ocp-Apim-Subscription-Key", but you should verify the exact name required by your specific API.
In some cases, users create a Power Query function to authenticate and call the authentication URL. This function retrieves the bearer token, which is then used in subsequent queries. An example of such a function includes creating a token combining the API key and making a web request to the authentication URL.
If you're still encountering errors, double-check the accuracy of your API key and key name. Additionally, make sure that the API endpoint URL is correct and that the API is accessible.
for further details
you can check the following discussion:
https://community.fabric.microsoft.com/t5/Power-Query/Web-API-Key-Authentication/td-p/2389219
https://community.fabric.microsoft.com/t5/Desktop/Get-Data-through-API/m-p/369917