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.

At what rate are you hitting the API?

Steve

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

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

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’.

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

Thanks

Steve

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.

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

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

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.

Hello, I am also facing the same problem regarding the API. It appears that my code runs fine for a period and, at a random request attempt, I start getting 403 errors. It does not appear that I am blocked until a certain point which, I should mention, is below the 600 requests per 5 minutes for an API Key.