Rate this page:

Content - children and descendants

Get content children

GET /wiki/rest/api/content/{id}/child

Returns a map of the direct children of a piece of content. A piece of content has different types of child content, depending on its type. These are the default parent-child content type relationships:

  • page: child content is page, comment, attachment
  • blogpost: child content is comment, attachment
  • attachment: child content is comment
  • comment: child content is attachment

Apps can override these default relationships. Apps can also introduce new content types that create new parent-child content relationships.

Note, the map will always include all child content types that are valid for the content. However, if the content has no instances of a child content type, the map will contain an empty array for that child content type.

Permissions required: 'View' permission for the space, and permission to view the content if it is a page.

App scope requiredREAD

OAuth scopes required
read:confluence-content.summary

Request

Path parameters
id Required

string

The ID of the content to be queried for its children.

Query parameters
expand

Array<string>

A multi-value parameter indicating which properties of the children to expand, where:

  • attachment returns all attachments for the content.
  • comments returns all comments for the content.
  • page returns all child pages of the content.
Style: form

Valid values: attachment, comment, page

parentVersion

integer

The version of the parent content to retrieve children for. Currently, this only works for the latest version.

Default: 0, Format: int32

Example

1
2
3
curl --request GET \
  --url 'https://your-domain.atlassian.net/wiki/rest/api/content/{id}/child' \
  --header 'Accept: application/json'

Responses

Returned if the requested content children are returned.

Content typeValue
application/json

ContentChildren

Move a page to a new location relative to a target page

PUT /wiki/rest/api/content/{id}/move/{position}/{targetId}

Move a page to a new location relative to a target page:

  • before - move the page under the same parent as the target, before the target in the list of children
  • after - move the page under the same parent as the target, after the target in the list of children
  • append - move the page to be a child of the target

Caution: This API can move pages to the top level of a space. Top-level pages are difficult to find in the UI because they do not show up in the page tree display. To avoid this, never use before or after positions when the targetId is a top-level page.

App scope requiredWRITE

OAuth scopes required
write:confluence-content

Request

Path parameters
id Required

string

The ID of the page to be moved

position Required

string

The position to move the page to relative to the target page:

  • before - move the page under the same parent as the target, before the target in the list of children
  • after - move the page under the same parent as the target, after the target in the list of children
  • append - move the page to be a child of the target

Valid values: before, after, append

targetId Required

string

The ID of the target page for this operation

Example

1
2
3
curl --request PUT \
  --url 'https://your-domain.atlassian.net/wiki/rest/api/content/{id}/move/{position}/{targetId}' \
  --header 'Accept: application/json'

Responses

Page was successfully moved

Content typeValue
application/json

object

Get content children by type

GET /wiki/rest/api/content/{id}/child/{type}

Returns all children of a given type, for a piece of content. A piece of content has different types of child content, depending on its type:

  • page: child content is page, comment, attachment
  • blogpost: child content is comment, attachment
  • attachment: child content is comment
  • comment: child content is attachment

Custom content types that are provided by apps can also be returned.

Note, this method only returns direct children. To return children at all levels, use Get descendants by type.

Permissions required: 'View' permission for the space, and permission to view the content if it is a page.

App scope requiredREAD

OAuth scopes required
read:confluence-content.summary

Request

Path parameters
id Required

string

The ID of the content to be queried for its children.

type Required

string

The type of children to return.

Valid values: page, comment, attachment

Query parameters
expand

Array<string>

A multi-value parameter indicating which properties of the content to expand.

  • childTypes.all returns whether the content has attachments, comments, or child pages. Use this if you only need to check whether the content has children of a particular type.
  • childTypes.attachment returns whether the content has attachments.
  • childTypes.comment returns whether the content has comments.
  • childTypes.page returns whether the content has child pages.
  • container returns the space that the content is in. This is the same as the information returned by Get space.
  • metadata.currentuser returns information about the current user in relation to the content, including when they last viewed it, modified it, contributed to it, or added it as a favorite.
  • metadata.properties returns content properties that have been set via the Confluence REST API.
  • metadata.labels returns the labels that have been added to the content.
  • metadata.frontend this property is only used by Atlassian.
  • operations returns the operations for the content, which are used when setting permissions.
  • children.page returns pages that are descendants at the level immediately below the content.
  • children.attachment returns all attachments for the content.
  • children.comment returns all comments on the content.
  • restrictions.read.restrictions.user returns the users that have permission to read the content.
  • restrictions.read.restrictions.group returns the groups that have permission to read the content. Note that this may return deleted groups, because deleting a group doesn't remove associated restrictions.
  • restrictions.update.restrictions.user returns the users that have permission to update the content.
  • restrictions.update.restrictions.group returns the groups that have permission to update the content. Note that this may return deleted groups because deleting a group doesn't remove associated restrictions.
  • history returns the history of the content, including the date it was created.
  • history.lastUpdated returns information about the most recent update of the content, including who updated it and when it was updated.
  • history.previousVersion returns information about the update prior to the current content update.
  • history.contributors returns all of the users who have contributed to the content.
  • history.nextVersion returns information about the update after to the current content update.
  • ancestors returns the parent page, if the content is a page.
  • body returns the body of the content in different formats, including the editor format, view format, and export format.
  • version returns information about the most recent update of the content, including who updated it and when it was updated.
  • descendants.page returns pages that are descendants at any level below the content.
  • descendants.attachment returns all attachments for the content, same as children.attachment.
  • descendants.comment returns all comments on the content, same as children.comment.
  • space returns the space that the content is in. This is the same as the information returned by Get space.

