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

URL: https://goingstellar.ro/reference/atlassian-rest-api/xsrf-no-check-header/

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

| Method | Path | What it does |
|---|---|---|
| POST | `/rest/api/3/issue/{issueIdOrKey}/attachments` | Adds a file to a work item. Multipart upload. |
| POST | `/wiki/rest/api/content/{id}/child/attachment` | Adds a file to a Confluence page. |

## Examples

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

Uploads a file to a work item without the header.

```bash
# 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
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 29 Nov 2026.

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

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

```bash
# 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
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 29 Nov 2026.

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

Uploads a file to a Confluence page without the header.

```bash
# 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
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 29 Nov 2026.

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

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

```bash
# 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
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 29 Nov 2026.

## 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.

## Related

- [Attachments](https://goingstellar.ro/reference/atlassian-rest-api/jira-attachments/)
- [Attachments](https://goingstellar.ro/reference/atlassian-rest-api/confluence-attachments/)
- [Content-Type and 415](https://goingstellar.ro/reference/atlassian-rest-api/content-type-and-415/)
- [HTTP status codes](https://goingstellar.ro/reference/atlassian-rest-api/http-status-codes/)
- [Error response formats](https://goingstellar.ro/reference/atlassian-rest-api/error-responses/)

## Sources

- [The Jira Cloud platform REST API v3 (Atlassian Developer)](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/)
- [Add attachment (Jira REST API v3)](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-issue-issueidorkey-attachments-post)
- [Security for other integrations, Jira (Atlassian Developer)](https://developer.atlassian.com/cloud/jira/platform/security-for-other-integrations/)

