# CH Public Data API OpenAPI specification refs refer to localhost

**URL:** <http://forum.companieshouse.gov.uk/t/ch-public-data-api-openapi-specification-refs-refer-to-localhost/4253>\
**Category:** API Issues\
**Created:** [August 10, 2021, 1:01pm UTC](http://forum.companieshouse.gov.uk/t/ch-public-data-api-openapi-specification-refs-refer-to-localhost/4253 "2021-08-10T13:01:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![karlturnbull](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@karlturnbull](http://forum.companieshouse.gov.uk/u/karlturnbull)\
**Post date:** [August 10, 2021, 1:01pm UTC](http://forum.companieshouse.gov.uk/t/ch-public-data-api-openapi-specification-refs-refer-to-localhost/4253/1 "2021-08-10T13:01:46Z")

</div>

Hello,

The OpenAPI references for: [Companies House Public Data API: Specification summary](https://developer-specs.company-information.service.gov.uk/companies-house-public-data-api/reference)

Here:  
[https://developer-specs.company-information.service.gov.uk/api.ch.gov.uk-specifications/swagger-2.0/spec/swagger.json](https://developer-specs.company-information.service.gov.uk/api.ch.gov.uk-specifications/swagger-2.0/spec/swagger.json)

Reference `http://127.0.0.1:31903`, I’d like to autogenerate my Typescript types for your API but this is causing a few issues.

Replacing that with `https://developer-specs.company-information.service.gov.uk` allows me to access the referenced file. But that file also then contains the localhost as path.

Is this something I need to work around?

Also the entry for Officers is repeated twice which is also the case with the website.

Alternatively if we could get access to `https://github.com/companieshouse/api.ch.gov.uk-specifications/ `then this might be something we could do ourselves or work around with a simple text replace. None of the API’s on Github are public. Unsure if that’s something that could change

---

<div class="post-metadata">

**Author:** ![lgeorge](http://forum.companieshouse.gov.uk/user_avatar/forum.companieshouse.gov.uk/lgeorge/32/457_2.png) [@lgeorge](http://forum.companieshouse.gov.uk/u/lgeorge)\
**Post date:** [August 11, 2021, 9:39am UTC](http://forum.companieshouse.gov.uk/t/ch-public-data-api-openapi-specification-refs-refer-to-localhost/4253/2 "2021-08-11T09:39:25Z")

</div>

We have 127.0.0.1 in the specs because they vary between environments during development and we expect that people will adjust them manually for their specific environment. However we can see that is not convenient for developers using the live service so we will investigate that when priorities allow.

---

<div class="post-metadata">

**Author:** ![karlturnbull](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@karlturnbull](http://forum.companieshouse.gov.uk/u/karlturnbull)\
**Post date:** [August 11, 2021, 9:52am UTC](http://forum.companieshouse.gov.uk/t/ch-public-data-api-openapi-specification-refs-refer-to-localhost/4253/3 "2021-08-11T09:52:02Z")

</div>

No worries, I had a feeling that it could be something like that.

If we had a convenient way to access all files at once, like a zip of all of them that might be good. I can see how this would be low down in the list of priorities though. Thanks for taking the time to reply so quickly!

---

<div class="post-metadata">

**Author:** ![nolandsmith1](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/n/958977/32.png) [@nolandsmith1](http://forum.companieshouse.gov.uk/u/nolandsmith1)\
**Post date:** [September 16, 2022, 10:53am UTC](http://forum.companieshouse.gov.uk/t/ch-public-data-api-openapi-specification-refs-refer-to-localhost/4253/4 "2022-09-16T10:53:30Z")

</div>

Hi @lgeorge - any updates on this? What is the workaround you are recommending to manually adjust the links to?

Its been almost 2 years since these were published. It would incredibly helpful if the live service was operational!

Thanks

---

<div class="post-metadata">

**Author:** ![phillip](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/p/3e96dc/32.png) [@phillip](http://forum.companieshouse.gov.uk/u/phillip)\
**Post date:** [September 16, 2022, 11:19am UTC](http://forum.companieshouse.gov.uk/t/ch-public-data-api-openapi-specification-refs-refer-to-localhost/4253/5 "2022-09-16T11:19:38Z")

</div>

Simply replace the highlighted with: **[developer-specs.company-information.service.gov.uk](http://developer-specs.company-information.service.gov.uk)** for every schema reference  
PS: you may have a different port number concatenated to the 127.0.0.1

 ![image](http://discourselive.s3.dualstack.eu-west-1.amazonaws.com/original/2X/1/19c2b8fdd58b4117e0c07062676bb4f333f55692.png)

---

<div class="post-metadata">

**Author:** ![lgeorge](http://forum.companieshouse.gov.uk/user_avatar/forum.companieshouse.gov.uk/lgeorge/32/457_2.png) [@lgeorge](http://forum.companieshouse.gov.uk/u/lgeorge)\
**Post date:** [September 16, 2022, 1:47pm UTC](http://forum.companieshouse.gov.uk/t/ch-public-data-api-openapi-specification-refs-refer-to-localhost/4253/6 "2022-09-16T13:47:36Z")

</div>

Hi,this is not high amongst the priorities at present balanced against the other things Companies House is being asked to do by Government. They can be modified manually for specific environments and this is what we do internally. Happy to raise the point again for you if you wish.

---

<div class="post-metadata">

**Author:** ![x11](http://forum.companieshouse.gov.uk/user_avatar/forum.companieshouse.gov.uk/x11/32/2149_2.png) [@x11](http://forum.companieshouse.gov.uk/u/x11)\
**Post date:** [July 14, 2026, 12:54pm UTC](http://forum.companieshouse.gov.uk/t/ch-public-data-api-openapi-specification-refs-refer-to-localhost/4253/7 "2026-07-14T12:54:46Z")

</div>

> [@A corrected OpenAPI 3.1 spec for the Public Data API (MIT licensed), plus a generated TypeScript client](https://forum.companieshouse.gov.uk/t/a-corrected-openapi-3-1-spec-for-the-public-data-api-mit-licensed-plus-a-generated-typescript-client/12878):
>
> Like several people here (the localhost $ref threads especially), we hit problems generating a client from the official Swagger 2.0 spec. We ended up with hundreds of lines of repair code fixing recurring classes of defect. Patching the spec forever wasn’t sustainable, so we took a different approach: we now maintain a corrected OpenAPI 3.1 document for the Public Data API, built from the Developer Hub documentation and cross-checked against the API’s actual behaviour. 34 endpoints. To keep it …
