Add Attachment
POST {{baseUrl}}/rest/api/3/issue/:issueIdOrKey/attachments
Adds one or more attachments to an issue. Attachments are posted as multipart/form-data (RFC 1867).
Note that:
- The request must have a
X-Atlassian-Token: no-check
header, if not it is blocked. See Special headers for more information. - The name of the multipart/form-data parameter that contains the attachments must be
file
.
The following example uploads a file called myfile.txt to the issue TEST-123:
curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: no-check" -F "file=@myfile.txt" https://your-domain.atlassian.net/rest/api/3/issue/TEST-123/attachments
Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a MultiPartEntity class for multipart POST operations.
This operation can be accessed anonymously.
Permissions required:
- Browse Projects and Create attachments project permission for the project that the issue is in.
- If issue-level security is configured, issue-level security permission to view the issue.
Request Body
[{"name"=>"0", "value"=>"<", "datatype"=>"string"}, {"name"=>"1", "value"=>"b", "datatype"=>"string"}, {"name"=>"2", "value"=>"i", "datatype"=>"string"}, {"name"=>"3", "value"=>"n", "datatype"=>"string"}, {"name"=>"4", "value"=>"a", "datatype"=>"string"}, {"name"=>"5", "value"=>"r", "datatype"=>"string"}, {"name"=>"6", "value"=>"y", "datatype"=>"string"}, {"name"=>"7", "value"=>">", "datatype"=>"string"}]
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Content-Type | string |
RESPONSES
status: OK
[{"self":"https://your-domain.atlassian.net/rest/api/3/attachments/10000","id":"10001","filename":"picture.jpg","author":{"self":"https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g","accountId":"5b10a2844c20165700ede21g","emailAddress":"mia@example.com","avatarUrls":{"48x48":"https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=48\u0026s=48","24x24":"https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=24\u0026s=24","16x16":"https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=16\u0026s=16","32x32":"https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=32\u0026s=32"},"displayName":"Mia Krystof","active":true,"timeZone":"Australia/Sydney"},"created":"2020-12-17T01:45:44.477+0000","size":23123,"mimeType":"image/jpeg","content":"https://your-domain.atlassian.net/secure/attachments/10000/picture.jpg","thumbnail":"https://your-domain.atlassian.net/secure/thumbnail/10000/picture.jpg"},{"self":"https://your-domain.atlassian.net/rest/api/3/attachments/10001","filename":"dbeuglog.txt","author":{"self":"https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g","accountId":"5b10a2844c20165700ede21g","emailAddress":"mia@example.com","avatarUrls":{"48x48":"https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=48\u0026s=48","24x24":"https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=24\u0026s=24","16x16":"https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=16\u0026s=16","32x32":"https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=32\u0026s=32"},"displayName":"Mia Krystof","active":true,"timeZone":"Australia/Sydney"},"created":"2020-12-17T01:45:44.477+0000","size":2460,"mimeType":"text/plain","content":"https://your-domain.atlassian.net/secure/attachments/10001/dbeuglog.txt"}]