# 'fetch a document' from developer hub returns 'failure while contacting api. Please check javascript domains registered against APIKey / OAuth2 registration'

**URL:** <http://forum.companieshouse.gov.uk/t/fetch-a-document-from-developer-hub-returns-failure-while-contacting-api-please-check-javascript-domains-registered-against-apikey-oauth2-registration/1237>\
**Category:** API Issues\
**Created:** [July 17, 2017, 5:09pm UTC](http://forum.companieshouse.gov.uk/t/fetch-a-document-from-developer-hub-returns-failure-while-contacting-api-please-check-javascript-domains-registered-against-apikey-oauth2-registration/1237 "2017-07-17T17:09:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![seanbradley](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/s/aeb1de/32.png) [@seanbradley](http://forum.companieshouse.gov.uk/u/seanbradley)\
**Post date:** [July 17, 2017, 5:09pm UTC](http://forum.companieshouse.gov.uk/t/fetch-a-document-from-developer-hub-returns-failure-while-contacting-api-please-check-javascript-domains-registered-against-apikey-oauth2-registration/1237/1 "2017-07-17T17:09:28Z")

</div>

Request  
GET /document/d-r3ceb–OvuiuCDmQjj0RLW2\_ZvY75zT4B1tB40cq8/content HTTP/1.1  
Host: document-api.companieshouse.gov.ukundefined  
Authorization: [redacted]  
Accept: application/pdf

Response status  
0 error

Response body  
Failure while contacting API. Some possible causes are connection problems or cross-origin resource sharing protection. Please check javascript domains registered against APIKey / OAuth2 registration.

Response headers

---

<div class="post-metadata">

**Author:** ![voracityemail](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/v/b77776/32.png) [@voracityemail](http://forum.companieshouse.gov.uk/u/voracityemail)\
**Post date:** [July 18, 2017, 9:56am UTC](http://forum.companieshouse.gov.uk/t/fetch-a-document-from-developer-hub-returns-failure-while-contacting-api-please-check-javascript-domains-registered-against-apikey-oauth2-registration/1237/2 "2017-07-18T09:56:52Z")

</div>

> [@seanbradley](#):
>
> [document-api.companieshouse.gov.uk](http://document-api.companieshouse.gov.uk)

Ah - you may have spotted this already but the documents “try it out” parts on the Developer Hub weren’t working and presumably still are not. E.g. see:

> [@Trouble retrieving Document MetaData/Documents, a.k.a. frustrated at this API](http://forum.aws.chdev.org/t/trouble-retrieving-document-metadata-documents-a-k-a-frustrated-at-this-api/505):
>
> I’ve used quite a few RESTful API’s over recent years, but never before have I encountered one that is as frustrating this! I have a simple task: retrieve the filing history list for a company, then retrieve a document. Simple right? Wrong! Steps using the built-in website test tools: [https://developer.companieshouse.gov.uk/api/docs/company/company\_number/filing-history/getFilingHistoryList.html#here](https://developer.companieshouse.gov.uk/api/docs/company/company_number/filing-history/getFilingHistoryList.html#here) I enter the company number I am interested in (01777777), items\_per\_page=100, and select…

The documents API does seem to be a little under-documented compared with the rest of the API. That’s where this forum comes in I suppose! Always worth a search here and a search will likely save time before waiting for someone to get back to you…

---

<div class="post-metadata">

**Author:** ![sc1](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@sc1](http://forum.companieshouse.gov.uk/u/sc1)\
**Post date:** [December 10, 2019, 4:02pm UTC](http://forum.companieshouse.gov.uk/t/fetch-a-document-from-developer-hub-returns-failure-while-contacting-api-please-check-javascript-domains-registered-against-apikey-oauth2-registration/1237/3 "2019-12-10T16:02:58Z")

</div>

2 years on and still not working… come on chaps!

---

<div class="post-metadata">

**Author:** ![miroslaw\_storoniak](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/m/3e96dc/32.png) [@miroslaw\_storoniak](http://forum.companieshouse.gov.uk/u/miroslaw_storoniak)\
**Post date:** [January 29, 2020, 6:42pm UTC](http://forum.companieshouse.gov.uk/t/fetch-a-document-from-developer-hub-returns-failure-while-contacting-api-please-check-javascript-domains-registered-against-apikey-oauth2-registration/1237/4 "2020-01-29T18:42:23Z")

</div>

Hi,  
That same error.  
…  
**Request**  
GET /document/GdA8vcfuhlN6jp\_ckh5Kfd3VAvwFexZFmvATUZUnmZM/content HTTP/1.1  
Host: document-api.companieshouse.gov.ukundefined  
Authorization: Basic NEtxTVR0Y1dIM3YzNHliUnJSUzQ3Q0wtYVlVRGhZaktPQlRUccccWg==  
Accept: application/pdf  
**Response status**  
0 error  
…  
Also I tried with using Postman and I received code 500.  
What is the translation of 500 ?

Best Regards,  
M.
