Just as a check before doing anything further - did you ensure that the url you’re using and your API key work from the place you’re actually running this? I would make sure to do this first - again I’d use a simple command line tool ideally e.g. curl. The curl syntax here would be:
curl -uYOUR_API_KEY: “https://api.company-information.service.gov.uk/company/00000006”
The -u flag means “use http Basic authentication with the following username and password. Note the colon (”:") after the API key. This is because the format for http Basic (as provided to curl) is to have a username and password separated by the colon. For Companies House API the API key is the username and there is no password.
(You shouldn’t need the Accept=“application/json” - it won’t do any harm though).
As long as that works then you can go to the next part. I know nothing about Power BI specifically, but it looks like it provides support for several “methods” of authentication (Web.Contents - PowerQuery M | Microsoft Learn). I notice that you’re using:
Authorization=“api-key XXX…
…in your code example and in your screenshots you’ve selected “Web API”.
From the Companies Hosue documents, what you need is “http Basic authentication”. (See my note about that in the part about curl above).
In your screenshots you’ll see there is also a “Basic” option. I believe this is what you’ll need. Again - the username is your API key and there is no password (so that will be blank). It may be that Power BI doesn’t let you have a blank password - I don’t know. If that is true then you’ll only be able to do this via code.
In your code you also should use the appropriate format for http Basic (not “api-key”). I don’t know if Power BI has some specific format for headers but generally when writing a http Basic header, you’ll need to follow the format as given in e.g. the Wikipedia article:
‘Authorization: Basic {credentials}’, where {credentials} is the Base64 encoding of ID and password joined by a single colon ‘:’
So to say this again you’ll need to do your own Base64 encoding. This is unlike when you type the API key into the username box on the “Basic” screen - where presumably Power BI will do the encoding for you.
Good luck.