It seems the API responses do not include the CORS allow origin header.
The OPTIONS response does though.
Is this expected behavior?
Firefox screenshot
Sample code:
searchForm.onsubmit = _ => searchOfficer(searchForm.querySelector("input").value);
function searchOfficer(input) {
fetch(`https://api.company-information.service.gov.uk/search/officers?q=${input}`, {
headers: {
"Authorization": "basic REDACTED"
},
}).then(r => alert(Object.keys(r)))
return false
}
Chrome screenshot showing the same:

Have you added your origin in the “Manage applications” API key management facility on Companies House website: https://developer.company-information.service.gov.uk/manage-applications ?
You need to specify allowed origins for the api key you’re using.
1 Like
Hi ebrian101, thanks for the suggestion
I wasn’t aware of this.
I’ve added the domain under the application’s “JavaScript domains” but I’m still seeing the same error
Works now, must have taken a minute for the change to propagate
Thanks ebrian101!