# View your request count for rate limiting

**URL:** <http://forum.companieshouse.gov.uk/t/view-your-request-count-for-rate-limiting/2880>\
**Category:** Uncategorized\
**Created:** [February 19, 2020, 10:44am UTC](http://forum.companieshouse.gov.uk/t/view-your-request-count-for-rate-limiting/2880 "2020-02-19T10:44:27Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [February 20, 2020, 12:08am UTC](http://forum.companieshouse.gov.uk/t/view-your-request-count-for-rate-limiting/2880/3 "2020-02-20T00:08:01Z")

</div>

Are you referring to the Streaming API or the main/document REST API?

**Main API**  
Although not listed in the documentation:

[https://developer.companieshouse.gov.uk/api/docs/index/gettingStarted/rateLimiting.html](https://developer.companieshouse.gov.uk/api/docs/index/gettingStarted/rateLimiting.html)

…I thought this was available via the http headers? I thought the `X-Ratelimit-...` fields were what we should use for this purpose - or will things change?

Roughly as in the thread:

[https://forum.aws.chdev.org/t/how-is-rate-limiting-implemented/140](https://forum.aws.chdev.org/t/how-is-rate-limiting-implemented/140)

For what it’s worth I just checked and this still seems functional:

```
curl -uMY_API_KEY: -I "https://api.companieshouse.gov.uk/company/NF004299"

HTTP/1.1 200 OK
Date: Wed, 19 Feb 2020 23:36:41 GMT
Content-Type: application/json
Content-Length: 1302
Connection: keep-alive
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: X-RateLimit-Query, origin, content-type, content-length, user-agent, host, accept, authorization
Access-Control-Expose-Headers: X-RateLimit-Window, X-RateLimit-Limit, X-RateLimit-Remain, X-RateLimit-Reset, Location, www-authenticate, cache-control, pragma, content-type, expires, last-modified
Access-Control-Expose-Headers: Location,www-authenticate,cache-control,pragma,content-type,expires,last-modified
Access-Control-Max-Age: 3600
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Ratelimit-Limit: 600
X-Ratelimit-Remain: 599
X-Ratelimit-Reset: 1582155701
X-Ratelimit-Window: 5m
Server: CompaniesHouse

```

I also checked the documents as if I recall correctly they had separate rate limits some time ago - but I also recall reading something contradicting that more recently.

I believe there are some minor differences between the documents API and main API e.g. per the following thread:

[https://forum.aws.chdev.org/t/rate-limit-header-naming-issue/245](https://forum.aws.chdev.org/t/rate-limit-header-naming-issue/245)

Also see:  
[https://forum.aws.chdev.org/t/not-a-big-issue-format-of-x-ratelimit-window-rate-limit-window-value/1960](https://forum.aws.chdev.org/t/not-a-big-issue-format-of-x-ratelimit-window-rate-limit-window-value/1960)

My test (some info snipped):

```
curl -v -uMY_API_KEY: "https://frontend-doc-api.companieshouse.gov.uk/document/VuqbfmUhDPN8O3uo0FB8EZIQyCi9Fw_9YK3zwdrzWqs"

...

< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Content-Type: application/json
< Date: Wed, 19 Feb 2020 23:50:35 GMT
< Server: nginx/1.14.1
< X-Ratelimit-Limit: 600
< X-Ratelimit-Remaining: 597
< X-Ratelimit-Reset: 1582156298
< Content-Length: 485
< Connection: keep-alive

```

I believe the Python chwrapper library ([https://github.com/JamesGardiner/chwrapper](https://github.com/JamesGardiner/chwrapper)) uses this also (if anyone uses that).

**Streaming API**  
There doesn’t seem to be any information suggesting that you can check the rate limiting for the _streaming API_ however - if you get a “too many attempts” you just have to back off.

[https://developer-specs.companieshouse.gov.uk/streaming-api/guides/overview](https://developer-specs.companieshouse.gov.uk/streaming-api/guides/overview)

---

_[View the full topic](http://forum.companieshouse.gov.uk/t/view-your-request-count-for-rate-limiting/2880)._
