How to add an attachment to a JIRA issue using REST API

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

This article walks through the process of uploading an attachment to an issue via the REST API.

Solution

Option 1: Using Command Line:

1 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

For more information including error responses, please review our JIRA REST API code: https://docs.atlassian.com/software/jira/docs/api/REST/latest and the specific endpoint add attachment

Option 2: Using GUI-based Tools (Postman)

This can also be achieved using any GUI tools of your preference. Here an example on how to perform the same operation using POSTMAN tool.

  • Make sure to include "Content-Type", "X-Atlassian-Token" under "Headers" section with values shared.

  • Make sure to include key named "file" and of type "File" to select the one from system, or "Text" to access files using absolute path/reference under "Body" section.

  • Attaching the screenshots for reference:

    (Auto-migrated image: description temporarily unavailable)
    (Auto-migrated image: description temporarily unavailable)

NOTES:

  • there is is currently no option to change the filename or add any description to the attachment

  • only files that are accessible for the user running the command can be added

  • only files with local access path can be added using this endpoint

Need more help?

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.