Search by postcode?

I’ve been using the API to perform searches on company names and would like to search based on company postcode.

Another post on this forum states that you can simply use the postcode as the query when searching.

For example:

https://api.company-information.service.gov.uk/search/companies?q=gu112pw

While this works (it returns all companies with a registered address at the GU11 2PW postcode), the search performed appears to be fuzzy and is also returning GU11 XXX and XXX 2PW postcodes.

Is there a way to prevent this?

Many thanks,

Alex

Hello there, I’m not from Companies House but as far as I know you’ll have to filter these yourself from the data. The alternatives are essentially maintaining your own index of Companies House (from the bulk data / streaming data) or searching around to find one of the 3rd parties who digest the data and can provide you with different search interfaces.

There was a comment from this (2017 mind…) by Companies House:

The search is not a simple search through a couple of fields, it is a complex search with parsed search terms against a pre-built index of multiple fields and combinations of fields, utilising partial matching, inverted-indexes, frequency algorithms, cadence, weighted scores, fuzzy matching, stemming, synonyms, company name ending synonyms (English and Welsh), soundex etc.

I’m not aware of any changes after that reply (see full details in thread below) about how the search works. They’ve also repeatedly said that even though there are APIs as well as the web site they are more focussed towards something like “general enquiries by members of the public” than the various requirements of researchers, marketeers, firms needing automatic data verification etc. However there clearly have been - some - changes since 2017 - so if anyone else knows more I hope they’ll post.

Also see (different search):

I am new on this forum. I do not know if it is fine to leave some information about me here, or is it enough just to say hello

I’m searching with the postcode as you have done, and then for each item return I’m checking if the postcode is in the “address_snippet” field. I’m also setting items per page.

https://api.company-information.service.gov.uk/search/companies?items_per_page=1&q=gu112pw%2033