In addition, the following comment-specific expansions can be used:

  • extensions.inlineProperties returns inline comment-specific properties.
  • extensions.resolution returns the resolution status of each comment.
Style: form

Valid values: childTypes.all, childTypes.attachment, childTypes.comment, childTypes.page, container, metadata.currentuser, metadata.properties, metadata.labels, metadata.frontend, operations ...(Show more)

parentVersion

integer

The version of the parent content to retrieve children for. Currently, this only works for the latest version.

Default: 0, Minimum: 0, Format: int32
start

integer

The starting index of the returned content.

Format: int32
limit

integer

The maximum number of content to return per page. Note, this may be restricted by fixed system limits.

Default: 25, Minimum: 0, Format: int32

Example

1
2
3
curl --request GET \
  --url 'https://your-domain.atlassian.net/wiki/rest/api/content/{id}/child/{type}' \
  --header 'Accept: application/json'

Responses

Returned if the requested content is returned.

Content typeValue
application/json

ContentArray

Get content descendants

GET /wiki/rest/api/content/{id}/descendant

Returns a map of the descendants of a piece of content. This is similar to Get content children, except that this method returns child pages at all levels, rather than just the direct child pages.

A piece of content has different types of descendants, depending on its type:

  • page: descendant is page, comment, attachment
  • blogpost: descendant is comment, attachment
  • attachment: descendant is comment
  • comment: descendant is attachment

The map will always include all descendant types that are valid for the content. However, if the content has no instances of a descendant type, the map will contain an empty array for that descendant type.

Permissions required: 'View' permission for the space, and permission to view the content if it is a page.

App scope requiredREAD

OAuth scopes required
read:confluence-content.summary

Request

Path parameters
id Required

string

The ID of the content to be queried for its descendants.

Query parameters
expand

Array<string>

A multi-value parameter indicating which properties of the children to expand, where:

  • attachment returns all attachments for the content.
  • comments returns all comments for the content.
  • page returns all child pages of the content.
Style: form

Valid values: attachment, comment, page

Example

1
2
3
curl --request GET \
  --url 'https://your-domain.atlassian.net/wiki/rest/api/content/{id}/descendant' \
  --header 'Accept: application/json'

Responses

Returned if the requested descendants are returned.

Content typeValue
application/json

ContentChildren

Get content descendants by type

GET /wiki/rest/api/content/{id}/descendant/{type}

Returns all descendants of a given type, for a piece of content. This is similar to Get content children by type, except that this method returns child pages at all levels, rather than just the direct child pages.

A piece of content has different types of descendants, depending on its type:

  • page: descendant is page, comment, attachment
  • blogpost: descendant is comment, attachment
  • attachment: descendant is comment
  • comment: descendant is attachment

Custom content types that are provided by apps can also be returned.

Permissions required: 'View' permission for the space, and permission to view the content if it is a page.

App scope requiredREAD

OAuth scopes required
read:confluence-content.summary

Request

Path parameters
id Required

string

The ID of the content to be queried for its descendants.

type Required

string

The type of descendants to return.

Valid values: page, comment, attachment

Query parameters
expand

Array<string>

