StreamingAPI and Document_Id

Assuming that the API key you have for the Streaming API will work with the Documents API (which I think is the case, but don’t know for sure)…

I don’t know what tool you’re using there but should you have quote marks round the document ID (rather than none)?

As usual I recommend trying this with e.g. curl if possible (that way you can step through the process and with the verbose flag see exactly what is sent / received each step).

This thread (and the one linked in my comment) should help.

I’ve shown requesting the metadata first - you should check you can get that. Using your link there, I get:

curl -u APIKEYHERE: https://document-api.company-information.service.gov.uk/document/Q0Lbp7gVAnynCcIVXvLF9vS5D3uYpR-uCSl30sv6sS4
{"company_number":"10073158","barcode":"XE423ACA","significant_date":null,"significant_date_type":"","category":"annual-returns","pages":3,"filename":"10073158_cs01_2025-06-05","created_at":"2025-06-05T11:28:02.012299615Z","etag":"","links":{"self":"https://document-api.company-information.service.gov.uk/document/Q0Lbp7gVAnynCcIVXvLF9vS5D3uYpR-uCSl30sv6sS4","document":"https://document-api.company-information.service.gov.uk/document/Q0Lbp7gVAnynCcIVXvLF9vS5D3uYpR-uCSl30sv6sS4/content"},"resources":{"application/pdf":{"content_length":85358}}}

Then requesting the document (depending on what is offered in the metadata you may be able to choose something other than PDF), the first response you’ll get back is from Companies House with a redirect:

curl -v -u APIKEYHERE: --header "Accept: application/pdf" https://document-api.company-information.service.gov.uk/document/Q0Lbp7gVAnynCcIVXvLF9vS5D3uYpR-uCSl30sv6sS4/content

(Just showing the headers returned):

HTTP/1.1 302 Found
Date: Thu, 05 Jun 2025 17:22:41 GMT
Location: https://s3.eu-west-2.amazonaws.com/document-api-images-live.ch.gov.uk/docs/Q0Lbp7gVAnynCcIVXvLF9vS5D3uYpR-uCSl30sv6sS4/application-pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...

Your tool is probably trying to follow that and sending the Companies House authorisation header - it shouldn’t do that (many do though…). curl handles this fine, but you may need to catch the redirect then request this without the API key header. It works for me without sending the Accept header to AWS either - that seems to be passed in the request url.

So: no API key passed here!

curl https://s3.eu-west-2.amazonaws.com/document-api-images-live.ch.gov.uk/docs/Q0Lbp7gVAnynCcIVXvLF9vS5D3uYpR-uCSl30sv6sS4/application-pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=... > a_test.pdf

That gets me an 85kB file.

Good luck.