Home/Atlassian REST API reference
Jira and Confluence Cloud REST API
Get a Confluence page with the REST API
GET /wiki/api/v2/pages/{id} returns the page metadata and the current version. The body object is empty until body-format names a representation. The page id is the only lookup key; to find a page by title use the pages listing.
Endpoints
| Method | Path | What it does |
|---|---|---|
GET | /wiki/api/v2/pages/{id} | Returns one page; supports body-format, version, get-draft and include-* parameters. |
Examples
GET /wiki/api/v2/pages/{pageId}
Reads a page with no parameters. The body is an empty object.
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
{
"spaceId": "655364",
"parentId": "655541",
"version": {
"number": 1,
"message": ""
},
"id": "33653083",
"body": {},
"status": "current",
"title": "Example page",
"_links": {
"webui": "/spaces/SD/pages/33653083/Example+page"
}
}Sent to Atlassian Cloud on .
GET /wiki/api/v2/pages/{pageId}
Asks for the storage representation of the body.
curl
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 (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={'body-format': 'storage'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"parentId": "655541",
"version": {
"number": 1,
"message": ""
},
"spaceId": "655364",
"status": "current",
"body": {
"storage": {
"representation": "storage",
"value": "<p>Example page body.</p>"
}
},
"title": "Example page",
"id": "33653083"
}Sent to Atlassian Cloud on .
GET /wiki/api/v2/pages/{pageId}
Asks for the rendered view representation.
curl
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 (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={'body-format': 'view'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"parentId": "655541",
"version": {
"number": 1,
"message": ""
},
"spaceId": "655364",
"body": {
"view": {
"representation": "view",
"value": "<p>Example page body.</p>"
}
},
"status": "current",
"title": "Example page",
"id": "33653083"
}Sent to Atlassian Cloud on .
GET /wiki/api/v2/pages/999999999999
Reads a page id that does not exist.
curl
curl \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
'https://your-domain.atlassian.net/wiki/api/v2/pages/999999999999'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/wiki/api/v2/pages/999999999999',
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": "Cannot find a page with id [999999999999]",
"detail": null
}
]
}Sent to Atlassian Cloud on .
GET /wiki/api/v2/pages/{pageId}
Reads a page that was moved to the trash, with no status filter.
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
{
"parentId": null,
"position": null,
"id": "33620331",
"status": "trashed",
"title": "Example child page"
}Sent to Atlassian Cloud on .
How it behaves
- Without body-format the response has "body": {} (conf-page-get). With body-format=storage the body holds {"storage": {"representation", "value"}} (conf-page-get-storage).
- A missing id gives 404 with an errors array whose first entry has code NOT_FOUND and a title that names the id (conf-page-get-404).
- A trashed page is still returned with 200 and status "trashed", without any status parameter (conf-page-get-trashed).
- The version object in the response holds number, message, minorEdit, authorId and createdAt; that number is the base for the next update.
Pitfalls
- Reading a page by id for an edit is only half the job: keep version.number, because the update call needs that number plus one.
- Do not treat a 200 as proof that a page is live. Check status, which can be current, draft or trashed.
- The _links values are relative to the base URL given in _links.base, which already includes /wiki.
Questions and answers
How do I get the page body?
Add body-format=storage, view or atlas_doc_format to the request. The body is then under body.<format>.value.
Does a deleted page return 404?
A trashed page returns 200 with status trashed. A purged page returns 404.