Is that last “undefined” an artifact of your logging script / process? If not something there needs to be fixed.
Next step would be to check your API key / which server you’re requesting from / exactly the request you’re making as the endpoint you requested works OK for me:
curl -uMY_API_KEY_HERE: "https://document-api.companieshouse.gov.uk/document/GdA8vcfuhlN6jp_ckh5Kfd3VAvwFexZFmvATUZUnmZM"
Gives
{
"company_number": "SC327000",
"barcode": "X8CY8ZLT",
"significant_date": null,
"significant_date_type": "",
"category": "annual-returns",
"pages": 3,
"created_at": "2019-08-30T12:53:41.19681517Z",
"etag": "",
"links": {
"self": "https://document-api.companieshouse.gov.uk/document/GdA8vcfuhlN6jp_ckh5Kfd3VAvwFexZFmvATUZUnmZM",
"document": "https://document-api.companieshouse.gov.uk/document/GdA8vcfuhlN6jp_ckh5Kfd3VAvwFexZFmvATUZUnmZM/content"
},
"resources": {
"application/pdf": {
"content_length": 19662
}
}
}
That’s the following company: BANK OF SCOTLAND PLC overview - Find and update company information - GOV.UK
No need to post your API key on the forum! Just check you have this correct and encoded correctly per http basic.