Stand with Ukraine 🇺🇦

All Spaces — Confluence Cloud Macro

confluence-content

This macro lists all spaces in a Confluence instance, including their name, author, and creation date. It retrieves space data via the Confluence API and formats it in a sortable table with columns for space name, author, and the creation date.

Try for free

Template

#set($spaces = $ConfluenceManager.get("/wiki/api/v2/spaces?type=global&limit=250&include-icon=true"))
<table class="aui aui-table-sortable">
  <thead>
    <tr>
      <th>Space name</th>
      <th>Author name</th>
      <th>Date created</th>
    </tr>
  </thead>
  <tbody>
    #foreach($space in $spaces.results)
    #set($user = $ConfluenceManager.get("/wiki/rest/api/user?accountId=$space.authorId"))
    #set($createdAt = $StringUtils.substringBefore($space.createdAt, "T"))
    #set($icon = $StringUtils.remove($space.icon.path, "/wiki") )
    <tr>
      <td><img src="$baseUrl$icon" width="15" style="margin-right: 0.7rem;"><a href="$baseUrl$space._links.webui">$space.name</a></td>
      <td><a href="$baseUrl/people/$user.accountId">@$user.displayName</a></td>
      <td>$createdAt</td>
    </tr>
    #end
  </tbody>
</table>