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

This error indicates that the server has determined that you are not allowed access to the thing you’ve requested, either on purpose or due to a misconfiguration . It’s probably because the site owner has limited access to it and you don’t have permission to view it. The vast majority of the time, there’s not much you can do to fix things on your (*client) end. There are four common causes for 403 Forbidden error (server side) . Here they are listed from most likely to least likely:

  • An empty website directory
  • No index page
  • Incorrect settings in the .htaccess file
  • Permission / Ownership error

If authentication credentials were provided in the request, the server considers them insufficient to grant access. The client SHOULD NOT automatically repeat the request with the same credentials. The client MAY repeat the request with new or different credentials. However, a request might be forbidden for reasons unrelated to the credentials.