# Delete, trash and purge Confluence pages by API

URL: https://goingstellar.ro/reference/atlassian-rest-api/delete-trash-purge/

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.

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

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

Reads the page after the delete.

```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": "33620331",
 "status": "trashed",
 "title": "Example child page"
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

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

Reads the same page with status=trashed in the query.

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

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

Purges the trashed page.

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

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

Reads the page after the purge.

```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 404

```
{
 "errors": [
  {
   "status": 404,
   "code": "NOT_FOUND",
   "title": "Not Found",
   "detail": null
  }
 ]
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

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

Discards a draft.

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

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

## Related

- [Get a page](https://goingstellar.ro/reference/atlassian-rest-api/get-page/)
- [Create a page](https://goingstellar.ro/reference/atlassian-rest-api/create-page/)
- [Update a page and versions](https://goingstellar.ro/reference/atlassian-rest-api/update-page-versions/)
- [Child pages](https://goingstellar.ro/reference/atlassian-rest-api/page-children/)
- [Spaces](https://goingstellar.ro/reference/atlassian-rest-api/spaces/)

## Sources

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

