# CQL reference for Confluence Cloud: fields and functions

URL: https://goingstellar.ro/reference/cql/

CQL (Confluence Query Language) is the search language behind Confluence's advanced search, the REST API and macros that list content. One page per field, operator, function and keyword.

We ran every example on Confluence Cloud and give the date of the run. The few we could not run are marked as taken from the documentation. Where the official operator tables and the real search disagree, the page says so.

## Fields

- [ancestor](https://goingstellar.ro/reference/cql/ancestor-field.md): The ancestor field in Confluence CQL finds all pages below a page, at any depth. Content id values, IN, difference from parent, examples and errors.
- [content](https://goingstellar.ro/reference/cql/content-field.md): The content field in Confluence CQL is an alias of id. Syntax, proof they behave the same, attachment ids with att, and when to pick which name.
- [contributor](https://goingstellar.ro/reference/cql/contributor-field.md): The contributor field in Confluence CQL finds content a user created or edited. currentUser(), fullname, IN, differences from creator, examples.
- [created](https://goingstellar.ro/reference/cql/created-field.md): The created field in Confluence CQL filters content by creation date. Date formats, now() and startOf functions, tested examples, a failing docs example.
- [creator](https://goingstellar.ro/reference/cql/creator-field.md): The creator field in Confluence CQL finds content created by a user. currentUser(), fullname search, accountId, IN, real errors and examples.
- [favourite](https://goingstellar.ro/reference/cql/favourite-field.md): The favourite field in Confluence CQL finds items a user starred. British and American spelling, currentUser(), spaces vs pages and the bare-field error.
- [fileExtension](https://goingstellar.ro/reference/cql/fileextension-field.md): The fileExtension field in Confluence CQL finds attachments by file type. Syntax, IN lists, why SVG or .svg find nothing and the filesize field.
- [id](https://goingstellar.ro/reference/cql/id-field.md): The id field in Confluence CQL finds content by its numeric id. Syntax, IN lists, the att prefix for attachments and the tested errors.
- [label](https://goingstellar.ro/reference/cql/label-field.md): The label field in Confluence CQL finds content by label. Supports =, !=, IN and NOT IN. Tested examples, quoting rules for hyphens and the NOT trap.
- [lastmodified](https://goingstellar.ro/reference/cql/lastmodified-field.md): The lastmodified field in Confluence CQL finds content changed before, after or on a date. Date formats, functions, ORDER BY, examples and traps.
- [macro](https://goingstellar.ro/reference/cql/macro-field.md): Use the macro field in Confluence CQL to find pages that contain a given macro, such as panel, expand or details. Syntax, examples and pitfalls.
- [mention](https://goingstellar.ro/reference/cql/mention-field.md): The mention field in Confluence CQL finds content that @mentions a user. Syntax, currentUser(), mention.fullname, accountIds and tested pitfalls.
- [owner](https://goingstellar.ro/reference/cql/owner-field.md): The owner field in Confluence CQL finds content owned by a user. Syntax, currentUser(), owner.fullname, type filters and tested pitfalls.
- [pageStatus](https://goingstellar.ro/reference/cql/pagestatus-field.md): Use the pageStatus field in Confluence CQL to find pages by their status, such as Rough draft or Ready for review. Syntax, examples and pitfalls.
- [parent](https://goingstellar.ro/reference/cql/parent-field.md): The parent field in Confluence CQL finds only the direct children of a page. Syntax, difference from ancestor, the IN error in the docs, examples.
- [space](https://goingstellar.ro/reference/cql/space-field.md): The space field in Confluence CQL limits a search to spaces by key. Covers space.key, space.title, space.type, tested examples and quoting traps.
- [subtype](https://goingstellar.ro/reference/cql/subtype-field.md): Use the subtype field in Confluence CQL to find pages of a particular kind. The documented value is live, for Live Docs. Syntax, examples, pitfalls.
- [text](https://goingstellar.ro/reference/cql/text-field.md): The text field in Confluence CQL searches titles, bodies and labels at once. Only ~ and !~ work. Phrases, wildcards, tested examples and errors.
- [title](https://goingstellar.ro/reference/cql/title-field.md): The title field in Confluence CQL finds pages by exact title or by words. Wildcards, IN lists, tested examples and the docs example that fails.
- [type](https://goingstellar.ro/reference/cql/type-field.md): The type field in Confluence CQL filters by content type: page, blogpost, comment, attachment. Tested examples and the list of values the server accepts.
- [user](https://goingstellar.ro/reference/cql/user-field.md): Use the user field, user.fullname and user.accountid in Confluence CQL to search for people by name or account ID. Syntax, examples and pitfalls.
- [watcher](https://goingstellar.ro/reference/cql/watcher-field.md): The watcher field in Confluence CQL finds content a user is watching. Syntax, currentUser(), accountIds and how = differs from IN with currentUser().

## Operators

- [!=](https://goingstellar.ro/reference/cql/not-equals-operator.md): The != operator in Confluence CQL excludes content with one exact field value. Syntax, supported fields, tested examples and what != really includes.
- [!~](https://goingstellar.ro/reference/cql/does-not-contain-operator.md): The CQL !~ operator excludes content whose title or text matches a word. See working examples, the wildcard trap and what it does on space.
- [<](https://goingstellar.ro/reference/cql/less-than-operator.md): The < operator in Confluence CQL finds content dated before a value. Syntax, tested examples for stale pages and old files, and the date-only trap.
- [<=](https://goingstellar.ro/reference/cql/less-than-equals-operator.md): The <= operator in Confluence CQL keeps content up to and including a date. Syntax, tested examples, and why the docs example shows >= instead.
- [=](https://goingstellar.ro/reference/cql/equals-operator.md): The = operator in Confluence CQL matches a field to one exact value. Syntax, which fields accept it, tested examples and the traps with titles and dates.
- [>](https://goingstellar.ro/reference/cql/greater-than-operator.md): The > operator in Confluence CQL finds content created or modified after a date. Syntax, date formats, tested examples and the date-only trap.
- [>=](https://goingstellar.ro/reference/cql/greater-than-equals-operator.md): The >= operator in Confluence CQL keeps content on or after a date. Syntax, date formats, tested examples and how to cover exactly one day.
- [IN](https://goingstellar.ro/reference/cql/in-operator.md): The CQL IN operator matches content when a field equals any value in a list. Syntax, working examples, and the fields where it fails in Confluence Cloud.
- [NOT IN](https://goingstellar.ro/reference/cql/not-in-operator.md): The CQL NOT IN operator excludes content whose field matches any value in a list. Syntax, examples and the fields that reject it in Confluence Cloud.
- [~](https://goingstellar.ro/reference/cql/contains-operator.md): The CQL ~ operator runs a text match on title, text and other fields. See wildcards, exact phrases, working examples and what it does on space.

## Functions

- [currentUser()](https://goingstellar.ro/reference/cql/currentuser.md): Use currentUser() in Confluence CQL to find pages you created, edited, watch, favourited or were mentioned in. Syntax, fields, examples and pitfalls.
- [endOfDay()](https://goingstellar.ro/reference/cql/endofday.md): endOfDay() is the end of the current day in CQL, which resolves to midnight at the start of tomorrow. Offsets, snapshot queries, tested examples.
- [endOfMonth()](https://goingstellar.ro/reference/cql/endofmonth.md): endOfMonth() is the end of the current month in CQL. Use it with "-1M" for closed monthly reporting windows. Tested examples, offsets and pitfalls.
- [endOfWeek()](https://goingstellar.ro/reference/cql/endofweek.md): endOfWeek() closes the current week in CQL. Use it with "-1w" or "-2w" to build exact weekly review windows. Tested queries and boundary notes.
- [endOfYear()](https://goingstellar.ro/reference/cql/endofyear.md): endOfYear() is the end of the current year in CQL. Use it with "-1y" for yearly archive cleanup and year-closed reports. Tested queries, offsets, pitfalls.
- [favouriteSpaces()](https://goingstellar.ro/reference/cql/favouritespaces.md): favouriteSpaces() in Confluence CQL returns the space keys you starred. Use it with space IN to search only your own spaces. Examples and pitfalls.
- [now()](https://goingstellar.ro/reference/cql/now.md): now() in Confluence CQL gives a date relative to the moment of the search, such as now("-4w"). Accepted units, working fields, errors and examples.
- [recentlyViewedContent()](https://goingstellar.ro/reference/cql/recentlyviewedcontent.md): recentlyViewedContent(limit, offset) in Confluence CQL returns the IDs of pages you opened lately. Use it with id IN to search your history. Limits.
- [recentlyViewedSpaces()](https://goingstellar.ro/reference/cql/recentlyviewedspaces.md): recentlyViewedSpaces(limit) in Confluence CQL returns the keys of spaces you opened lately. Use it with space IN to search where you have been. Limits.
- [startOfDay()](https://goingstellar.ro/reference/cql/startofday.md): startOfDay() is 00:00 today in CQL, or a day, hour or minute away with an offset. Use it for daily digests. Syntax, tested queries and offset errors.
- [startOfMonth()](https://goingstellar.ro/reference/cql/startofmonth.md): startOfMonth() returns 00:00 on the 1st of the current month in CQL. Use it for monthly reporting. Offsets like "-1M", tested queries and the m/M trap.
- [startOfWeek()](https://goingstellar.ro/reference/cql/startofweek.md): startOfWeek() gives the first moment of the current week in CQL. Build weekly reviews with offsets like "-1w". Tested queries and pitfalls.
- [startOfYear()](https://goingstellar.ro/reference/cql/startofyear.md): startOfYear() is 1 January 00:00 of the current year in CQL. Use it for yearly archive cleanup and year-to-date counts. Offsets, tested examples, errors.

## Keywords

- [AND](https://goingstellar.ro/reference/cql/and-keyword.md): The CQL AND keyword joins clauses so content must match all of them. Syntax, examples, precedence over OR and a check on lowercase use in Confluence.
- [NOT](https://goingstellar.ro/reference/cql/not-keyword.md): The CQL NOT keyword negates one clause or a group in parentheses. Syntax, working examples and the places where Confluence refuses to parse it.
- [OR](https://goingstellar.ro/reference/cql/or-keyword.md): The CQL OR keyword widens a search to content matching any clause. Syntax, examples, grouping with parentheses and how it ranks against AND.
- [ORDER BY](https://goingstellar.ro/reference/cql/order-by.md): ORDER BY sorts CQL results by one or more fields, ascending or descending. See which fields sort in Confluence Cloud and the exact errors for the others.

## Syntax rules

- [Reserved characters and words](https://goingstellar.ro/reference/cql/reserved-words.md): Which characters and words need quotes or escaping in Confluence CQL, with the full lists from the documentation and the real error messages.
- [Text search](https://goingstellar.ro/reference/cql/text-search-syntax.md): How the ~ operator searches text in Confluence CQL: phrases, ? and * wildcards, fuzzy matching, proximity and exclusions, each tested on real pages.

