HTTP 401 failure when querying the API for company officers

Hi,

We have started getting HTTP 401 errors again out of the blue for officer requests, please see below:

Failed to query [https://api.company-information.service.gov.uk/company/12622660/officers?start_index=0&items_per_page=50]. HTTP Status [401]

Can this be investigated please as it’s affecting multiple customers on our end. Thank you.

Regards

2 Likes

Hi @MArkWilliams, just tagging you in hopes of an update for this issue, as it looks like you usually deal with the API problems

Please see yet another example:
Failed to query [https://api.company-information.service.gov.uk/officers/90CVzKlLYcWpX1dnibRPuKqpKgI/appointments?start_index=0&items_per_page=50]. HTTP Status [401]

We continue to receive 401s for different API keys, @MArkWilliams are you able to assist here please?

Failed to query [https://api.company-information.service.gov.uk/company/08560684/officers?start_index=0&items_per_page=50]. HTTP Status [401]

So sorry you seem to be having issues.
There are no current problems with our service and we have no other customers reporting issues either.
I can run both of your queries with a standard API key with no issues.
Are you able to access ANY of our API endpoints? Do you have the issue with all of your API keys or just some? Are you able to do a simple curl type call on a command line?
eg
curl : https://api.company-information.service.gov.uk/officers/90CVzKlLYcWpX1dnibRPuKqpKgI/appointments

Hi @MArkWilliams, thanks for your reply.

We are able to perform a curl request using one of the API keys that has been failing, and get a successful response, as per your recommendation.

We are getting these errors intermittently - for example we’ve registered a failure on 10-Jul-2024 12:47:31 BST, but a successful request on 10-Jul-2024 16:27:26 BST for the same API key, therefore it appears that the API keys are fine, but something in the CH system can randomly refuse to authorise our requests.

I hope this helps. If preferable, please point me to a customer support desk where I can raise a ticket for our account issue specifically.

Regards

Are you able to reproduce the 401 errors via your basic curl ?

Hi @MArkWilliams, apologies for the delay, yes we are actually:

After 10 or so hits, we got an auth error:curl -XGET -u <redacted> https://api.company-information.service.gov.uk/officers/90CVzKlLYcWpX1dnibRPuKqpKgI/appointments
{"error":"Invalid Authorization","type":"ch:service"} @ 10.38am

So we are able to be authorised most of the time, but sometimes CH API will randomly refuse to do so.

Regards

Hi @MArkWilliams.

We are getting the same issue.

We have an integration which loops over around 1,100 companies to return the Officers for each. (This has a one second delay between each query to ensure API limits are not exceeded). This was working successfully at 23:00 each night but failed on 27/06 for one night, then has failed consistently from 03/07 onwards.

I’ve been investigating today and am getting the “The remote server returned an error: (401) Unauthorized.” message at random times which I believe has been the problem over the last few days as nothing else has changed at our end.

Hopefully you can help.

Regards

We’re also seeing the same issue with intermittent 401 Unauthorized responses when trying to fetch the officers for a company from the API. There is no pattern to this that we can discern, it’s not related to specific companies nor does it occur at particular times.

We’ve seen 84 such failures in the last 24 hours, out of ~8.5K API calls, so it’s a small percentage failing.

I can confirm this issue as well; we have been experiencing exactly the same problem since your maintenance on the 6th of June.

Our app has been encountering a significant number of CompaniesHouse::AuthenticationError: Invalid API key - HTTP 401 errors. This is quite disruptive, as we are seeing around 60 such errors every day.

Could you please investigate this issue further? It has been persistent and is affecting our operations.

Thank you.

Thank you all for the additional information. It does help.
Is this 401 only related to officer API calls?

Hi @MArkWilliams,

It is also related to filing history and appointments API calls. Please see examples below:

Failed to query [https://api.company-information.service.gov.uk/company/12906723/filing-history?start_index=0&items_per_page=35]. HTTP Status [401]

Failed to query [https://api.company-information.service.gov.uk/officers/lmeQIUR5dAJe5St9wMkNlqTDfFM/appointments?start_index=0&items_per_page=50]. HTTP Status [401]

Regards

1 Like

@MArkWilliams thanks for answering questions and providing support here. Just to add a bit more on the issue:

We also use CH API for a variety of workflows and have random “401 Unauthorized” error while querying filling-history API. Everything else (general company info, officers, PSC) works well. It started on 25th June for us.

1 Like

Hi @MArkWilliams, can you please confirm whether this issue is actively being looked into?

Please do let us know if there’s a ticket somewhere to address this issue that we can follow for updates or if it’s just this forum thread.

Regards

Seems like a false alarm from me. Found bug on our side. Sorry :frowning:

Yes, this is being looked into. We have an internal ticket system where this is now logged.

2 Likes

Thank you @MArkWilliams!

Just as a FYI, this issue continues for us, the latest failure taking place at 2024-07-17 10:24:01,944 on our system, if that helps:

Failed to query [https://api.company-information.service.gov.uk/officers/uXM5cKq9ruGl1pNlvcoZ-zdvyfA/appointments?start_index=0&items_per_page=50]. HTTP Status [401]

Regards

Hi @MArkWilliams, sorry for pestering however as I’m unable to view the status of the internal ticket, would you mind providing an update on the progress here please? This issue is affecting quite a few of our customers. Please also see below for another error today:

Failed to query [https://api.company-information.service.gov.uk/company/14939699/officers?start_index=0&items_per_page=50]. HTTP Status [401]

Regards

Hi @MArkWilliams, has there been any updates on this issue please? We have further failures still coming through:

Failed to query [https://api.company-information.service.gov.uk/company/10639447/officers?start_index=0&items_per_page=50]. HTTP Status [401]

Regards