# Update a Confluence page and read its versions

URL: https://goingstellar.ro/reference/atlassian-rest-api/update-page-versions/

PUT /wiki/api/v2/pages/{id} replaces title and body and needs version.number set to the current number plus one. Sending the current number again is refused with 409. GET /wiki/api/v2/pages/{id}/versions lists every version, newest first.

## Endpoints

| Method | Path | What it does |
|---|---|---|
| PUT | `/wiki/api/v2/pages/{id}` | Updates a page; the request carries id, status, title, version and body. |
| GET | `/wiki/api/v2/pages/{id}/versions` | Lists the versions of a page. |

## Examples

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

Updates version 1 to version 2 with a message.

```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": 2,
    "message": "Edited through the API"
  },
  "body": {
    "representation": "storage",
    "value": "<p>Edited body.</p>"
  }
}' \
  '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': 2, 'message': 'Edited through the API'},
          'body': {'representation': 'storage', 'value': '<p>Edited body.</p>'}},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "version": {
  "number": 2,
  "message": "Edited through the API",
  "createdAt": "2026-11-29T17:31:52.932Z"
 },
 "body": {
  "storage": {
   "representation": "storage",
   "value": "<p>Edited body.</p>"
  }
 },
 "title": "Example page",
 "id": "33653083"
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

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

Repeats the update with version number 2 when 2 is already the current version.

```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": 2
  },
  "body": {
    "representation": "storage",
    "value": "<p>Stale.</p>"
  }
}' \
  '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': 2},
          'body': {'representation': 'storage', 'value': '<p>Stale.</p>'}},
)
print(r.status_code, r.text)
```

Response: HTTP 409

```
{
 "errors": [
  {
   "status": 409,
   "code": "CONFLICT",
   "title": "Version must be incremented when updating a page. Current Version: [2]. Provided version: [2]",
   "detail": null
  }
 ]
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

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

Writes version 3 from an atlas_doc_format body.

```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,
  "message": null
 },
 "body": {
  "storage": {
   "representation": "storage",
   "value": "<p>Body written as ADF.</p>"
  }
 }
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

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

Writes version 4 from 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,
  "message": null
 },
 "body": {
  "storage": {
   "representation": "storage",
   "value": "<h2>Written as wiki markup</h2>"
  }
 }
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

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

Lists the versions after four saves.

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

```python
import os
import requests

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

Response: HTTP 200

```
{
 "results": [
  {
   "number": 4,
   "message": "",
   "createdAt": "2026-11-29T17:31:56.228Z"
  },
  {
   "number": 3,
   "message": "",
   "createdAt": "2026-11-29T17:31:55.007Z"
  },
  {
   "number": 2,
   "message": "Edited through the API",
   "createdAt": "2026-11-29T17:31:52.932Z"
  },
  {
   "number": 1,
   "message": "",
   "createdAt": "2026-11-29T17:31:17.620Z"
  }
 ]
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

## How it behaves

- The update response is 200 and holds the new version object, with the message that was sent (conf-page-update).
- A version number equal to the current one gives 409 CONFLICT with the text "Version must be incremented when updating a page. Current Version: [2]. Provided version: [2]" (conf-page-update-stale-version).
- When no message is sent, the update response has "message": null (conf-page-update-adf, conf-page-update-wiki).
- The versions listing returned numbers 4, 3, 2, 1 in that order, with the message of version 2 kept (conf-page-versions).

## Pitfalls

- The 409 text names the current version. Read the page again, merge, and retry with the current number plus one.
- Every update run sent id, status, title, version and body. Treat the call as a full replace of title and body.
- The versions listing has body: {} for each page entry unless body-format is passed.

## Questions and answers

### What number goes in version.number?

The current version number plus one.

### Can I read an older version?

The get-page call has a version parameter in the spec, which takes a previous version number.

## Related

- [Get a page](https://goingstellar.ro/reference/atlassian-rest-api/get-page/)
- [Body formats](https://goingstellar.ro/reference/atlassian-rest-api/page-body-formats/)
- [Delete, trash and purge](https://goingstellar.ro/reference/atlassian-rest-api/delete-trash-purge/)
- [Create a page](https://goingstellar.ro/reference/atlassian-rest-api/create-page/)
- [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 versions (Confluence REST API v2)](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-version/#api-pages-id-versions-get)
- [The Confluence Cloud REST API v2 (Atlassian Developer)](https://developer.atlassian.com/cloud/confluence/rest/v2/intro/)

