# HTTP 401 failure when querying the API for company officers

**URL:** <http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163>\
**Category:** API Issues\
**Created:** [July 9, 2024, 9:43am UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163 "2024-07-09T09:43:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![devops2](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/f19dbf/32.png) [@devops2](http://forum.companieshouse.gov.uk/u/devops2)\
**Post date:** [July 9, 2024, 9:43am UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/1 "2024-07-09T09:43:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![devops2](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/f19dbf/32.png) [@devops2](http://forum.companieshouse.gov.uk/u/devops2)\
**Post date:** [July 9, 2024, 9:44am UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/2 "2024-07-09T09:44:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![devops2](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/f19dbf/32.png) [@devops2](http://forum.companieshouse.gov.uk/u/devops2)\
**Post date:** [July 10, 2024, 9:55am UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/3 "2024-07-10T09:55:25Z")

</div>

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]`

---

<div class="post-metadata">

**Author:** ![devops2](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/f19dbf/32.png) [@devops2](http://forum.companieshouse.gov.uk/u/devops2)\
**Post date:** [July 11, 2024, 11:29am UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/4 "2024-07-11T11:29:40Z")

</div>

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]`

---

<div class="post-metadata">

**Author:** ![MArkWilliams](http://forum.companieshouse.gov.uk/user_avatar/forum.companieshouse.gov.uk/markwilliams/32/194_2.png) [@MArkWilliams](http://forum.companieshouse.gov.uk/u/MArkWilliams)\
**Post date:** [July 11, 2024, 11:47am UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/5 "2024-07-11T11:47:39Z")

</div>

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](https://api.company-information.service.gov.uk/officers/90CVzKlLYcWpX1dnibRPuKqpKgI/appointments)

---

<div class="post-metadata">

**Author:** ![devops2](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/f19dbf/32.png) [@devops2](http://forum.companieshouse.gov.uk/u/devops2)\
**Post date:** [July 11, 2024, 12:40pm UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/6 "2024-07-11T12:40:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MArkWilliams](http://forum.companieshouse.gov.uk/user_avatar/forum.companieshouse.gov.uk/markwilliams/32/194_2.png) [@MArkWilliams](http://forum.companieshouse.gov.uk/u/MArkWilliams)\
**Post date:** [July 11, 2024, 1:00pm UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/7 "2024-07-11T13:00:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![devops2](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/f19dbf/32.png) [@devops2](http://forum.companieshouse.gov.uk/u/devops2)\
**Post date:** [July 12, 2024, 9:43am UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/8 "2024-07-12T09:43:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![brendan.kitley](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/b/f4b2a3/32.png) [@brendan.kitley](http://forum.companieshouse.gov.uk/u/brendan.kitley)\
**Post date:** [July 12, 2024, 10:02am UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/9 "2024-07-12T10:02:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Countingup](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/c/cdc98d/32.png) [@Countingup](http://forum.companieshouse.gov.uk/u/Countingup)\
**Post date:** [July 12, 2024, 10:49am UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/10 "2024-07-12T10:49:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pedro](http://forum.companieshouse.gov.uk/user_avatar/forum.companieshouse.gov.uk/pedro/32/1507_2.png) [@pedro](http://forum.companieshouse.gov.uk/u/pedro)\
**Post date:** [July 15, 2024, 8:39am UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/11 "2024-07-15T08:39:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MArkWilliams](http://forum.companieshouse.gov.uk/user_avatar/forum.companieshouse.gov.uk/markwilliams/32/194_2.png) [@MArkWilliams](http://forum.companieshouse.gov.uk/u/MArkWilliams)\
**Post date:** [July 15, 2024, 9:43am UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/12 "2024-07-15T09:43:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![devops2](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/f19dbf/32.png) [@devops2](http://forum.companieshouse.gov.uk/u/devops2)\
**Post date:** [July 15, 2024, 1:18pm UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/13 "2024-07-15T13:18:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aleosd](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/a/8baadc/32.png) [@aleosd](http://forum.companieshouse.gov.uk/u/aleosd)\
**Post date:** [July 15, 2024, 3:07pm UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/14 "2024-07-15T15:07:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![devops2](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/f19dbf/32.png) [@devops2](http://forum.companieshouse.gov.uk/u/devops2)\
**Post date:** [July 16, 2024, 1:44pm UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/15 "2024-07-16T13:44:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aleosd](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/a/8baadc/32.png) [@aleosd](http://forum.companieshouse.gov.uk/u/aleosd)\
**Post date:** [July 16, 2024, 2:11pm UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/16 "2024-07-16T14:11:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MArkWilliams](http://forum.companieshouse.gov.uk/user_avatar/forum.companieshouse.gov.uk/markwilliams/32/194_2.png) [@MArkWilliams](http://forum.companieshouse.gov.uk/u/MArkWilliams)\
**Post date:** [July 16, 2024, 3:17pm UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/17 "2024-07-16T15:17:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![devops2](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/f19dbf/32.png) [@devops2](http://forum.companieshouse.gov.uk/u/devops2)\
**Post date:** [July 17, 2024, 9:31am UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/18 "2024-07-17T09:31:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![devops2](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/f19dbf/32.png) [@devops2](http://forum.companieshouse.gov.uk/u/devops2)\
**Post date:** [July 18, 2024, 9:32am UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/19 "2024-07-18T09:32:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![devops2](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/d/f19dbf/32.png) [@devops2](http://forum.companieshouse.gov.uk/u/devops2)\
**Post date:** [July 19, 2024, 10:53am UTC](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163/20 "2024-07-19T10:53:19Z")

</div>

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

[Next page](http://forum.companieshouse.gov.uk/t/http-401-failure-when-querying-the-api-for-company-officers/8163.md?page=2)
