Going Stellar

Home/CQL reference

CQL field

parent in CQL: syntax and examples (Confluence)

parent returns the pages one level directly below a given page, nothing deeper. Use it when you want the first level of a section, such as the chapters of a handbook. For the whole subtree use ancestor.

Syntax

p
a
r
e
n
t
 
=
 
<
c
o
n
t
e
n
t
I
d
>

Arguments

ArgumentWhat it doesOptional
contentIdThe numeric id of the parent page.yes

Works with

  • Operators: =, != (checked). The documentation also lists IN and NOT IN, but they fail, see below.
  • Functions: none
  • Not with: ~, !~, >, >=, <, <=, IN, NOT IN

Examples

parent = 32964613 AND type = page

The chapters directly under a handbook, one level only.

Run on Confluence Cloud on .

parent = 32964613 AND type = page ORDER BY title ASC

The same list in alphabetical order, ready to compare with a table of contents.

Run on Confluence Cloud on .

parent != 655541 AND space = SD AND type = page

Pages in a space that are not direct children of the space home, so the nested ones.

Run on Confluence Cloud on .

ancestor = 655541 AND parent != 655541 AND type = page

Combines both fields to isolate the deeper levels of a tree.

Run on Confluence Cloud on .

parent = 32964613 AND title ~ "policy"

Policies at the first level of the handbook.

Run on Confluence Cloud on .

Pitfalls

  • The documentation says IN and NOT IN are supported. They are not: parent in (32964613) returns HTTP 500, ServiceException: IllegalArgumentException executing cql. parent not in (32964613) and parent in recentlyViewedContent(10) fail the same way (checked on Confluence Cloud, November 2026). Use = or !=, or switch to ancestor, which takes IN.
  • parent sees one level. parent = 655541 AND title = "Code of Conduct" finds nothing, while ancestor = 655541 AND title = "Code of Conduct" finds the page, because it sits one level further down.
  • Like ancestor, it needs an id. A title or a text operator fails: parent ~ 655541 returns Expecting a value for operator '~' after field 'parent' but got '655541'.

Sources

  1. CQL fields (Atlassian Developer, Confluence Cloud)

Markdown version · All CQL pages