Home/Atlassian REST API reference
Jira and Confluence Cloud REST API
Delete, trash and purge Confluence pages by API
DELETE /wiki/api/v2/pages/{id} moves a published page to the trash and answers 204. The same call with purge=true on a trashed page removes it permanently. A draft is discarded with draft=true and is never trashed.
Endpoints
| Method | Path | What it does |
|---|---|---|
DELETE | /wiki/api/v2/pages/{id} | Trashes a page; purge=true purges a trashed page; draft=true discards a draft. |
GET | /wiki/api/v2/pages/{id} | Reads a page, including a trashed one. |
Examples
DELETE /wiki/api/v2/pages/{pageId}
Deletes a published page. The call answers 204 with no body.
curl
curl -X DELETE \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.delete(
'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 204
No response body.
Sent to Atlassian Cloud on .
GET /wiki/api/v2/pages/{pageId}
Reads the page after the delete.
curl
curl \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}'Python (requests)
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": "33620331",
"status": "trashed",
"title": "Example child page"
}Sent to Atlassian Cloud on .
GET /wiki/api/v2/pages/{pageId}
Reads the same page with status=trashed in the query.
curl
curl -G \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
--data-urlencode 'status=trashed' \
'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}'Python (requests)
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={'status': 'trashed'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"status": "trashed",
"id": "33620331"
}Sent to Atlassian Cloud on .
DELETE /wiki/api/v2/pages/{pageId}
Purges the trashed page.
curl
curl -X DELETE \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}?purge=true'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.delete(
'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}?purge=true',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'purge': 'true'},
)
print(r.status_code, r.text)Response: HTTP 204
No response body.
Sent to Atlassian Cloud on .
GET /wiki/api/v2/pages/{pageId}
Reads the page after the purge.
curl
curl \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}'Python (requests)
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 404
{
"errors": [
{
"status": 404,
"code": "NOT_FOUND",
"title": "Not Found",
"detail": null
}
]
}Sent to Atlassian Cloud on .
DELETE /wiki/api/v2/pages/{pageId}
Discards a draft.
curl
curl -X DELETE \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}?draft=true'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.delete(
'https://your-domain.atlassian.net/wiki/api/v2/pages/{pageId}?draft=true',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'draft': 'true'},
)
print(r.status_code, r.text)Response: HTTP 204
No response body.
Sent to Atlassian Cloud on .
How it behaves
- The first DELETE answers 204 and the page then reads back with status "trashed" and parentId and position set to null (conf-page-get-trashed).
- A GET on a trashed page worked with and without status=trashed (conf-page-get-trashed, conf-page-get-trashed-status).
- DELETE with purge=true on the trashed page answers 204; the next GET gives 404 NOT_FOUND with the title "Not Found" (conf-page-purge-child, conf-page-get-purged).
- DELETE with draft=true on a draft answers 204 (conf-page-delete-draft).
Pitfalls
- Purge is permanent. The spec says it must target a trashed page, so the safe order is delete, check, purge.
- A trashed page still answers a GET with 200, so a status check is needed before a script treats a 200 as a live page.
- Discarded drafts are not sent to the trash, so there is nothing to restore.
Questions and answers
How do I restore a trashed page?
No restore was run. The spec text says a trashed page can be restored later; use the Confluence UI or test the API on a scratch page.
What does purge=true do on a page that is not trashed?
Not run. The spec says the page must be trashed first.