Financial documents access - API - sometime it comes back with XBLR format sometimes PDF?
How are you requesting this? What URL? What “Accept” http header are you sending, if any? Are you using a live application or the test / sandbox?
See the posts on this thread relating to how to find out what data formats are available for a given filing, and how to then request the one you want.
const url = https://document-api.company-information.service.gov.uk/document/${documentId}/content
;
console.log(📥 Attempt ${attempt}: Fetching document from
, url);
const response = await axios.get(url, {
headers: {
Authorization: `Basic ${Buffer.from(`${API_KEY}:`).toString("base64")}`,
},
responseType: "arraybuffer",
}); Live access
So - per the thread I quoted above, you just need to ensure that the appropriate http Accept header is sent e.g. if you want PDF then:
Accept: application/pdf
If you follow through the process in the thread I’ve linked you’ll see that the mime types of the data available are listed in the document metadata for a filing. I think generally almost everything is available as a PDF, and some documents may be available also in xBRL - but it would be sensible to check first (or at least - I think Companies House process expects people will do so - you could of course take the “I’m feeling lucky” approach and just see what you get, if anything…)