Kitefold
Guides

Confluence CQL cheat sheet

CQL (Confluence Query Language) is the search language behind Confluence Cloud: a field, an operator and a value, joined with AND and OR. Here's every operator, the fields you'll use most, dates, labels, people, the page tree and sorting, with searches you can copy. Every example was run on our test site. At the end: what CQL can't search for.

Where to run a search

  • In the address bar: your site's address, then /wiki/search?cql= and the search, for example https://your-site.atlassian.net/wiki/search?cql=type = page AND space = DOCS. The results open in Confluence's search screen, which doesn't show a count.
  • As data: /wiki/rest/api/search?cql= returns the results as JSON, with the total in totalSize.
  • In an app with a CQL box, such as Query & Bulk Actions, which shows the count and explains errors.

A search only returns what you're allowed to see. Replace DOCS with your own space key, and the numbers with your own page ids.

Operators

OperatorMeansExample
=is exactlyspace = "DOCS"
!=is nottype = page AND label != "draft"
~contains the words (text and title)title ~ "onboarding"
!~doesn't contain the wordstype = page AND text !~ "deprecated"
> >= < <=after, before (dates)created >= now("-7d")
in (…)any ofspace in ("DOCS", "HR")
not in (…)none oflabel not in ("draft", "old")
AND OR NOTjoin and negatespace = "DOCS" AND NOT label = "draft"
( )groupspace = "DOCS" AND (label = "hr" OR label = "it")
ORDER BY … ASC / DESCsort (see sorting)type = page ORDER BY lastmodified DESC
  • Quote values that contain spaces or hyphens: label = "how-to", title = "Leave policy 2026". Without quotes Confluence can't read the search.
  • AND is applied before OR, so space = "DOCS" AND label = "hr" OR label = "it" finds HR pages in DOCS plus every page labelled it. Add brackets.
  • label != "draft" and label not in ("draft") give the same results: pages without that label.

Fields

FieldFindsExample
typepage, blogpost, attachment, comment, spacetype in (page, blogpost)
spaceitems in a space, by keyspace = "DOCS"
space.titleitems in spaces whose name has these wordsspace.title ~ "Marketing"
titlethe title: ~ for words, = for the exact titletitle = "Leave policy 2026"
textwords anywhere in the title, body or labelstext ~ "onboarding"
labellabelslabel in ("how-to", "howto")
creatorwho created itcreator = currentUser()
contributoranyone who edited itcontributor = currentUser()
mentionpages that @mention someonemention = currentUser()
watcherpages someone watcheswatcher = currentUser()
favouritepages someone has starredfavourite = currentUser()
created, lastmodifieddates (see dates)lastmodified >= startOfMonth()
ancestoreverything below a page, at any depthancestor = 123456
parentonly a page's direct childrenparent = 123456
idone item by idid = 123456
fileExtensionattached files by extensiontype = attachment AND fileExtension = "pdf"
macropages that use a macro, by its namemacro = "toc"

A page's id is the number in its address, after /pages/. For people other than you, CQL needs their Atlassian account id, not their name: creator = "557058:…".

Words, phrases and titles

SearchFinds
text ~ "onboarding"pages with the word anywhere, including the title
text ~ "\"bank holidays\""the exact phrase (the inner quotes need a backslash)
title ~ "onboard*"titles with a word starting “onboard”
title = "Leave policy 2026"exactly that title
text !~ "deprecated"pages without the word (combine with a space or type)

Dates

WriteMeans
now("-7d")7 days ago, at this time
now("-12M")12 months ago (capital M for months)
startOfDay(), startOfWeek(), startOfMonth(), startOfYear()the start of today, this week, this month, this year
startOfWeek("-1w")the start of last week (works with the others too, such as startOfDay("-12M"))
"2026-10-01"a fixed date

Combine them with created or lastmodified: lastmodified < now("-12M") is “not changed in a year”, created >= startOfMonth() is “created this month”.

Sorting

ORDER BY works on title, created, lastmodified, type, creator, contributor and id, with ASC or DESC. It can't sort by space (“space does not support ordering”) or by label.

Searches to copy

To findSearch
Pages I created that changed this monthtype = page AND creator = currentUser() AND lastmodified >= startOfMonth()
Pages nobody has edited in a year, oldest firsttype = page AND lastmodified < now("-12M") ORDER BY lastmodified ASC
Everything under one pageancestor = 123456
Blog posts from the last 7 daystype = blogpost AND created >= now("-7d") ORDER BY created DESC
Pages that mention memention = currentUser() ORDER BY lastmodified DESC
Pages I watch in a spacetype = page AND watcher = currentUser() AND space = "DOCS"
A label in two spacesspace in ("DOCS", "HR") AND label = "policy"
PDFs and Word files in a spacetype = attachment AND fileExtension in ("pdf", "docx") AND space = "DOCS"
Pages with a table of contentstype = page AND macro = "toc"

More clean-up searches, such as files by type and pages that copy in other pages, are in Confluence clean-up searches with CQL.

What CQL can't do

  • No “has no labels” search. label is EMPTY is rejected (“Could not parse cql”). The nearest is excluding the labels you know about.
  • No sorting by space or label.
  • No links. CQL can't find broken links, which pages link to a page, orphan pages or unused files: see what CQL can't find.
  • No views, likes, popularity, page size or word count. None of these is a CQL field.
  • Archived pages are left out of results.
  • Only what you can see. Two people running the same search can get different results.

Write, check and act on CQL with Query & Bulk Actions

  1. A Confluence admin installs Query & Bulk Actions; anyone can then open it from the Apps menu.
  2. Type CQL into its CQL box, or build the search with drop-downs, or Ask in plain English and check the CQL it writes before anything runs. Results show their count, and a mistake in the CQL is explained in plain words.
  3. Save the search for yourself or your team, show its live results on any page with the Query results macro, export them as CSV or Markdown, or change them in bulk: labels, watchers or archive, with a preview first.

Disclosure: Kitefold makes Query & Bulk Actions, so we're not neutral. Every search on this page works in Confluence's own search screen too, for free.

Get it on the Marketplace Read the help Free for up to 10 users

Every search on this page was run on our test site on 20 November 2026; field and function names follow Atlassian's developer documentation for CQL. Confluence changes often; if something here no longer matches what you see, email support@kitefold.app and we'll update it.