A multi-value parameter indicating which properties of the content to expand.

  • childTypes.all returns whether the content has attachments, comments, or child pages. Use this if you only need to check whether the content has children of a particular type.
  • childTypes.attachment returns whether the content has attachments.
  • childTypes.comment returns whether the content has comments.
  • childTypes.page returns whether the content has child pages.
  • container returns the space that the content is in. This is the same as the information returned by Get space.
  • metadata.currentuser returns information about the current user in relation to the content, including when they last viewed it, modified it, contributed to it, or added it as a favorite.
  • metadata.properties returns content properties that have been set via the Confluence REST API.
  • metadata.labels returns the labels that have been added to the content.
  • metadata.frontend this property is only used by Atlassian.
  • operations returns the operations for the content, which are used when setting permissions.
  • children.page returns pages that are descendants at the level immediately below the content.
  • children.attachment returns all attachments for the content.
  • children.comment returns all comments on the content.
  • restrictions.read.restrictions.user returns the users that have permission to read the content.
  • restrictions.read.restrictions.group returns the groups that have permission to read the content. Note that this may return deleted groups, because deleting a group doesn't remove associated restrictions.
  • restrictions.update.restrictions.user returns the users that have permission to update the content.
  • restrictions.update.restrictions.group returns the groups that have permission to update the content. Note that this may return deleted groups because deleting a group doesn't remove associated restrictions.
  • history returns the history of the content, including the date it was created.
  • history.lastUpdated returns information about the most recent update of the content, including who updated it and when it was updated.
  • history.previousVersion returns information about the update prior to the current content update.
  • history.contributors returns all of the users who have contributed to the content.
  • history.nextVersion returns information about the update after to the current content update.
  • ancestors returns the parent page, if the content is a page.
  • body returns the body of the content in different formats, including the editor format, view format, and export format.
  • version returns information about the most recent update of the content, including who updated it and when it was updated.
  • descendants.page returns pages that are descendants at any level below the content.
  • descendants.attachment returns all attachments for the content, same as children.attachment.
  • descendants.comment returns all comments on the content, same as children.comment.
  • space returns the space that the content is in. This is the same as the information returned by Get space.

In addition, the following comment-specific expansions can be used:

  • extensions.inlineProperties returns inline comment-specific properties.
  • extensions.resolution returns the resolution status of each comment.
Style: form

Valid values: childTypes.all, childTypes.attachment, childTypes.comment, childTypes.page, container, metadata.currentuser, metadata.properties, metadata.labels, metadata.frontend, operations ...(Show more)

start

integer

The starting index of the returned content.

Default: 0, Minimum: 0, Format: int32
limit

integer

The maximum number of content to return per page. Note, this may be restricted by fixed system limits.

Default: 25, Minimum: 0, Format: int32

Example

1
2
3
curl --request GET \
  --url 'https://your-domain.atlassian.net/wiki/rest/api/content/{id}/descendant/{type}' \
  --header 'Accept: application/json'

Responses

Returned if the requested content is returned.

Content typeValue
application/json

ContentArray

Copy page hierarchy

POST /wiki/rest/api/content/{id}/pagehierarchy/copy

Copy page hierarchy allows the copying of an entire hierarchy of pages and their associated properties, permissions and attachments. The id path parameter refers to the content id of the page to copy, and the new parent of this copied page is defined using the destinationPageId in the request body. The titleOptions object defines the rules of renaming page titles during the copy; for example, search and replace can be used in conjunction to rewrite the copied page titles.

Response example:

Use the /longtask/ REST API to get the copy task status.

App scope requiredWRITE

OAuth scopes required
write:confluence-content

Request

Path parameters
id Required

string

Body parameters
copyAttachments

boolean

If set to true, attachments are copied to the destination page.

Default: false
copyPermissions

boolean

If set to true, page permissions are copied to the destination page.

Default: false
copyProperties

boolean

If set to true, content properties are copied to the destination page.

Default: false
copyLabels

boolean

If set to true, labels are copied to the destination page.

Default: false
copyCustomContents

boolean

If set to true, custom contents are copied to the destination page.

Default: false
destinationPageId

string

titleOptions

CopyPageHierarchyTitleOptions

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
curl --request POST \
  --url 'https://your-domain.atlassian.net/wiki/rest/api/content/{id}/pagehierarchy/copy' \
  --header 'Content-Type: application/json' \
  --data '{
  "copyAttachments": true,
  "copyPermissions": true,
  "copyProperties": true,
  "copyLabels": true,
  "copyCustomContents": true,
  "destinationPageId": "<string>",
  "titleOptions": {
    "prefix": "<string>",
    "replace": "<string>",
    "search": "<string>"
  }
}'

Responses

Returns a full JSON representation of a long running task

A schema has not been defined for this response code.

Copy single page

POST /wiki/rest/api/content/{id}/copy

Copies a single page and its associated properties, permissions, attachments, and custom contents. The id path parameter refers to the content ID of the page to copy. The target of the page to be copied is defined using the destination in the request body and can be one of the following types.

  • space: page will be copied to the specified space as a root page on the space
  • parent_page: page will be copied as a child of the specified parent page
  • existing_page: page will be copied and replace the specified page

