Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Uploading attachments via REST API (JIRA)


We are currently undergoing a migration and I need to bulk upload attachments to existing Jira tickets from a local store; I am attempting to follow the REST API code provided on Atlassian Confluence: 

curl -D- -u {username}:{password} -X POST -H "X-Atlassian-Token: nocheck" -F "file=@{path/to/file}" http://{base-url}/rest/api/2/issue/{issue-key}/attachments

I've created an API key and input this as the password with the username.
When running this I am receiving: 

curl: (26) Failed to open/read local data from file/application

I have attempted moving this file into a higher location and using both parent folder and the document as the {path/to/file} but I must be missing something as I am very new to this. 

Thank you in advance for any support. 


1 answer

1 accepted

0 votes
Answer accepted

Hi @Matt Smith 

Are you migrating from server to cloud instance or from a cloud to cloud instance?

Hey @Prince Nyeche

Thanks for your quick response, it's cloud to cloud - as far as I am aware there is no clean way to do it, 

What we're attempting is bulk download via a 3rd party application available on the Atlassian marketplace and then attempting to find a bulk upload process, 

Thank you! 

Hey @Matt Smith 

If you're familiar with a little bit of python, there's this script I made which does a bulk attachment from instance to instance, fetching the attachments based on JQL. All you need to do is follow the instruction on the file and you'll be able to migrate your entire attachments without the need to download it.

Even though it's a server to cloud implementation, it works on a cloud to cloud instance as well. Let me know if you can use that instead or if you have any questions on it.  Also i wrote this article a few months back on how to transfer attachments between cloud instances via API, you can also take a look at that too.

Hey @Prince Nyeche  

Thanks for your help on this, 

The first solution wont work for our example as I understand as our destination project key is different to our source project key, 

I will take a deeper look into the second option over the weekend, admittedly a python novice but I'm thinking our bottle neck will be the fact all of the incidents are not in our workspace currently as we are doing an incremental migration due to the source being currently worked in. 

I will get back to you early next week with any success/failures I have, 

Thank you for your time. 

Like Jocelyn Weber likes this

I wonder if it would work to update the project keys in the old space after the users are in the new space and then run this? 

Like Matt Smith likes this

Good Morning @Prince Nyeche 

I have successfully extracted the attachments this morning via your article. 

I notice on there that this advises that the keys must be the same - as we have amended this in our workspace they will not be the same. 

Looking at the csv I notice it stores Project Key and Issue Key, if I manually amend these in the CSV to match our target do you think this will be successful? Admittedly still a good amount of manual work but significantly less than manually uploading the docs. 

Thank you! 

Hey @Matt Smith 

Yes, if you do that it will upload to those issue keys. As long as you have the report you can manipulate anything you need. Let me know how it goes.

Hey @Prince Nyeche 

So I have followed the article quite strictly, I updated the CSV's Project ID, Project Key, Project name and Issue Key to match the destination Project but am receiving the following error when running the import script. 

requests.exceptions.MissingSchema: Invalid URL 'ESINTG': No schema supplied. Perhaps you meant http://ESINTG?

Appreciate any assistance, 

@Prince Nyeche it works! 

I was misunderstanding the keyword args but after getting my head around that I can see it in action! 

This has no doubt saved tens of hours of manual work and massively help with the integration and maintaining my sanity. 

Thank you! 

Awesome @Matt Smith! Glad to hear it works for you. Have a good day ahead.

Like Matt Smith likes this

Hi @Prince Nyeche Does that script work for moving attachments from Server to Datacenter? please let me know.. thanks.. 

Yes, it works between Server to Server. Definitely, it should work for Server to Datacenter.

thanks a lot.. 

@Prince Nyeche hi, I am getting the following error:

"Please check your server credentials, as it might be wrong..."

Do I need to consider API token of Source or Target?

could you please explain.. thanks in advance.

Hey @Anil Kumar 

It means the target instance credential is wrong. If you're connecting from server to data center. Your source credential should be your server ones and the target credential should be the one from data center. I believe you will need to use username and password for both connection. Usually, if your user exist on both instances, that should help make things a little bit clearer. If not, you can always enter the appropriate credential for each user you're connecting with. Hope that clarifies?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

1,365 views 10 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you