Home/Atlassian REST API reference
Jira and Confluence Cloud REST API
Upload and manage Jira attachments with the REST API
POST /rest/api/3/issue/{issueIdOrKey}/attachments takes multipart/form-data with the file in a part named file. The request must carry X-Atlassian-Token: no-check. Without that header Jira answers 404 with the text XSRF check failed, which looks like a missing work item and is not.
Endpoints
| Method | Path | What it does |
|---|---|---|
POST | /rest/api/3/issue/{issueIdOrKey}/attachments | Uploads one or more files to a work item. |
GET | /rest/api/3/attachment/{id} | Returns the metadata of an attachment. |
DELETE | /rest/api/3/attachment/{id} | Deletes an attachment. |
GET | /rest/api/3/attachment/meta | Returns whether attachments are enabled and the size limit. |
Examples
POST /rest/api/3/issue/{issueIdOrKey}/attachments
Uploads notes.txt as a multipart part named file but leaves out X-Atlassian-Token. The upload is blocked.
curl
# notes.txt contains: hello
curl -X POST \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-F "file=@notes.txt" \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/attachments'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.post(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/attachments',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
files={"file": ('notes.txt', b'hello')},
)
print(r.status_code, r.text)Response: HTTP 404
XSRF check failedSent to Atlassian Cloud on .
POST /rest/api/3/issue/{issueIdOrKey}/attachments
The same upload with X-Atlassian-Token: no-check. The response is an array with one entry per file.
curl
# notes.txt contains: hello from the REST API
curl -X POST \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-H 'X-Atlassian-Token: no-check' \
-F "file=@notes.txt" \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/attachments'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.post(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/attachments',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json', 'X-Atlassian-Token': 'no-check'},
files={"file": ('notes.txt', b'hello from the REST API')},
)
print(r.status_code, r.text)Response: HTTP 200
[
{
"id": "10000",
"filename": "notes.txt",
"created": "2026-11-29T19:30:11.325+0200",
"size": 23,
"content": "https://your-domain.atlassian.net/rest/api/3/attachment/content/10000"
}
]Response headers
X-Ratelimit-Limit: 200Sent to Atlassian Cloud on .
GET /rest/api/3/attachment/meta
Reads the instance settings: attachments on, and the largest upload in bytes.
curl
curl \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
'https://your-domain.atlassian.net/rest/api/3/attachment/meta'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/3/attachment/meta',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"enabled": true,
"uploadLimit": 1073741824
}Sent to Atlassian Cloud on .
GET /rest/api/3/attachment/{attachmentId}
Reads the metadata of the uploaded attachment by id.
curl
curl \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
'https://your-domain.atlassian.net/rest/api/3/attachment/{attachmentId}'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/3/attachment/{attachmentId}',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"id": 10000,
"filename": "notes.txt",
"created": "2026-11-29T19:30:11.325+0200",
"size": 23,
"content": "https://your-domain.atlassian.net/rest/api/3/attachment/content/10000"
}Sent to Atlassian Cloud on .
DELETE /rest/api/3/attachment/{attachmentId}
Deletes the attachment. Success has no body.
curl
curl -X DELETE \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
'https://your-domain.atlassian.net/rest/api/3/attachment/{attachmentId}'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.delete(
'https://your-domain.atlassian.net/rest/api/3/attachment/{attachmentId}',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)Response: HTTP 204
No response body.
Sent to Atlassian Cloud on .
How it behaves
- Without X-Atlassian-Token: no-check the multipart upload was answered 404 with the plain text XSRF check failed, although the work item exists.
- A successful upload answered 200, not 201, and the body is a JSON array. Each entry has id, filename, size, created and a content URL under /rest/api/3/attachment/content/{id}.
- The id is a string in the upload response ("10000") and a number in GET /attachment/{id} (10000).
- GET /attachment/meta returned enabled true and uploadLimit 1073741824, which is 1 GiB in bytes.
- The attachment metadata call returns the author with a displayName and active flag but no emailAddress.
Pitfalls
- Send the file as a multipart part named file, as the spec requires. A JSON body is not an upload.
- The header is required on every upload, from every client. Add it once in the HTTP layer instead of per call.
- A 404 on this endpoint can mean the missing header as well as a missing work item. Read the body before deciding.
- Keep the id from the upload response. DELETE and GET both address the attachment by that id and not by file name.
Questions and answers
Why does my attachment upload return 404 for a work item that exists?
The X-Atlassian-Token: no-check header is probably missing. The blocked request answered 404 with the text XSRF check failed.
How large can an attachment be?
GET /rest/api/3/attachment/meta reports the limit in bytes. On this instance it was 1073741824.