# Document API doesn't work, returns 0 error

**URL:** <http://forum.companieshouse.gov.uk/t/document-api-doesnt-work-returns-0-error/2515>\
**Category:** Uncategorized\
**Created:** [July 19, 2019, 7:34am UTC](http://forum.companieshouse.gov.uk/t/document-api-doesnt-work-returns-0-error/2515 "2019-07-19T07:34:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![christian\_kneller](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/c/258eb7/32.png) [@christian\_kneller](http://forum.companieshouse.gov.uk/u/christian_kneller)\
**Post date:** [July 19, 2019, 7:34am UTC](http://forum.companieshouse.gov.uk/t/document-api-doesnt-work-returns-0-error/2515/1 "2019-07-19T07:34:48Z")

</div>

I’m just trying to test examples through the API docs at [https://developer.companieshouse.gov.uk/document/docs/document/id/fetchDocumentMeta.html](https://developer.companieshouse.gov.uk/document/docs/document/id/fetchDocumentMeta.html)

I have generated a new key just to show that I have the correct Authorization token etc. The key is oUq7li2wtcJKDmL8vEDXW0FO2YestNQAIiyt-T4v so when I encode oUq7li2wtcJKDmL8vEDXW0FO2YestNQAIiyt-T4v: (i.e. blank password) with base64 then my access token is b1VxN2xpMnd0Y0pLRG1MOHZFRFhXMEZPMlllc3ROUUFJaXl0LVQ0djo=

This is what when i try to fill in the form at the bottom of the URL at the top with the relevant details:

Request  
GET /document/gh438fghd09euthg829 HTTP/1.1  
Host: document-api.companieshouse.gov.ukundefined  
Authorization: Basic b1VxN2xpMnd0Y0pLRG1MOHZFRFhXMEZPMlllc3ROUUFJaXl0LVQ0djo=  
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.

What am I doing wrong?

---

<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 21, 2019, 7:17pm UTC](http://forum.companieshouse.gov.uk/t/document-api-doesnt-work-returns-0-error/2515/2 "2019-07-21T19:17:32Z")

</div>

I’m not sure the document API “try it out” has worked for a long while. (This definitely _does_ work using the API though.)

Here’s Companies House in 2016 saying it needed to be fixed. I’ve not seen anything since which suggests it has been.

[https://forum.aws.chdev.org/t/trouble-retrieving-document-metadata-documents-a-k-a-frustrated-at-this-api/505/3](https://forum.aws.chdev.org/t/trouble-retrieving-document-metadata-documents-a-k-a-frustrated-at-this-api/505/3)

This was reported in other posts also.  
[https://forum.aws.chdev.org/t/fetch-a-document-from-developer-hub-returns-failure-while-contacting-api-please-check-javascript-domains-registered-against-apikey-oauth2-registration/1237](https://forum.aws.chdev.org/t/fetch-a-document-from-developer-hub-returns-failure-while-contacting-api-please-check-javascript-domains-registered-against-apikey-oauth2-registration/1237)
