Download attachment from REST API

I would like to check if JIRA cloud REST API is suitable for download an attachment?
The Doc describes abilities to upload (POST) an attachment to issue, get its metadata but no download.

Is there is REST API for download?
Is it possible to download from client app without server and Jira-connect?

Thanks for your help

Hello @ErezAvny!
Both Get Issue and Get attachment metadata contain an attachment’s content field which is URL for this attachment.
All you have to do to download it is to make a GET request on this URL.

I’ve called the Get attachment metadata API and got this response

  "id": 10000,
  "self": "",
  "filename": "picture.jpg",
  "author": {
    "self": "",
    "key": "",
    "accountId": "5b10a2844c20165700ede21g",
    "name": "",
    "avatarUrls": {
      "48x48": "",
      "24x24": "",
      "16x16": "",
      "32x32": ""
    "displayName": "Mia Krystof",
    "active": false
  "created": "2020-08-17T06:46:11.060+0000",
  "size": 23123,
  "mimeType": "image/jpeg",
  "content": "",
  "thumbnail": ""

You may notice that it contains content field with value of

Now I can make a GET request to fetch this attachment.

I hope that answers your question!

hello @MaciejStanuch ,
thanks for quick replay.

I try follow your guide but when I try to fetch the file with GET (inside the Jira cloud app) the response is redirect to login page and got http/https mismatch content.

Request with fetch:

    fetch('https://{}/secure/attachment/{id}/{filename}.json' {
      headers: {
        'Content-Type': 'application/json',
      .then(function (response) {
      .catch(function (ex) {
        console.log('Parsing failed:', ex);

The request redirect to:

And got this error in network panel:

Access to fetch at 'https://{my-domain}{attachment-id}%2F{file-name}.json&page_caps=&user_role=' (redirected from 'https://{my-domain}{attachment-id}/{file-name}.json') from origin 'https://{tunnel-id}' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

Can you help, please?


I think you’re missing Authentication header. To make this kind of request you have to be authenticated to your Jira instance. You can do it by, for example, adding Basic Auth header to the request or calling API from authenticated Connect Application.

Some more info about how to add Basic Auth: Basic auth for REST APIs

Some more info about Connect Addons:

You should be able to find all the details at the before-mentioned pages.


I am having a similar issue. I tried authenticating using Basic authentication which worked for me while getting the metadata for the attachments.
It is throwing a 400 response code to my GET request.
Let me know how I can get around this.

1 Like

Hello, what is the process for doing this via oauth? I have the following node code

const fileData = await Superagent(attachment.content).set(
          `Bearer: ${jira.accessToken}`

however this results in a 404 not found and seems to be redirecting me to the login url

@MaciejStanuch thoughts? is this workflow supported via oauth? If not are there any plans to?

Hello, as mentioned @MaciejStanuch , you need to fetch the file content with authorization header (basic auth)
here’s below exp using postman
1- first get the attchment meta data

2- then get the file content with same authorization header
GET https//:fileurl.pdf

Hello @ErezAvny ,

I think the easiest way to download attachment/s programaticaly is to use wget command. Please see example below:

wget -d --header="X-Auth-Token: XXXXXXXXXXXXXXXXXXXX" https://your_jira_url/secure/attachmentzip/attachement.jpg --no-check-certificate

If you’ve got any loadbalancer in front it might be required to use cookies parameter:
--load-cookies cookies.txt


Hi, I tried to use this method but got an error

null for uri: status-code’: 404

Can you please help me out.
I am trying to download pdf.