# Document metadata 500 error

**URL:** <http://forum.companieshouse.gov.uk/t/document-metadata-500-error/1909>\
**Category:** Uncategorized\
**Created:** [July 10, 2018, 7:01pm UTC](http://forum.companieshouse.gov.uk/t/document-metadata-500-error/1909 "2018-07-10T19:01:40Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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 11, 2018, 9:18am UTC](http://forum.companieshouse.gov.uk/t/document-metadata-500-error/1909/3 "2018-07-11T09:18:59Z")

</div>

(Just another punter here)

Oh - hang on - you’ve got “http://” in your example. Is that a typo? **All CH api should use https**.  
Oddly, this works when I try it … but I’m surprised.

Quick answers:

- I don’t think the example with “/metadata” is the way to go. As I understand it, you follow the link you provided for the metadata, or append “/content” to get the actual content. (Getting content wasn’t exhaustively documented last I looked, but search on the forum for the details of this if you need).
- Same API key is used across the API - there _isn’t_ a separate key for the documents part of this. (Just for completeness - and this is [documented elsewhere](http://forum.aws.chdev.org/t/cant-access-documents-from-amazons3-server/1871/2) - in the final step of requesting the PDF / XML version of a document - when you call the **Amazon server** you don’t provide the key.)
- I suspect it may be how you’re doing this (unless there was a glitch last night).
- I assume calls to the rest of the API work for you?

I tried your example link (using curl) and this responds correctly:

```
curl -uOUR_API_KEY_HERE: "http://document-api.companieshouse.gov.uk/document/xtXcP0MpmXVAgJhKdDk2XywNgqIOX9MnUOzgPKeV7O8"

```

…returns:

```
{ "company_number":"01777777", "barcode":"X42HHJRF", 
"significant_date":null, "significant_date_type":"","category":"mortgages",
"pages":26, "created_at":"2015-05-29T23:30:55.388825345Z", "etag":"",
"links": { "self":
"https://document-api.companieshouse.gov.uk/document/xtXcP0MpmXVAgJhKdDk2XywNgqIOX9MnUOzgPKeV7O8",
"document":"https://document-api.companieshouse.gov.uk/document/xtXcP0MpmXVAgJhKdDk2XywNgqIOX9MnUOzgPKeV7O8/content"
},"resources":{"application/pdf":{"content_length":669701}}}

```

As you point out if it was just the authentication details at fault you’d expect a 4xx response.

Anything else returned (e.g. in body) with the 500?

Any other companies you’ve tried?

It seems that you’re trying to look up this entry:  
BRITISH AIRWAYS PLC. Company number 01777777  
…so I presume you’re calling the endpoint “[https://api.companieshouse.gov.uk/company/01777777/filing-history](https://api.companieshouse.gov.uk/company/01777777/filing-history)” (with your API key passed in the correct http header parameter).  
When I do this, I see the entry you’re after the metadata for:

{  
“type”: “MR01”,  
“category”: “mortgage”,  
“subcategory”: “create”,  
“date”: “2015-03-04”,  
“description\_values”:  
{  
“charge\_number”: “017777770805”,  
“charge\_creation\_date”: “2015-02-26”  
},  
“action\_date”: “2015-02-26”,  
“description”: “mortgage-create-with-deed-with-charge-number-charge-creation-date”,  
“links”:  
{  
“document\_metadata”: “[https://frontend-doc-api.companieshouse.gov.uk/document/xtXcP0MpmXVAgJhKdDk2XywNgqIOX9MnUOzgPKeV7O8](https://frontend-doc-api.companieshouse.gov.uk/document/xtXcP0MpmXVAgJhKdDk2XywNgqIOX9MnUOzgPKeV7O8)”,  
“self”: “/company/01777777/filing-history/MzExODU1NTE1OGFkaXF6a2N4”  
},  
“pages”: 26,  
“barcode”: “X42HHJRF”,  
“transaction\_id”: “MzExODU1NTE1OGFkaXF6a2N4”  
}

(Is this correct?) (You’ll notice that the link here for document metadata is slightly different, but following this one should work as should the one documented in the api).

---

_[View the full topic](http://forum.companieshouse.gov.uk/t/document-metadata-500-error/1909)._
