403 Forbidden API

I have used the Companies House API service in order to gather data about UK companies in June without any problem. However, during the last days, I am getting the 403 status code when sending request with the API.

I have read some documentation about this issue. I read that other users had a similar issue (ex: 403 Forbidden from API on one IP address). I know that there is a rate limit in the API usage, which I always respected. I am then wondering whether this block is due to my inactivity in the API key usage. I would then like to know whether I can be unblocked.

Thanks.

1 Like

At what rate are you hitting the API?

Steve

1 Like

I set 0.5 seconds in line with the Companies House rate-limiting (https://developer.companieshouse.gov.uk/api/docs/index/gettingStarted/rateLimiting.html).

1 Like

We do not block API Keys if they have been inactive. Are you able to submit a single response to the API and get data returned? Initially I would expect to see a 429 returned if you are exceeding your rate limit.

But it would help us diagnose if you can confirm that single transactions are working

steve

1 Like

I am not able to submit a single to the API and get the data returned.

This is an example of my request I sent from my script in Python:

import requests
import json
url = β€œhttps://api.companieshouse.gov.uk/search/companies?q={}”
query = β€œtesco”
api_key = β€œxyz111” #Not true key
response = requests.get(url.format(query), auth=(api_key,’’))

The status_code parameter in the response variable is β€˜403’.

1 Like

Are you able to share your source IP address please in order that I can check further details ourside.

Thanks

Steve

1 Like

I just realised that the IP address I was using now was the root of the problem. I was using my IPv4 address, rather than my public address. Now I can send the requests to Companies House. I write here this as other users may face similar issues.

1 Like

HI, sudden we start getting 403 status error on below API
https://api.companieshouse.gov.uk/search/companies?q=hcl

can you please help to resolve this error.

Regards
Ajey SIngh

1 Like

Hi - 403 is normally a sign on you exceeding the rate limits applied. Could you please provide whether you are using the API and what is the source IP address and I will investigate further

Many thanks

Steve

1 Like