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 examplehttps://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 intotalSize. - 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
| Operator | Means | Example |
|---|---|---|
= | is exactly | space = "DOCS" |
!= | is not | type = page AND label != "draft" |
~ | contains the words (text and title) | title ~ "onboarding" |
!~ | doesn't contain the words | type = page AND text !~ "deprecated" |
> >= < <= | after, before (dates) | created >= now("-7d") |
in (…) | any of | space in ("DOCS", "HR") |
not in (…) | none of | label not in ("draft", "old") |
AND OR NOT | join and negate | space = "DOCS" AND NOT label = "draft" |
( ) | group | space = "DOCS" AND (label = "hr" OR label = "it") |
ORDER BY … ASC / DESC | sort (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"andlabel not in ("draft")give the same results: pages without that label.
Fields
| Field | Finds | Example |
|---|---|---|
type | page, blogpost, attachment, comment, space | type in (page, blogpost) |
space | items in a space, by key | space = "DOCS" |
space.title | items in spaces whose name has these words | space.title ~ "Marketing" |
title | the title: ~ for words, = for the exact title | title = "Leave policy 2026" |
text | words anywhere in the title, body or labels | text ~ "onboarding" |
label | labels | label in ("how-to", "howto") |
creator | who created it | creator = currentUser() |
contributor | anyone who edited it | contributor = currentUser() |
mention | pages that @mention someone | mention = currentUser() |
watcher | pages someone watches | watcher = currentUser() |
favourite | pages someone has starred | favourite = currentUser() |
created, lastmodified | dates (see dates) | lastmodified >= startOfMonth() |
ancestor | everything below a page, at any depth | ancestor = 123456 |
parent | only a page's direct children | parent = 123456 |
id | one item by id | id = 123456 |
fileExtension | attached files by extension | type = attachment AND fileExtension = "pdf" |
macro | pages that use a macro, by its name | macro = "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
| Search | Finds |
|---|---|
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
| Write | Means |
|---|---|
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 find | Search |
|---|---|
| Pages I created that changed this month | type = page AND creator = currentUser() AND lastmodified >= startOfMonth() |
| Pages nobody has edited in a year, oldest first | type = page AND lastmodified < now("-12M") ORDER BY lastmodified ASC |
| Everything under one page | ancestor = 123456 |
| Blog posts from the last 7 days | type = blogpost AND created >= now("-7d") ORDER BY created DESC |
| Pages that mention me | mention = currentUser() ORDER BY lastmodified DESC |
| Pages I watch in a space | type = page AND watcher = currentUser() AND space = "DOCS" |
| A label in two spaces | space in ("DOCS", "HR") AND label = "policy" |
| PDFs and Word files in a space | type = attachment AND fileExtension in ("pdf", "docx") AND space = "DOCS" |
| Pages with a table of contents | type = 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 EMPTYis 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
- A Confluence admin installs Query & Bulk Actions; anyone can then open it from the Apps menu.
- 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.
- 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.
Related guides
- Confluence clean-up searches with CQL, and what CQL can’t find
- How to export Confluence pages to Markdown (with images)
- Moving from CQL Search or Bulk Action Tools before Connect ends
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.