Downloading files retrieved via API

Yes, I have keys, I've used them for lots of other things and they do work in this case when using a query instead I can still get a proper response, but since I could only get a working download file using the script, I'm struggling to pass the response from a query version back to the script without it being corrupted or otherwise not working anymore. The fetch mechanism seems to be treated differently from a CORS perspective and from a processing the response perspective - one for the better, one for the worse.