Going Stellar

Home/CQL reference

CQL field

macro field in CQL: syntax and examples (Confluence)

The macro field matches content whose body contains at least one instance of the named macro. Use it to audit where a macro is used before you change or retire it, or to find pages that still use an old report or include macro.

Syntax

macro = macro-name
macro IN (macro-name, macro-name)

Arguments

ArgumentWhat it doesOptional
macro-nameThe macro's name as Confluence stores it, for example panel, expand or details. Names that contain a hyphen must be quoted.yes

Works with

  • Operators: =, !=, IN, NOT IN (as documented).
  • Not with: ~, !~, >, >=, <, <=. The documentation lists no supported functions.

Examples

macro = panel AND space = SD

Find the pages in one space that use the Panel macro, for example before you restyle your callouts.

Run on Confluence Cloud on .

macro in (toc, widget)

The documentation's example: pages that have a Table of Contents or a Widget Connector macro in the body.

Run on Confluence Cloud on .

macro = jira

Find content that embeds Jira issues with the Jira issue macro. A space where nobody uses it gives an empty list, which is also a useful answer.

Run on Confluence Cloud on .

macro in ("page-properties", details) AND space = SD

Pages that carry a properties table, checking both names that the macro may be stored under. The quotes are needed for the hyphen.

Run on Confluence Cloud on .

macro = expand AND lastmodified < now("-4w")

Pages with an Expand section that nobody has touched for four weeks, a short list to review for stale hidden content.

Run on Confluence Cloud on .

macro != toc AND space = SD AND type = page

Pages in a space that have no table of contents, so you can decide where one is missing.

Run on Confluence Cloud on .

Pitfalls

  • A macro name with a hyphen needs quotes. macro = recently-updated fails with "Could not parse cql", while macro = "recently-updated" runs and finds the page that uses it (checked on Confluence Cloud, November 2026).
  • The name is case sensitive. macro = panel finds pages, macro = PANEL and macro = Panel run without an error and match nothing (checked on Confluence Cloud, November 2026).
  • A name that does not exist is not an error. macro = cheese simply returns an empty list, so a typo looks the same as "nobody uses it". Test a name you are sure of first.
  • macro ~ toc is rejected with "Operator '~' is not supported for field 'macro'". Use = or IN with the exact name.

Sources

  1. CQL fields (Atlassian Developer, Confluence Cloud)

Markdown version · All CQL pages