Going Stellar

Home/Atlassian REST API reference

Jira and Confluence Cloud REST API

X-Atlassian-Token: no-check for attachment uploads

Operations that accept multipart/form-data, such as attachment uploads, are protected against cross-site request forgery. A call without X-Atlassian-Token: no-check is blocked. On Jira the block surfaces as a 404 with the text XSRF check failed, which is easy to mistake for a wrong issue key. On Confluence it is a 403.

Endpoints

MethodPathWhat it does
POST/rest/api/3/issue/{issueIdOrKey}/attachmentsAdds a file to a work item. Multipart upload.
POST/wiki/rest/api/content/{id}/child/attachmentAdds a file to a Confluence page.

Examples

POST /rest/api/3/issue/{issueIdOrKey}/attachments

Uploads a file to a work item without the header.

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 failed

Sent to Atlassian Cloud on .

POST /rest/api/3/issue/{issueIdOrKey}/attachments

Same upload with X-Atlassian-Token: no-check. The response lists the stored attachment.

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
 }
]

Sent to Atlassian Cloud on .

POST /wiki/rest/api/content/{pageId}/child/attachment

Uploads a file to a Confluence page without the header.

curl

# other.txt contains: x
curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -F "file=@other.txt" \
  'https://your-domain.atlassian.net/wiki/rest/api/content/{pageId}/child/attachment'

Python (requests)

import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/wiki/rest/api/content/{pageId}/child/attachment',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    files={"file": ('other.txt', b'x')},
)
print(r.status_code, r.text)

Response: HTTP 403

{
 "statusCode": 403,
 "message": "com.atlassian.confluence.mvc.rest.common.exception.StacklessResponseStatusException: 403 FORBIDDEN \"XSRF check failed\""
}

Sent to Atlassian Cloud on .

POST /wiki/rest/api/content/{pageId}/child/attachment

Same upload with the header. The response is a results list.

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/wiki/rest/api/content/{pageId}/child/attachment'

Python (requests)

import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/wiki/rest/api/content/{pageId}/child/attachment',
    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

{
 "results": [
  {
   "id": "att33587425",
   "type": "attachment",
   "status": "current",
   "title": "notes.txt"
  }
 ]
}

Sent to Atlassian Cloud on .

How it behaves

  • The Jira upload without the header answered 404 with a body that was the bare text XSRF check failed, although the Content-Type said JSON.
  • The Confluence upload without the header answered 403 with statusCode 403 and a message containing 403 FORBIDDEN "XSRF check failed".
  • With X-Atlassian-Token: no-check the Jira upload answered 200 with a list of attachments, and the Confluence upload answered 200 with results.

Pitfalls

  • A 404 on an attachment upload for a key you can open in the browser points to the missing header, not to the key.
  • The header is only for multipart operations. Ordinary JSON calls do not need it.
  • The two products differ: 404 plain text on Jira, 403 JSON on Confluence.

Questions and answers

What value does the header take?

no-check, exactly as in the Jira v3 reference: X-Atlassian-Token: no-check.

Where is the header documented?

In the Special headers section of the Jira v3 intro, which says operations that accept multipart/form-data must include it.

Sources

  1. The Jira Cloud platform REST API v3 (Atlassian Developer)
  2. Add attachment (Jira REST API v3)
  3. Security for other integrations, Jira (Atlassian Developer)

Markdown version · All REST API pages