# API Rate Limit increase

**URL:** <http://forum.companieshouse.gov.uk/t/api-rate-limit-increase/1415>\
**Category:** Documentation Issues\
**Created:** [October 25, 2017, 9:10am UTC](http://forum.companieshouse.gov.uk/t/api-rate-limit-increase/1415 "2017-10-25T09:10:43Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![dave1](http://forum.companieshouse.gov.uk/user_avatar/forum.companieshouse.gov.uk/dave1/32/456_2.png) [@dave1](http://forum.companieshouse.gov.uk/u/dave1)\
**Post date:** [October 25, 2017, 9:10am UTC](http://forum.companieshouse.gov.uk/t/api-rate-limit-increase/1415/1 "2017-10-25T09:10:43Z")

</div>

Hi,

There’s a page in the documentation about the rate limit and how users should get in touch if they want to increase it. It would probably be worth adding a contact email address to that page so we don’t have to clog up the forum with requests.

Also, would it be possible for someone to get in touch to discuss the rate limit please?

Thanks,

Dave

---

<div class="post-metadata">

**Author:** ![si1](http://forum.companieshouse.gov.uk/user_avatar/forum.companieshouse.gov.uk/si1/32/481_2.png) [@si1](http://forum.companieshouse.gov.uk/u/si1)\
**Post date:** [November 7, 2017, 8:47am UTC](http://forum.companieshouse.gov.uk/t/api-rate-limit-increase/1415/2 "2017-11-07T08:47:23Z")

</div>

Hi,

I was about to ask the same question when I saw this.

Could someone please confirm how users should contact companies house to apply for a rate limit increase?

Cheers

Si

---

<div class="post-metadata">

**Author:** ![david](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](http://forum.companieshouse.gov.uk/u/david)\
**Post date:** [July 10, 2018, 7:43pm UTC](http://forum.companieshouse.gov.uk/t/api-rate-limit-increase/1415/3 "2018-07-10T19:43:10Z")

</div>

Ditto. I haven’t used my app for a little while (a bit of a stall in the development process) and as I try it now, I find it works fine for the first 85 or so lookups, then fails on a bunch, and then starts working again after presumably the CH server has paused for breath, whereas it used to work fine.

The app is just checking for live updates on CS01 and AA filing deadlines on a hundred or so companies, which is well below the documented rate limit.

As the list of companies grows, I will move towards the rate limit, but in the first instance, need a resolution on the missing responses, please.

---

<div class="post-metadata">

**Author:** ![SteveBowen](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/s/97f17d/32.png) [@SteveBowen](http://forum.companieshouse.gov.uk/u/SteveBowen)\
**Post date:** [July 10, 2018, 8:10pm UTC](http://forum.companieshouse.gov.uk/t/api-rate-limit-increase/1415/4 "2018-07-10T20:10:36Z")

</div>

What error are you getting?.

---

<div class="post-metadata">

**Author:** ![david](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](http://forum.companieshouse.gov.uk/u/david)\
**Post date:** [July 10, 2018, 9:46pm UTC](http://forum.companieshouse.gov.uk/t/api-rate-limit-increase/1415/5 "2018-07-10T21:46:37Z")

</div>

…so I get the data back for the first 85 results or so, and then no results for the next (guessing) 30, and then results start coming through again.

There is no error reported per se (at least not that I can see), but there is simply no company object being returned for those 30 results. Maybe there is a way to get additional error reporting, but I have (PHP) errors, warnings and notices all enabled on the test server.

What is strange is that it worked previously, and I have carefully reviewed the code. There’s no way the requests can change between the first and last sets - they’re all within the same loop, which made me wonder whether CH had changed the rate limit.

---

<div class="post-metadata">

**Author:** ![SteveBowen](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/s/97f17d/32.png) [@SteveBowen](http://forum.companieshouse.gov.uk/u/SteveBowen)\
**Post date:** [July 10, 2018, 9:58pm UTC](http://forum.companieshouse.gov.uk/t/api-rate-limit-increase/1415/6 "2018-07-10T21:58:33Z")

</div>

No rate limit remains as it was 600 requests per 5 minute period. Perhaps we can pick this up in the morning.

---

<div class="post-metadata">

**Author:** ![david](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](http://forum.companieshouse.gov.uk/u/david)\
**Post date:** [July 11, 2018, 12:25pm UTC](http://forum.companieshouse.gov.uk/t/api-rate-limit-increase/1415/7 "2018-07-11T12:25:14Z")

</div>

So my lookup is: $profile = CompanyProfileSearch($companyNumber, $key);  
Results 0-19 were fine (results are all LTD companies)  
Results 21-31 were null (results are all LTD companies again)  
Result 32 was fine (a LLP)

I added a LTD company to the lookup list and it increased the null results up to 32.  
I added a LLP to the lookup list and it added a final successful query (so results 32 and 33 were then fine).

Where I mentioned the 85 lookups in my earlier post, I was referring to the items of data extracted (I’m pulling 4 items out of each profile. Hope that clarifies the disparity in numbers between this post and my previous.

---

<div class="post-metadata">

**Author:** ![david](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](http://forum.companieshouse.gov.uk/u/david)\
**Post date:** [July 11, 2018, 1:35pm UTC](http://forum.companieshouse.gov.uk/t/api-rate-limit-increase/1415/8 "2018-07-11T13:35:56Z")

</div>

The Notices (for the null lookups) reported are:  
Notice: Undefined property: stdClass::$company\_name in companiesHouseAPI.php on line 84  
Notice: Undefined property: stdClass::$confirmation\_statement in companiesHouseAPI.php on line 85  
Notice: Trying to get property of non-object in companiesHouseAPI.php on line 85  
Notice: Undefined property: stdClass::$confirmation\_statement in companiesHouseAPI.php on line 86  
Notice: Trying to get property of non-object in companiesHouseAPI.php on line 86  
Notice: Undefined property: stdClass::$accounts in companiesHouseAPI.php on line 87  
Notice: Trying to get property of non-object in companiesHouseAPI.php on line 87  
Notice: Trying to get property of non-object in companiesHouseAPI.php on line 87  
Notice: Undefined property: stdClass::$accounts in companiesHouseAPI.php on line 88  
Notice: Trying to get property of non-object in companiesHouseAPI.php on line 88  
Notice: Trying to get property of non-object in companiesHouseAPI.php on line 88

---

<div class="post-metadata">

**Author:** ![voracityemail](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/v/b77776/32.png) [@voracityemail](http://forum.companieshouse.gov.uk/u/voracityemail)\
**Post date:** [July 12, 2018, 6:13pm UTC](http://forum.companieshouse.gov.uk/t/api-rate-limit-increase/1415/9 "2018-07-12T18:13:43Z")

</div>

Just asking as we also use PHP to interact with the API. I’ve seen null properties returned by the API (when they shouldn’t be) and occasionally blank objects but nothing like you’ve described (as yet…). You’ve obviously got some processing going on in your (own?) API-handling code so I’m wondering

1. What is the REST request you’re making (e.g. what is the url + query string which actually gets sent to CH)?
2. Are you calling several times e.g. paging through a list using items\_per\_page and start\_index or are all results returned from one request?
3. What raw JSON data is being returned?
4. If you were using a library that is generally available, what is it?

---

<div class="post-metadata">

**Author:** ![david](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](http://forum.companieshouse.gov.uk/u/david)\
**Post date:** [July 12, 2018, 7:49pm UTC](http://forum.companieshouse.gov.uk/t/api-rate-limit-increase/1415/10 "2018-07-12T19:49:58Z")

</div>

1. I extract the profile as follows:  
$accessURI = “[https://api.companieshouse.gov.uk/company/$companyNumber](https://api.companieshouse.gov.uk/company/%24companyNumber)”;  
$curl = curl\_init();  
curl\_setopt($curl, CURLOPT\_USERPWD,$key);  
curl\_setopt($curl, CURLOPT\_URL, $accessURI);  
curl\_setopt($curl, CURLOPT\_RETURNTRANSFER, true);  
curl\_setopt($curl, CURLOPT\_CUSTOMREQUEST, ‘GET’);  
$profile = curl\_exec($curl);   
curl\_close($curl);  
return json\_decode($profile);

2. There is a loop which repeatedly calls to extract $profile, extracts the data and drops it into a temporary table.

3. Not had chance to test to review the raw JSON

4. It’s my own library. Not much use at the moment though!

---

<div class="post-metadata">

**Author:** ![voracityemail](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/v/b77776/32.png) [@voracityemail](http://forum.companieshouse.gov.uk/u/voracityemail)\
**Post date:** [July 13, 2018, 9:04am UTC](http://forum.companieshouse.gov.uk/t/api-rate-limit-increase/1415/11 "2018-07-13T09:04:33Z")

</div>

The test would be to dump the following after the `curl_exec`:

```
[ 'uri' => $accessURI,
'httpcode' => curl_getinfo ( $curl, CURLINFO_HTTP_CODE ),
'profile' => $profile ]

```

The `httpcode` to check if the request was valid - could be that:

- Company number was invalid - note that company numbers have to be 8 characters, left-padded with ‘0’ if less, and letters in uppercase.
- Company number didn’t exist in the CH API dataset. Not all companies do (see posts about missing ones / when CH remove ceased companies etc.)

Another possible is that since the function `json_decode` returns null if it can’t parse the input it could be the decoding. It could be the json returned is incorrect JSON - or at any rate JSON that your PHP’s version of `json_decode` can’t handle (I’m saying the last because I’ve encountered too many odd behaviours in PHP…BTW which version are you running?).

The errors seem to indicate (if they’re always the same) that json\_decode is indeed returning null here (try running ‘`null`’ and then ‘`{ }`’ through your code e.g. putting it into `json_decode` to compare).

See the PHP manual page on the `json_last_error()` function and particularly the `json_last_error_msg()` function in case you need to check if these are giving errors (in the comments there’s a script to provide a version if you’re at PHP \< 5.5). You could do:

```
// cast to string just in case, use @ since message can be raised
$profileObj = @json_decode( (string) $profile );
if ( JSON_ERROR_NONE !== json_last_error() ) {
    // throw an error or return 'JSON error: ' . json_last_error_msg();
    ...

```

A way to simplify a lot of this is using an http library e.g. [Guzzle](https://github.com/guzzle/guzzle). (Caveat - we don’t on this project but may move to it).

Of course in an ideal world, CH would publish their [Swagger spec](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md) / [OpenAPI spec](https://swagger.io/specification/) for the API and you’d be able to run Swagger Codegen to create all the code stubs to handle the basic communication. (In my experience of these it is never that simple of course…)

---

<div class="post-metadata">

**Author:** ![jessiedhanoa01](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/j/82dd89/32.png) [@jessiedhanoa01](http://forum.companieshouse.gov.uk/u/jessiedhanoa01)\
**Post date:** [June 17, 2024, 3:12pm UTC](http://forum.companieshouse.gov.uk/t/api-rate-limit-increase/1415/12 "2024-06-17T15:12:31Z")

</div>

Hi

Can someone contact me regarding increasing the limit per minute please
