Are you referring to the Streaming API or the main/document REST API?
Although not listed in the documentation:
...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:
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
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
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
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:
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) uses this also (if anyone uses that).
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.