Company search endpoint returning no results

Good morning,

We started to get no results for any request to the following endpoint Companies House Public Data API: Search companies

Another thing observed is sometimes we don’t get a response back at all, and one of the attempts I made i’ve canceled it after 3 minutes.

Were there any changes introduced early hours in the morning which may have caused this endpoint to return no results at all?

Example of response we are getting:

{
    "items": [],
    "kind": "search#companies",
    "page_number": 1,
    "items_per_page": 20,
    "total_results": 0,
    "start_index": 0
}

Thanks,
Tiago

From what we could find, this endpoint spec have changed, breaking our implementation of it.

We used to send any parameters as x-www-form-urlencoded and now it only accepts them as query string parameters.

I couldn’t find any mention of this breaking change, so can you please confirm if this was part of the changes deployed this morning?

@MArkWilliams tagging you for visibility as you’ve been able to provide some additional info in the past and escalate it internally. Appreciate any help/info.

Thanks

I’m also seeing issues on this endpoint starting today, so it’s not just you.

Same issue here, all searches return a 404 error. Example request below:

curl --location 'https://api.companieshouse.gov.uk/search/companies/?q=test&items_per_page=50' \
--header 'Authorization: Basic #######' 

(Reply to @glenn - not related to the original issue I think)

Ah - you may have run into the “trailing ‘/’ issue” here.

This has been working for me just fine, but it doesn’t work if I use your URL. However with a tiny modification it works. Your version (I’ve rearranged the curl command / get curl to calculate the header):

 curl -u MY_API_KEY: 'https://api.companieshouse.gov.uk/search/companies/?q=test&items_per_page=50'
(Gives a 404 and no results)

 curl -u MY_API_KEY: 'https://api.companieshouse.gov.uk/search/companies?q=test&items_per_page=50'
{"items":[{"kind":"searchresults#company",...

If you remove the trailing “/” after companies this should work, as in my example.

This is a known issue in some places in the API.

BTW I believe the preferred hostname is now:
https://api.company-information.service.gov.uk

And not:
https://api.companieshouse.gov.uk

… but both still work.

2 Likes

That did the job, thank you for your help :+1:

We’ll update the host and fix any trailing / issues.