HI
We have an internal tool(similar to Service Management) where the tickets created internally will be sent and created in JIra cloud. Now we are not able to find the api to add the attachments in comments section. Can you please help me with it?
Thanks!
Mahanth.
Unfortunately, there isn’t a public Jira Cloud API that directly supports creating comments with attachments.
That said, it’s technically possible — though not straightforward. You’ll need to jump through a few hoops, and it’s worth deciding whether the complexity is justified for your use case.
Here’s how you can approach it step-by-step:
Upload the attachment to the issue
Use the POST /rest/api/3/issue/{issueIdOrKey}/attachments endpoint to upload your file. This will add the attachment to the issue and return its metadata (including the content ID).
Extract the media ID from the attachment
Jira Cloud doesn’t expose the media ID via any public API, but you can retrieve it indirectly.
Call the GET /rest/api/3/attachment/content/{id} endpoint.
The Location header in the response contains a URL where the media ID appears between /file/
and /binary?
.
You’ll need to parse that UUID out programmatically.
This Community thread has a great breakdown of this process.
Create the comment with the embedded media ID
Once you have the media ID, you can construct your comment using Atlassian Document Format (ADF) and embed the media ID as part of the content.
Then, use the POST /rest/api/3/issue/{issueIdOrKey}/comment endpoint to create the comment.
In summary — while it’s doable, it’s also quite a roundabout process. Personally, I wouldn’t invest too much effort unless having attachments embedded directly in comments is absolutely necessary for your use case.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.