Either document-api.companieshouse.gov.uk or frontend-doc-api.companieshouse.gov.uk should work (basically, use whatever you get back from CH in “document_metadata”) - see:
Filing history change - documents api alias?
For the 404 - that suggests something else has crept in to the URL you’re requesting. I tested exactly the “document_metadata” link you got back from CH and it worked OK for me (see later).
I don’t know if this is significant but I notice in your examples you’ve got two different expressions going on:
First example:
headers={'Authorization': {mykey})
and in the subsequent examples:
headers={'Authorization': '{mykey}'})
It’s likely not significant but I notice you’re using “http://document-api.companieshouse.gov.uk” not https in one example - I’d ensure you always use https.
I just tested the link (using curl) - either way works:
curl -u"API_KEY_HERE:" "https://frontend-doc-api.companieshouse.gov.uk/document/2N7iuPGYl8d4g_jcmQtl_Mpqk6CbVFSGZQyPad70Y0k"
Gives:
{
"company_number": "09446231",
"barcode": "A8WN6FJF",
"significant_date": null,
"significant_date_type": "",
"category": "capital",
"pages": 10,
"created_at": "2020-01-17T12:28:09.163046105Z",
"etag": "",
"links": {
"self": "https://document-api.companieshouse.gov.uk/document/2N7iuPGYl8d4g_jcmQtl_Mpqk6CbVFSGZQyPad70Y0k",
"document": "https://document-api.companieshouse.gov.uk/document/2N7iuPGYl8d4g_jcmQtl_Mpqk6CbVFSGZQyPad70Y0k/content"
},
"resources": {
"application/pdf": {
"content_length": 207979
}
}
}
And:
curl -u"API_KEY_HERE:" "https://document-api.companieshouse.gov.uk/document/2N7iuPGYl8d4g_jcmQtl_Mpqk6CbVFSGZQyPad70Y0k"
…gives the same resource.