By default, the following objects are expanded: space, history, version.

Permissions required: 'Add' permission for the space that the content will be copied in and permission to update the content if copying to an existing_page.

App scope requiredWRITE

OAuth scopes required
write:confluence-content

Request

Path parameters
id Required

string

Query parameters
expand

Array<string>

A multi-value parameter indicating which properties of the content to expand.

  • childTypes.all returns whether the content has attachments, comments, or child pages. Use this if you only need to check whether the content has children of a particular type.
  • childTypes.attachment returns whether the content has attachments.
  • childTypes.comment returns whether the content has comments.
  • childTypes.page returns whether the content has child pages.
  • container returns the space that the content is in. This is the same as the information returned by Get space.
  • metadata.currentuser returns information about the current user in relation to the content, including when they last viewed it, modified it, contributed to it, or added it as a favorite.
  • metadata.properties returns content properties that have been set via the Confluence REST API.
  • metadata.labels returns the labels that have been added to the content.
  • metadata.frontend this property is only used by Atlassian.
  • operations returns the operations for the content, which are used when setting permissions.
  • children.page returns pages that are descendants at the level immediately below the content.
  • children.attachment returns all attachments for the content.
  • children.comment returns all comments on the content.
  • restrictions.read.restrictions.user returns the users that have permission to read the content.
  • restrictions.read.restrictions.group returns the groups that have permission to read the content. Note that this may return deleted groups, because deleting a group doesn't remove associated restrictions.
  • restrictions.update.restrictions.user returns the users that have permission to update the content.
  • restrictions.update.restrictions.group returns the groups that have permission to update the content. Note that this may return deleted groups because deleting a group doesn't remove associated restrictions.
  • history returns the history of the content, including the date it was created.
  • history.lastUpdated returns information about the most recent update of the content, including who updated it and when it was updated.
  • history.previousVersion returns information about the update prior to the current content update.
  • history.contributors returns all of the users who have contributed to the content.
  • history.nextVersion returns information about the update after to the current content update.
  • ancestors returns the parent page, if the content is a page.
  • body returns the body of the content in different formats, including the editor format, view format, and export format.
  • version returns information about the most recent update of the content, including who updated it and when it was updated.
  • descendants.page returns pages that are descendants at any level below the content.
  • descendants.attachment returns all attachments for the content, same as children.attachment.
  • descendants.comment returns all comments on the content, same as children.comment.
  • space returns the space that the content is in. This is the same as the information returned by Get space.

In addition, the following comment-specific expansions can be used:

  • extensions.inlineProperties returns inline comment-specific properties.
  • extensions.resolution returns the resolution status of each comment.
Style: form

Valid values: childTypes.all, childTypes.attachment, childTypes.comment, childTypes.page, container, metadata.currentuser, metadata.properties, metadata.labels, metadata.frontend, operations ...(Show more)

Body parameters
copyAttachments

boolean

If set to true, attachments are copied to the destination page.

Default: false
copyPermissions

boolean

If set to true, page permissions are copied to the destination page.

Default: false
copyProperties

boolean

If set to true, content properties are copied to the destination page.

Default: false
copyLabels

boolean

If set to true, labels are copied to the destination page.

Default: false
copyCustomContents

boolean

If set to true, custom contents are copied to the destination page.

Default: false
destination Required

CopyPageRequestDestination

Defines where the page will be copied to, and can be one of the following types.

  • parent_page: page will be copied as a child of the specified parent page
  • space: page will be copied to the specified space as a root page on the space
  • existing_page: page will be copied and replace the specified page
pageTitle

string

If defined, this will replace the title of the destination page.

body

object

If defined, this will replace the body of the destination page.

Min properties: 1, Max properties: 1

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
curl --request POST \
  --url 'https://your-domain.atlassian.net/wiki/rest/api/content/{id}/copy' \
  --header 'Accept: application/json;charset=UTF-8' \
  --header 'Content-Type: application/json' \
  --data '{
  "copyAttachments": true,
  "copyPermissions": true,
  "copyProperties": true,
  "copyLabels": true,
  "copyCustomContents": true,
  "destination": {
    "type": "space",
    "value": "<string>"
  },
  "pageTitle": "<string>",
  "body": {
    "storage": {
      "value": "<string>",
      "representation": "view"
    },
    "editor2": {
      "value": "<string>",
      "representation": "view"
    }
  }
}'

Responses

Returned if the content is copied.

Content typeValue
application/json;charset=UTF-8

Content

Rate this page: