Skip to content
atlassian-dc-mcp
Esc
↑↓navigate↵open⌘Jpreview

Add one or more attachments to an issue

Add one or more attachments to an issue. This resource expects a multipart post. The media-type multipart/form-data is defined in RFC 1867. Most client libraries have classes that make dealing with multipart posts simple. For instance, in Java the Apache HTTP Components library provides a MultiPartEntity that makes it simple to submit a multipart POST. In order to protect against XSRF attacks, because this method accepts multipart/form-data, it has XSRF protection on it. This means you must submit a header of X-Atlassian-Token: no-check with the request, otherwise it will be blocked. The name of the multipart/form-data parameter that contains attachments must be file. A simple example to upload a file called “myfile.txt” to issue TEST-123: curl -D- -u admin:admin -X POST -H “X-Atlassian-Token: no-check” -F “file=@myfile.txt” http://myhost/rest/api/2/issue/TEST-123/attachments

POST/api/2/issue/{issueIdOrKey}/attachments
Authorization
AuthorizationBasic auth · headerrequired

In order to use basic authorization, provide username:password Base64 encoded in the 'Authorization' header.

or
AuthorizationBearer token · headerrequired

Personal Access Token — Administration > Profile > Personal Access Tokens

AuthorizationBasic auth · headerrequired

In order to use basic authorization, provide username:password Base64 encoded in the 'Authorization' header.

Path parameters
issueIdOrKeystringrequired

Issue id or key

Request body
multipart/form-data

Attachments to be added

any
Responses
200

Returns a JSON representation of the attachments added.

authorUserJsonBean
Show properties
activeboolean
avatarUrlsobject
displayNamestring
emailAddressstring
keystring
namestring
selfstring
timeZonestring
contentstring
createdstring<date-time>
filenamestring
idstring
mimeTypestring
selfstring
sizeinteger<int64>
thumbnailstring
403

Returned if attachments is disabled or if you don't have permission to add attachments to this issue.

404

Returned if the requested issue is not found, the user does not have permission to view it, or if the attachments exceeds the maximum configured attachment size.

Try it
Server
Authorization
Parameters
Bodymultipart/form-data
Request
curl -X POST 'http://jira.example.com/rest/api/2/issue/string/attachments' \
  -H 'Authorization: Basic YOUR_CREDENTIALS' \
  -H 'Accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -d 'null'
Response
{
  "author": {
    "active": true,
    "avatarUrls": "http://www.example.com/jira/secure/projectavatar?size=xsmall&pid=10000",
    "displayName": "Fred F. User",
    "emailAddress": "fred@example.com",
    "key": "fred",
    "name": "Fred",
    "self": "http://www.example.com/jira/rest/api/2/user?username=fred",
    "timeZone": "Australia/Sydney"
  },
  "content": "string",
  "created": "2019-08-24T14:15:22Z",
  "filename": "string",
  "id": "string",
  "mimeType": "string",
  "self": "string",
  "size": 0,
  "thumbnail": "string"
}

Was this page helpful?