Hmmm, the code looks fine to me, but it might be the fact that you are missing “.json” after “/k/v1/file”
All the examples in the page that you showed me has it as “/k/v1/file.json”.
Please fix that part in see whether that will work.
Unfortunately, it is not possible to achieve image file downloads with the kintone.api() methods. However, the Kintone JS SDK can be used for this purpose.
The method detailed in the second article returns a file blob if the download is successful. I found this resource to be useful for reference: https://javascript.info/blob