API randomly returning 401s & 503s

We apologise for the issues you have been experiencing over the last 36 hours.
we had a major release/deployment over the weekend and experienced severe service issues, mainly around authentication resulting in 502 type errors (and others)
We resolved this today (9th April 2024) approx 13:00hrs and continue to monitor and investigate exact causes.
Thank you for your patience.

Hello, we have been getting read timeout errors when trying to access the Profile API today (at 14.30, 14.49 and 15.04 BST).

The last successful response we received was also at 14.30pm. Are you aware of any issue going on at the moment?

EDIT this message was sent 4pm on April 8th but for some reason it didn’t actually get sent until a day after

Thanks

Service seems better but started getting timeouts again this morning. It seems to be intermittent though.

Hello.we are still facing issue whenever we call this URL
https://api.companieshouse.gov.uk/company/10363521/officers

{
  "statusCode": 406,
  "body": "",
  "headers": {
    "date": "Wed, 10 Apr 2024 14:22:17 GMT",
    "content-length": "0",
    "connection": "close",
    "access-control-allow-credentials": "true",
    "access-control-allow-headers": "X-RateLimit-Query, origin, content-type, content-length, user-agent, host, accept, authorization",
    "access-control-expose-headers": "X-RateLimit-Window, X-RateLimit-Limit, X-RateLimit-Remain, X-RateLimit-Reset, Location, www-authenticate, cache-control, pragma, content-type, expires, last-modified",
    "access-control-max-age": "3600",
    "set-cookie": [
      "JSESSIONID=6C7B46A31B39AB8B0E5AB3C07D0C210C; Path=/; HttpOnly"
    ],
    "x-ratelimit-limit": "600",
    "x-ratelimit-remain": "561",
    "x-ratelimit-reset": "1712758958",
    "x-ratelimit-window": "5m",
    "server": "CompaniesHouse"
  },
  "request": {
    "uri": {
      "protocol": "https:",
      "slashes": true,
      "auth": null,
      "host": "api.companieshouse.gov.uk",
      "port": 443,
      "hostname": "api.companieshouse.gov.uk",
      "hash": null,
      "search": null,
      "query": null,
      "pathname": "/company/12447079/officers",
      "path": "/company/12447079/officers",
      "href": "https://api.companieshouse.gov.uk/company/12447079/officers"
    },
    "method": "GET",
    "headers": {
      "Authorization": "Basic  OMITTED",
      "Accept": "text/json"
    }
  }
}

This URL works though:
https://api.companieshouse.gov.uk/company/10363521

I have just called that url and all works correctly.
your JSON contains the incorrect company number (12447079, it should be 10363521) do you have the correct output for the correct call?

output should look something like this:-
{
“active_count”: 2,
“etag”: “aa1ad050c2a65f25ee1f93edce84265d7a57c544”,
“items”: [
{
“address”: {
“address_line_1”: “17 Lonsdale Road”,
“country”: “United Kingdom”,
“locality”: “Weybridge”,
“postal_code”: “KT13 0TG”,
“premises”: “Dragonsrealm Ltd”
},
“appointed_on”: “2016-09-07”,
“is_pre_1992_appointment”: false,
“links”: {
“self”: “/company/10363521/appointments/TQ1d3t4jtDLK9O1rH7C03KJa9GI”,
“officer”: {
“appointments”: “/officers/sd42ClQLWsaRhCfKrud4K5DZA4U/appointments”
}
},
“name”: “QUINN, Adele”,
“officer_role”: “secretary”,
“person_number”: “213674650001”
},
{
“address”: {
“address_line_1”: “17 Lonsdale Road”,
“country”: “United Kingdom”,
“locality”: “Weybridge”,
“postal_code”: “KT13 0TG”,
“premises”: “Dragonsrealm Ltd”
},
“appointed_on”: “2016-09-07”,
“is_pre_1992_appointment”: false,
“country_of_residence”: “United Kingdom”,
“date_of_birth”: {
“month”: 10,
“year”: 1970
},
“links”: {
“self”: “/company/10363521/appointments/dqiZrOFlEArBxm64JQk_bY1P5nk”,
“officer”: {
“appointments”: “/officers/neiVZ6lFRiIuLNYrakZtnNhKdfg/appointments”
}
},
“name”: “QUINN, Christopher”,
“nationality”: “British”,
“occupation”: “It Contractor”,
“officer_role”: “director”,
“person_number”: “213674640001”
}
],
“items_per_page”: 35,
“kind”: “officer-list”,
“links”: {
“self”: “/company/10363521/officers”
},
“resigned_count”: 0,
“inactive_count”: 0,
“start_index”: 0,
“total_results”: 2
}

