API returns no match for 48839 but does for 00048839. Is there a specification for Company Numbers?

Whilst it’s unlikely that a user would enter ‘48839’ if their company number is ‘00048839’, it would be nice to be able to pad the number where possible before calling the Companies House API. In the absence of a specification though it would be better not to edit the value at all.

Does anyone know what the specifications for the company number field are, or has Companies House published the Regular Expression?

Many thanks,
Jays

This is general advice for anyone handling company numbers…

The expectation is that the API will be navigated from search, which provides the appropriate links:{} sub-document containing the correct company profile API URI (with a correctly formatted company number).

If you bypass the search, then the expectation is that you know what the company number is - you must have got it from somewhere, right? :smile:. So (rhetorically) why is your company number missing characters?

Sometimes the answer to the above is that a developer has stored the company numbers in a database as a numeric, which drops the leading zeros. But that is bad, because company numbers are alphanumeric, despite being called “numbers”. For example, FC000002.

Other times it is that in the handling/processing of the company number stripped the leading zeros if they looked like numbers (classically seen when a spreadsheet has been involved somewhere along the chain, but there are other cases).

Lastly, it is because the company number has been manually typed in by a human, who “tidied it up” by skipping the leading zeros. In this case, a company number such as FC000002 is very likely to have been typed in correctly, whereas 00000002 is not.

Just some things to think about to help prevent company numbers from being modified.

Now, the following scheme is not infallible, but since the current format is eight alphanumeric characters, if you have a number which is 7 characters or less, then prefix it with leading zeros. If you have a number which begins with two alphabetic charactes, such as FC2, then you need to pad the inner characters, giving FC000002.

Like I said, it is not infallible (and will change in the future when we start running out), so a far better approach is to make sure that your company numbers are entered and stored correctly in the first place.

@jays_shortt When a user types in a company number, can you not route that through the search API (which will analyse the search term and “fix” the company number as best it can)? You can use this to give the user visual feedback that they have chosen the correct company, and also allow them to type in a company name if they don’t have the company number.

And yes, you are correct, it would be better not to edit the company number at all!

The padding advice in my previous response should usually work.

Thanks for the response - :slight_smile: