Get macro usage details in Confluence Cloud using CQL, Postman, and JSON-to-CSV conversion
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
Use CQL in Postman to get macro usage details, export the response as JSON, and convert it to CSV with Power Query.
Solution
CQL API
Use the following CQL API request in Postman:
https://YOUR_INSTANCE.atlassian.net/wiki/rest/api/content/search?cql=type=page AND macro in ('macro_name1','macro_name2')&limit=10000&start=0
Replace YOUR_INSTANCE with your site name. Replace macro_name1 and macro_name2 with the macro names you want to search for. Macro names are case sensitive.
Keep the request parameters together so the purpose of each value is clear:
type=pagesearches pages.macro in ('macro_name1','macro_name2')searches for the listed macros.limit=10000sets the response limit.start=0sets the starting point.
Postman files to import
CQL macro usage
{
"info": {
"_postman_id": "cb1b578c-9174-4647-9c49-7ef317d9b7ca",
"name": "CQL macro usage",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "25367731"
},
"item": [
{
"name": "macro usage",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "{{api-token}}",
"type": "string"
},
{
"key": "username",
"value": "{{username}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "https://{{site-name}}/wiki/rest/api/content/search?cql=type=page AND macro in ('{{macro-name}},{{macro-name}}')&limit=10000&start=0",
"protocol": "https",
"host": [
"{{site-name}}"
],
"path": [
"wiki",
"rest",
"api",
"content",
"search"
],
"query": [
{
"key": "cql",
"value": "type=page AND macro in ('{{macro-name}},{{macro-name}}')"
},
{
"key": "limit",
"value": "10000"
},
{
"key": "start",
"value": "0"
}
]
}
},
"response": []
}
]
}MacroUsage
{
"id": "db7351f4-90b2-44f4-b7c6-c75cc23db291",
"name": "MacroUsage",
"values": [
{
"key": "site-name",
"value": "Your site's base URL",
"type": "default",
"enabled": true
},
{
"key": "username",
"value": "Your email address",
"type": "default",
"enabled": true
},
{
"key": "api-token",
"value": "Your API token",
"type": "default",
"enabled": true
},
{
"key": "macro-name",
"value": "macro-name (Case sensitive)",
"type": "default",
"description": "",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2025-08-28T05:12:17.498Z",
"_postman_exported_using": "Postman/11.60.3"
}Steps
Copy and save the two JSON files in this article.
Import the JSON files into Postman.
Set the
site-namevariable to your site's base URL.Set the
usernamevariable to your email address.Set the
api-tokenvariable to your API token.Set the
macro-namevariable to the case-sensitive macro name.Run the CQL API call in Postman.
Export the CQL response as a JSON file.
Import JSON to Excel via Power Query:
Under Get Data, select the JSON option.
In the local file browser, select your JSON file.
Select Open.
In the Power Query editor, use the table created from the JSON data.
Continue transforming the data, or select Close and apply.
Save the detailed macro report as a CSV file.
How the conversion works: Power Query uses automatic table detection to flatten the JSON data into a table.
Feature requests
To improve this process, we have the following Feature Requests currently opened in order to address these issues:
Was this helpful?