Searching Using Curl returns only 20 results a Page

Documentation is at https://developer.companieshouse.gov.uk/api/docs/search/search.html

You need something like (e.g. for “lloyds”):

curl -u{APIkey} "https://api.companieshouse.gov.uk/search?q=lloyds&items_per_page=30&start_index=0"

You obviously need your own API key - which should end in a colon - instead of {APIkey} here.
Check the “items_per_page” field in the response to ensure you did get back 30 results (or count 'em!).
To get the next 30:

curl -u{APIkey} "https://api.companieshouse.gov.uk/search?q=lloyds&items_per_page=30&start_index=30"

You’ll also probably be interested in the “total_results” field.
(By the way - if you are just interested in companies or officers, you can limit the search to these by using /search/companies or /search/officers instead of /search).

The general syntax is as per a standard RESTful API:

curl -u{APIKEY} "{restURI}"

(Obviously see curl docs if you e.g. need to get the http header instead etc.)
Where (to spell it out):

  • {APIKEY} is your API username followed by a colon.
    The format used by cURL is actually username:password but CH just give you a username and no password.
  • {restURI} - note you’ll want to enclose this in quotes for windows command line / unix shells.
    This is:
  • The URI for the appropriate end point. The first part is either:
    For main API - https://api.companieshouse.gov.uk/
    For Document API - http://document-api.companieshouse.gov.uk/
    So for search (all), you want https://api.companieshouse.gov.uk/search
  • Search takes the following query parameters:
    search?q={term}&items_per_page={ipp}&start_index={start}
  • {term} is the string you’re searching for (obviously, if that includes URI “special characters” like “?”, “&” etc. these need percent encoding)
  • {ipp} is the number of items you want back (note - this doesn’t guarantee you’ll get as many as this).
  • {start} is the item in your search results to start with (zero-based I believe).

Many CH endpoints use start_index and Items_per_page to step through potentially large data sets - a quick search on this forum will show you various ways to do this e.g.:

You’ll also find out about limits in some cases which are not currently documented in the main documentation.