Not sure if this helps but the most likely cause would be a required parameter not being passed (as long as the API key is working - always worth a check by requesting another endpoint!)
Using the API (calling from curl) at I was not able to reproduce the issue as you described it (1).
However while cutting and pasting from your examples I did sometimes get another odd error (2).
While I can’t get a 400 - that code would suggest that the server was getting parameters but was missing a required one or otherwise couldn’t make sense of it. The only thing I can suggest is that your environment was doing something with the “&” or “_” or “=” so that the server was effectively receiving something like “GET /dissolved-search/companies?q=querty” and no (or improperly formed) search_type
? (If it doesn’t get one as noted below it will give a 400 response - although I think this is actually a http 200 response code with the “400” in the body?).
Playing around with dropping some or all of the last parameter:
curl -u MY_API_KEY_HERE: "https://api.company-information.service.gov.uk/dissolved-search/companies?q=querty&search_type="
Invalid url parameter for search_type, please try 'alphabetical', 'best-match' or 'previous-name-dissolved'
curl -u MY_API_KEY_HERE: "https://api.company-information.service.gov.uk/dissolved-search/companies?q=querty&search_type"
Invalid url parameter for search_type, please try 'alphabetical', 'best-match' or 'previous-name-dissolved'
curl -u MY_API_KEY_HERE: "https://api.company-information.service.gov.uk/dissolved-search/companies?q=querty&"
{"timestamp":"2024-12-30T13:04:49.526+00:00","status":400,"error":"Bad Request","path":"/dissolved-search/companies"}
curl -u MY_API_KEY_HERE: "https://api.company-information.service.gov.uk/dissolved-search/companies?q=querty"
{"timestamp":"2024-12-30T13:04:52.603+00:00","status":400,"error":"Bad Request","path":"/dissolved-search/companies"}
curl -u MY_API_KEY_HERE: "https://api.company-information.service.gov.uk/dissolved-search/companies?q=querty&search"
{"timestamp":"2024-12-30T13:18:46.426+00:00","status":400,"error":"Bad Request","path":"/dissolved-search/companies"}
Hope this helps.
- I also played around with other values. All seems at first glance to work as expected e.g. if I left out the
search_type
parameter I received a http body with a JSON object with "status": 400, "error":"Bad Request"
. If I tried a search which found nothing I got an http response code with 404 and no body etc.
(2) Odd error / inconsistency:
curl -u MY_API_KEY_HERE: "https://api.company-information.service.gov.uk/dissolved-search/companies?q=querty&search_type=alphabetical"
{"timestamp":"2024-12-30T12:49:15.487+00:00","status":500,"error":"Internal Server Error","path":"/dissolved-search/companies"}
Weirdly - if I copied the curl command from the terminal screen, pasted it and re-ran it, it worked OK! I tried checking for non-standard encodings / odd characters but I can’t seem to see any - typing the request myself and copy-pasting look the same in the terminal and some other tools don’t show any differences…
No idea what is going on there…