Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


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 using axios


I'm having a lot of trouble uploading an attachment to a created issue using the REST API. Currently I'm getting a 415 - "unsupported media type" error. 

I would really appriciate some help with this. Thanks! 


let actionData=new FormData();
actionData.append('file', files[0]);
actionData.append('comment', "foobar");
actionData.append('minorEdit', "true");
      method: 'POST',
      url: jiraApiUrl+'/issue/'+issueID+'/attachments',
      headers: {
             'X-Atlassian-Token': 'nocheck',
data: actionData,
}).then(response => {
              //if (!cb) return { error: 'No callback' };
             console.log('response-2', response);
             return ;//cb(response);
.catch((err) => console.log('errorTest - files', err));

4 answers

  I want to post an answer because I've just spent the entire morning figuring this out, and there isn't much discussion on how to do this with axios. Much of the discussion that does exist will suggest to remove the Content-Type header or set it to false, but that did not work for me.

  You can set Content-Type to the 'multipart/form-data' as the docs suggest and then calculate the boundary with the form-data library function FormData.getBoundary(). Here is some sample code that should work:


async function testAxiosPost() {

  const fd = new FormData();

  fd.append('file', fs.createReadStream('./file_name.png'));

  const url = 'https://{jira_instance}{issue_key}/attachments';

  await axios({

    method: 'POST',

    url: url,

    headers: {

      'Authorization': 'Basic {token}',

      'X-Atlassian-Token': 'nocheck',

      'Content-Type': 'multipart/form-data; boundary=' + fd.getBoundary()


    processData: false,

    cache: false,

    data: fd


  .then((response) => console.log(response))

  .catch((e) => console.error(e.response));

John Henry
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 09, 2023

This worked for me. Thank you!

any solution here ? 

Abdul, did you ever get this figured out? I'm having the same problem. So far I have gotten 404, 415 and 500 errors. I can upload via Postman but when I try to use an Axios call it stops working.

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jul 20, 2017

I'm not sure about using axios, but from looking at other instances with this error such as

How to change the mediatype of an attachment via REST API

REST API error 415 unsupported media type

It seems like this might be a problem with a lack of a content type paramenter.   I think you might need to clarify the request by adding a

'Content-Type: application/json'

somehow to this REST.   But I also think you will need to modify the

'X-Atlassian-Token': 'nocheck'

to be

'X-Atlassian-Token: nocheck'


Suggest an answer

Log in or Sign up to answer