Can't display image in page properties macro when updated via API

We’ve been using Confluence API to upload images in a specific section of our wiki pages, however these pictures are now not displaying correctly inside the macro (a page properties one, with a specific ID).

The API request goes through and succeeds; however in the attachments section we cannot see the preview of such images, we can only download them. The downloaded pictures correspond perfectly with what we expect to see in the page.

However, they seem not be loaded correctly in the page:

If we try to upload the same picture “manually” inside the macro and publish the page, it all works fine. Whenever we try to update it however, it will go back to the “failed to load mode”.
Other pictures that we uploaded manually once can be previewed just fine.

Some specifications of the POST API call we perform:


headers = {"X-Atlassian-Token": "no-check"}
"minorEdit": True,
"type": "attachment"
"comment": timestamp
"url": "https://xxx.atlassian.net/wiki/rest/api/content/<pageID>/child/attachment/<attachmentID>/data"

"file": @file

We believe the problem is the mediaType the API recognizes the PNG file to be, which is oddly: application/octet-stream, as we see when we issue a GET call to get the list of attachments. However mediaTypeDescription is correctly PNG Image.
We couldn’t find any way to force mediaType to be image/PNG in the API documentation.

Any help would be appreciated, thanks.

I have spend the last 2 days without luck either and it isn’t related to faulty uploads as if you upload initial versions and insert them into the page tree they display just fine. Just having multiple versions result in a breaking page. Uploading a new version of an attachment breaks the image preview