CQL keyword
NOT keyword in CQL (Confluence): syntax and examples
NOT negates a clause that comes after it, or a whole group in parentheses. Use it for conditions that have no negative operator, or to flip an OR group in one step instead of rewriting each clause.
Syntax
clause1 AND NOT clause2
clause1 and not (clause2 or clause3)
Arguments
| Argument | What it does | Optional |
|---|---|---|
clause | A CQL clause, or several clauses in parentheses. | yes |
Works with
- Operators: negates a clause with any operator, including ~ and IN.
- Functions: any function inside the negated clause.
- Not with: the start of a query, and a clause with no AND or OR before it.
Examples
type = page and not space = SDFinds pages that live outside one space.
Run on Confluence Cloud on .
type = page and not title ~ "template"Removes template pages from a page list without a !~ clause.
Run on Confluence Cloud on .
type = page and space = SD and not (title ~ "template" or title ~ "policy")Excludes two kinds of page with one negation by grouping them.
Run on Confluence Cloud on .
space = SD and not type = attachmentKeeps everything in a space except uploaded files.
Run on Confluence Cloud on .
label = cql and not space = SDThe documentation example, with a space key that exists. Finds labelled pages that are not in the space.
Run on Confluence Cloud on .
Pitfalls
- NOT cannot start a query.
not space = SDfails with "Could not parse cql". Put a positive clause first and join with AND, as intype = page and not space = SD(checked on Confluence Cloud, November 2026). - NOT still needs a joiner.
type = page and space = SD not title ~ "template"fails with the same parse error. Writeand not. - Case does not matter.
not,NOTandNotall run (checked on Confluence Cloud, November 2026), so the lowercase form in the Atlassian example is valid. - For simple cases the negative operators read better:
!=,!~andNOT INneed no extra keyword.