CQL field
label in CQL (Confluence): syntax and examples
The label field matches content that carries a given label. Use it to pull a tagged set of pages, such as everything labelled for review, or to exclude labelled pages from a list. It takes exact label names, not patterns.
Syntax
label = value
label in (value1, value2)
label not in (value1, value2)
Arguments
| Argument | What it does |
|---|---|
value | A label name. Wrap it in double quotes when it contains a hyphen, a space or other punctuation. |
Works with
- Operators: =, !=, IN, NOT IN
- Functions: none
- Not with: ~, !~, >, >=, <, <=
Examples
label = "meeting-notes"Collects every page tagged as meeting notes. The label has a hyphen, so it is quoted.
Run on Confluence Cloud on .
label in ("draft", "review") AND type = page AND space = SDShows pages that are still in draft or waiting for review in one space.
Run on Confluence Cloud on .
label not in (draft, review)Keeps only content that carries neither label, a quick list of finished work.
Run on Confluence Cloud on .
label != "draft" AND type = page AND space = SDLists the pages of a space that are not marked as draft.
Run on Confluence Cloud on .
label in (draft) AND lastmodified < now("-4w")Finds drafts nobody has touched for four weeks, good candidates for a reminder.
Run on Confluence Cloud on .
Pitfalls
- A hyphen needs quotes.
label = meeting-notesfails with "Could not parse cql",label = "meeting-notes"runs. Plain words such asdraftwork with or without quotes, and a quoted value gives the same query as the unquoted one. label ~ "draft"fails with "Operator '~' is not supported for field 'label'". To match several labels list them:label in (draft, review). To match a label prefix, search the text field instead.- A query cannot start with NOT.
not label = draftandNOT label in (draft)fail with "Could not parse cql";type = page AND NOT label = draftruns. Writinglabel != draftavoids the problem. - There is no IS EMPTY test:
label is emptyfails with "Could not parse cql". A prefixed form such aslabel = global:finishedfails the same way. Whether label case is ignored is not covered by the docs, so match the case you see in the page.