Fetching data using specific date range

I have a query that Please let me know if this option is available or not in companies house the query is if there are specific start date and end date parameters that can be included in the API call in order to retrieve the specific range of data. Actually I’m trying to fetch datas within last 2-6 month data from the companies house and put it into a third party application named zoho crm. Please help me to come up with a solution for this.
Any help would be much appreciated.

Short answer - not easily.

The Companies House APIs are designed for finding out how things are now and for specific queries (e.g. “what filings have company x made?”). The data is either reported “as it is right now” (the Public Data API) or you can be notified of every new change as it happens (streaming API).

Question: when you say “last 2-6 month data from the companies house” what data? What things within 2-6 months are you expecting to find?

Changes in companies are accompanied by a Filing. As far as I’m aware there isn’t a historic archive of this. You can of course find this for a given company (the Filing History List) and then parsing the entries there (there isn’t a date filter).

However it sounds like you want this for “all companies” or “most companies”. That approach isn’t scalable for “all the data” and indeed Companies House have stated the API is not for just “downloading all the data” - you’ll find you hit the rate limit quickly!

There are bulk downloads of certain kinds of company data where you might be able to do a date-limited search, by downloading these (large!) data sets then parsing them yourself. These are available in different places and in different formats! See the handy 3rd party guide by @ebrian101 (and a list of all data files you can request here)

Again - it really depends on what you think you want to search for. So for example if you were simply interested in finding companies incorporated or dissolved within a certain date range you CAN do that via the API (this is the only date-filtered part I can think of). See Companies Advanced Search (try it online here)

Perhaps look through the documentation for the APIs here?

1 Like

Thank you for your prompt reply. We are currently attempting to locate data for companies registered within a specific time period[2-6 month]. Is it possible to do so? We attempted to retrieve information using the date range in the API, but we only received data for companies registered in 1968.

See Companies advanced search documentation. You should be able to do this by setting the parameters:

incorporated_from
and
incorporated_to

These are dates in the format YYYY-MM-DD

For example (using curl) I just ran a query for “all companies incorporated in the current month”:

curl -u MYAPIKEYHERE: 'https://api.company-information.service.gov.uk/advanced-search/companies?incorporated_from=2024-07-01&incorporated_to=2024-07-24'

… which finds 50238 results (hits).

Note that:

a) Companies House will not let you request more than 5000 results (at once). There is a “paging” mechanism for data sets - if you don’t get all the results back you can request the next “page” of data by setting the start_index parameter (starts from zero) and the size parameter (how many results you want). The start_index should be a multiple of size. Note that Companies House may or may not give you what you request so count how many results you actually get back and adjust your next request accordingly!

b) There is also a limit on the highest result you can request. That actually varies by the endpoint (what part of the API you are calling). For the advanced search I’m not 100% certain but I think that is 10000. So if you have more hits than that you won’t even be able to get all those results back. Not even by requesting 5000 at a time! (If you set start_index to 10000 you may receive an error - I get a message with a 500 error in the body if I do so).

Again - Companies House have repeatedly stated that the point of their APIs is not so people can just mine their data set. So if you’re trying to do that beware - you may be blocked for unacceptable use. (However I think their main mechanism for limiting overuse is just the rate limiting for API calls).

…however I would imagine you could simply design your script to work around the limits:
e.g. request a small date range (say a couple of days or even a day). If this gives you less than 10000 hits, page (as necessary) through the results. If more than 10000 and you’ve requested more than a single day’s results decrease the date range and retry, or add some other restriction. Then request your next date range etc.

Make sure you stay within the rate limits for requests or you will get blocked! (For information on that read the documentation (CH documentation), then search the forum (magnifying glass icon at the top right of this page).

That is around 466,870 companies created between your Start Date of 2024-01-01 and End Date of 2024-06-30 including the 1,673 already dissolved.

Third party support may help you achieve your goal economically and in timely fashion. We hold all the data you are looking for and have previously provided various levels of support for the initial population of Zendesk, Hubspot and Salesforce CRM platforms.