# Confluence page body formats in the REST API

URL: https://goingstellar.ro/reference/atlassian-rest-api/page-body-formats/

Reading takes body-format on the GET call and returns the body under a key of the same name. Writing takes a body object with representation and value, where the OpenAPI spec lists storage, atlas_doc_format and wiki. The response to a write always shows the storage form, whatever was sent.

## Endpoints

| Method | Path | What it does |
|---|---|---|
| GET | `/wiki/api/v2/pages/{id}` | Reads a page; body-format picks the representation. |
| PUT | `/wiki/api/v2/pages/{id}` | Updates a page; body.representation says how value is written. |

## Examples

### GET /wiki/api/v2/pages/{pageId}

Reads the body as storage format, which is XHTML.

```bash
curl -G \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  --data-urlencode 'body-format=storage' \
  'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.get(
    'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    params={'body-format': 'storage'},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "body": {
  "storage": {
   "representation": "storage",
   "value": "<p>Example page body.</p>"
  }
 },
 "id": "33653083"
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### GET /wiki/api/v2/pages/{pageId}

Reads the same body as atlas_doc_format. The value is a JSON document inside a string.

```bash
curl -G \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  --data-urlencode 'body-format=atlas_doc_format' \
  'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.get(
    'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    params={'body-format': 'atlas_doc_format'},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "body": {
  "atlas_doc_format": {
   "representation": "atlas_doc_format",
   "value": "{\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"content\":[{\"text\":\"Example page body.\",\"type\":\"text\"}]}],\"version\":1}"
  }
 },
 "id": "33653083"
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### GET /wiki/api/v2/pages/{pageId}

Reads the rendered view of the body.

```bash
curl -G \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  --data-urlencode 'body-format=view' \
  'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.get(
    'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    params={'body-format': 'view'},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "body": {
  "view": {
   "representation": "view",
   "value": "<p>Example page body.</p>"
  }
 },
 "id": "33653083"
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### PUT /wiki/api/v2/pages/{pageId}

Writes a new version with the body sent as atlas_doc_format.

```bash
curl -X PUT \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "id": "{pageId}",
  "status": "current",
  "title": "Example page",
  "version": {
    "number": 3
  },
  "body": {
    "representation": "atlas_doc_format",
    "value": "{\"type\": \"doc\", \"version\": 1, \"content\": [{\"type\": \"paragraph\", \"content\": [{\"type\": \"text\", \"text\": \"Body written as ADF.\"}]}]}"
  }
}' \
  'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.put(
    'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    json={'id': '{pageId}',
          'status': 'current',
          'title': 'Example page',
          'version': {'number': 3},
          'body': {'representation': 'atlas_doc_format',
                   'value': '{"type": "doc", "version": 1, "content": [{"type": "paragraph", '
                            '"content": [{"type": "text", "text": "Body written as ADF."}]}]}'}},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "version": {
  "number": 3
 },
 "body": {
  "storage": {
   "representation": "storage",
   "value": "<p>Body written as ADF.</p>"
  }
 },
 "id": "33653083"
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### PUT /wiki/api/v2/pages/{pageId}

Writes a new version with the body sent as wiki markup.

```bash
curl -X PUT \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "id": "{pageId}",
  "status": "current",
  "title": "Example page",
  "version": {
    "number": 4
  },
  "body": {
    "representation": "wiki",
    "value": "h2. Written as wiki markup"
  }
}' \
  'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.put(
    'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    json={'id': '{pageId}',
          'status': 'current',
          'title': 'Example page',
          'version': {'number': 4},
          'body': {'representation': 'wiki', 'value': 'h2. Written as wiki markup'}},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "version": {
  "number": 4
 },
 "body": {
  "storage": {
   "representation": "storage",
   "value": "<h2>Written as wiki markup</h2>"
  }
 },
 "id": "33653083"
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### GET /wiki/api/v2/pages/{pageId}

Reads the page without body-format, which gives no body.

```bash
curl \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.get(
    'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "id": "33653083",
 "body": {}
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

## How it behaves

- The body is returned under the key of the requested format: body.storage, body.atlas_doc_format or body.view (conf-page-get-storage, conf-page-get-adf, conf-page-get-view).
- The atlas_doc_format value is a string that holds JSON, so it needs a second parse. The same string is expected in a write (conf-page-update-adf).
- Writes sent as atlas_doc_format and as wiki both came back with body.storage in the response, converted to XHTML: <p>Body written as ADF.</p> and <h2>Written as wiki markup</h2>.
- No body-format on a read gives "body": {} (conf-page-get).

## Pitfalls

- wiki was run as a write format only. Reading with body-format=wiki was not run.
- The spec says the body in an update is taken as the latest version, so send the complete document.
- ADF sent as a nested JSON object instead of a string will not match the schema, which defines value as a string.

## Questions and answers

### Which format should I write?

Storage or atlas_doc_format. The spec lists wiki too, and it was converted to storage in the run above.

### Where is the version number in a write?

In the request, version.number, one higher than the current version.

## Related

- [Get a page](https://goingstellar.ro/reference/atlassian-rest-api/get-page/)
- [Update a page and versions](https://goingstellar.ro/reference/atlassian-rest-api/update-page-versions/)
- [Create a page](https://goingstellar.ro/reference/atlassian-rest-api/create-page/)
- [Footer comments](https://goingstellar.ro/reference/atlassian-rest-api/footer-comments/)
- [Content properties](https://goingstellar.ro/reference/atlassian-rest-api/content-properties/)

## Sources

- [Update page (Confluence REST API v2)](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-id-put)
- [Get page by id (Confluence REST API v2)](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-id-get)
- [The Confluence Cloud REST API v2 (Atlassian Developer)](https://developer.atlassian.com/cloud/confluence/rest/v2/intro/)

