Adding confluence image (attachment) to a jira ticket

Good morning,

I’ve been struggling with the following:
I am developing a confluence plugin that reads the attachments from a confluence page and should then create jira tickets with the attachments added to the ticket. Any idea on how I can achieve this?

I’ve managed to get the download link for all the attachments found but when I try to programmatically download them I get a forbidden status code. I don’t see a direct way in either the confluence or jira api’s to transfer this attachment.

Any help would be highly appreciated.

Thanks in advance!
Nick