How to add images to Jira issue descriptions using the API?

Adding Images to Jira Issue Descriptions via API

The Problem

Adding images to Jira issue descriptions via API can be challenging due to the complexity of Atlassian Document Format (ADF) and media handling.

Simple Solution

Instead of using Jira’s complex media API, we can use a simpler approach:

  1. Upload the image as an attachment using /rest/api/3/issue/{issueKey}/attachments
  2. Get the attachment URL
  3. Use the URL in an ADF structure to embed in the description
// Example ADF structure
{
  "version": 1,
  "type": "doc",
  "content": [{
    "type": "mediaSingle",
    "attrs": { "layout": "center" },
    "content": [{
      "type": "media",
      "attrs": {
        "type": "external",
        "url": "your-attachment-url"
      }
    }]
  }]
}

This approach:

  • Works with any programming language
  • Uses standard Jira REST API v3
  • Preserves existing description content
  • Avoids complex media API validation issues

Solution by: Rron Haxhiu (GitHub: @rronhaxhiu_)

3 Likes