@MArkWilliams seeing timeouts and failed searches again. Could we perhaps have a sticky thread with regular updates on the progress to fix the technical issues as it has been several days of intermittent outages now.

Can confirm we’re still seeing sporadic errors, e.g.:

Failed to query [https://api.company-information.service.gov.uk/officers/Bv5y7XFXUDXOHbbcMfZlzAxiIx8/appointments?start_index=0&items_per_page=50]. HTTP Status [502] - 11/04/2024 13.02

We apologise for the issues you have been experiencing over the last 3-4 days.
A temporary (partial) fix was applied on 9th April 2024 approx 13:00hrs which made a substantial difference to the service stability.
We have Just (11th April 15:15hrs) deployed the full fix, but this deployment itself caused a few minutes of disruption.
Thank you for your patience.

2 Likes

Thank you for the update @MArkWilliams . Appreciate that these outages can and will happen time to time and thatCH team have worked hard to resolve the issues.
Regular updates like these help us to manage expectations downstream.

@MArkWilliams thank you for your transparency and hard work. Can you confirm that all issues are resolved please? We are still experiencing challenges with the officers resource. Company is fine.

One thing I have noticed about the company officers endpoint (as it’s causing us issues). Requests like

https://api.companieshouse.gov.uk/company/15250905/officers?items_per_page=10&start_index=0&order_by

worked fine up until last weekend, now it seems we need to either get rid of the order_by or add a value like “surname” to it.

We’re still getting 401 errors on all officer queries. Companies and PSCs look fine though.

Thanks

This is under investigation. There has been a change, it was actually to fix a problem with ordering.
I have asked for some advice from the developers, which I will post on this post Company Officers LIST Ordering of results changes

posting here for completeness…

OK, so the order was one of the fixes, so it has technically changed but only so it is now working correctly.
The default order is now active. So if you just want all active officers, then just leave the order_by off and it will use the default which shows active officers first anyway.

Alternatively for active directors then add filter=active to the query e.g. https://api.company-information.service.gov.uk/company/00006400/officers?filter=active&items_per_page=25

or similar.
Hope that helps

Hi @MArkWilliams ,
I am getting 401 status code while fetching requests via python,

I am currently using the below method to handle the requests which was previously working fine but giving 401 error from the last couple of requests:

url = f'https://api.company-information.service.gov.uk/company/{company_number}/registered-office-address'
    headers = {
         'Authorisation': f'Basic {encoded_key}'         
    }
    api_request = requests.get(url, headers=headers)

I think that the Header is the issue here - try Authorization as the spelling in the header.

Hope it helps.

Yes, it is Authorization in the actual code, Grammarly autocorrected this to British English while posting here.

Hello @sarvesh.nahar - Okay, so do you agree that a 401 error is a Header Auth issue?

I ran your code in Python and it would not parse for me - I did get this version to parse;

url = f’https://api.company-information.service.gov.uk/company/SC574952/registered-office-address
api_request = requests.get(url, Headers=‘Authorization’ f’Basic {encoded_key}’)

The main difference I can see is that removing ’ : ’ from the code in the Header section.

I also tested this in Postman and got this;


I think proving the call is correct - just an issue with your header formatting?

Hope it helps.

Yes, it did solved the issue initially, but now I am getting error 500, any idea how to handle this?

If you’re still having issues with the server returning a 500 type error, after waiting a while to allow CHS to clear any issues on their side, then can you post an image of the screen, first removing any sensitive keys or code.

This will allow for a better understanding of the issue you are seeing - thanks :upside_down_face: