Error fetching data from Companies House API: 400 Client Error: Bad Request for url: https://api.company-information.service.gov.uk/advanced-search/companies?company_name_includes=consulting&company_status=active&sic_codes=62020&size=100&start_index=0
No companies found matching the search criteria.
All i keep getting is this, I have a key, - not sure about the request, hopefully you can figure thus out
Hello @spencergreening674
I tried your request and got a result using postman (not too sure you need the ‘start_index=0’ as it will default to that value) – so I used;
https://api.company-information.service.gov.uk/advanced-Search/companies?company_name_includes=consulting&company_status=active&sic_codes=62020
Reply received ending with - “kind”:“search#advanced-search”,“hits”:14420}
Your issue, I think, will probably be with the Header you’re sending - so just a few things to check;
- The authorisation header you must use is in this format;
- Authorization Basic +{your key}
- The Key must be base64 encrypted
Sending an unencrypted key or an invalid format header will give the result you are receiving – Status 400 Bad Request.
Hope it helps. 