API errors out on downloading incorporation certificate

https://document-api.company-information.service.gov.uk/document/{documentId}/content

This URL throws 404 page not found

https://beta.companieshouse.gov.uk/company/{companyId}/filing-history/{documentId}/document/

This works on Postman but throws error on PowerAutomate.

Please suggest if there is some other API URl for downloading incorporation certificate.

Welcome!
I see you’ve not had a response yet. One thing to note - this forum is mostly frequented by other users although Companies House themselves do come here.

I don’t know anything about PowerAutomate but there are some threads on this forum about downloading documents with many tools. There are several about Postman - here’s one:

In your case:
a) when requesting document content you’ll actually get redirected to another site, so the settings to do with this are important as well e.g. have you set Postman / PowerAutomate to follow redirects? Will they try to send your http Basic authorization there too (that will cause a problem)?

b) The filing history link you provide is incorrect. The form is (using the new uris - although this should work for beta still):

https://api.company-information.service.gov.uk/company/{companyId}/filing-history/{documentId}

Adding “document” to the end of that and hoping to get a document download doesn’t work - documentation here. The way to do this is to request the filing history item resource and retrieve the the document data link from that. Next request the document metadata using the document API. Then finally use the link in the document metadata resource to download the document. It’s worth doing the step of requesting the document metadata first rather than simply going to download content because (a) Companies House might change the document content download url and (b) this allows you to check the content type[s] available e.g. their might be things other than just the document PDF.

Have you access to the “curl” command line tool or something similar? I find that’s very helpful for understanding APIs like this. It’s really simple to see exactly what you’re putting in (request) and what you get back (response). So you can see exactly what’s going on.

To improve your chances of getting some help in the future you should be specific but also provide some background information. So “I’m trying to download a filing document (content)” as background information. Just stating you get a 404 from some address the internet isn’t specific enough. Always provide some definite examples if possible. I’ve an example below of how you might report this:

In Postman, I set the ‘Authorization’ options to use ‘http Basic’ with my API key in the username field and nothing in the password field. Other options are ‘follow redirects’ (etc.) I then try requesting https://document-api.company-information.service.gov.uk/document/bFofQLDBGWrTBK02r1myESnrGJi0Uf7v1OTfQE7cbvc/content and I get a 404 error.

For the link https://api.company-information.service.gov.uk/company/04253605/filing-history/MzI4MDk0OTUwM2FkaXF6a2N4
…In Postman I do … and I get a 200 with content … and in PowerAutomate I do … and I get a … error (full detail …)