Going Stellar

Home/Confluence storage format reference

Confluence storage format

REST API body representations: storage, view and ADF

The Confluence Cloud content API gives the body of a page in several representations. body.storage is the XHTML-based source, body.view is the rendered HTML and body.atlas_doc_format is the ADF JSON. A body can be saved as storage or as ADF and read back in any of them.

Storage format

<ac:structured-macro ac:name="NAME" ac:schema-version="1" ac:macro-id="ID" />

As ADF (Confluence Cloud)

The ADF that Confluence Cloud builds for:

ADF:{"content": [{"attrs": {"extensionKey": "toc", "extensionType": "com.atlassian.confluence.macro.core", "parameters": {"macroParams": {}}}, "type": "extension"}], "type": "doc", "version": 1}
{
 "type": "doc",
 "content": [
  {
   "type": "extension",
   "attrs": {
    "extensionType": "com.atlassian.confluence.macro.core",
    "extensionKey": "toc",
    "parameters": {
     "macroParams": {
      "_parentId": {
       "value": "<page id>"
      }
     },
     "macroMetadata": {
      "macroId": {
       "value": "<id>"
      },
      "schemaVersion": {
       "value": "1"
      },
      "title": "Table of Contents"
     }
    }
   }
  }
 ],
 "version": 1
}

Examples

Storage format sent

<ac:structured-macro ac:name="noformat"><ac:plain-text-body><![CDATA[preformatted *no* formatting]]></ac:plain-text-body></ac:structured-macro>

A noformat macro saved as storage. body.storage returns the macro and body.view returns the rendered panel, while the ADF round trip rewrites it as a code macro.

Rendered view (HTML)

<div class="preformatted panel conf-macro output-block" data-hasbody="true" data-macro-id="<id>" data-macro-name="noformat" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>preformatted *no* formatting</pre>
</div></div>

Storage format after the round trip through ADF

<ac:structured-macro ac:name="code" ac:schema-version="1" ac:macro-id="<id>"><ac:plain-text-body><![CDATA[preformatted *no* formatting]]></ac:plain-text-body></ac:structured-macro>

Sent to Confluence Cloud on .

Storage format sent

<ac:structured-macro ac:name="info"></ac:structured-macro>

An empty info macro. body.storage returns the macro, body.view returns an empty info box, and the ADF round trip drops it.

Rendered view (HTML)

<div class="confluence-information-macro confluence-information-macro-information conf-macro output-block" data-hasbody="false" data-macro-id="<id>" data-macro-name="info"><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"> </span><div class="confluence-information-macro-body"> </div></div>

Storage format after the round trip through ADF

<p />

Sent to Confluence Cloud on .

Storage format sent

<ac:structured-macro ac:name="recently-updated"></ac:structured-macro>

A macro that lists site content. body.storage holds only the macro element, and body.view was replaced with a marker text before publication.

Rendered view (HTML)

<macro output not published: it lists pages, tasks or people from the site>

Storage format after the round trip through ADF

<ac:structured-macro ac:name="recently-updated" ac:schema-version="1" ac:macro-id="<id>" />

Sent to Confluence Cloud on .

Storage format sent

ADF:{"content": [{"attrs": {"extensionKey": "toc", "extensionType": "com.atlassian.confluence.macro.core", "parameters": {"macroParams": {}}}, "type": "extension"}], "type": "doc", "version": 1}

A body saved as ADF, with a toc extension and no ids. body.storage returns an ac:structured-macro with a generated macro-id.

Rendered view (HTML)

<div class="toc-macro client-side-toc-macro  conf-macro output-block" data-hasbody="false" data-headerelements="H1,H2,H3,H4,H5,H6,H7" data-macro-id="<id>" data-macro-name="toc"> </div>

Storage format after the round trip through ADF

<ac:structured-macro ac:name="toc" ac:schema-version="1" ac:macro-id="<id>" />

Sent to Confluence Cloud on .

Storage format sent

ADF:{"content": [{"content": [{"attrs": {"width": 33.33}, "content": [{"content": [{"text": "a", "type": "text"}], "type": "paragraph"}], "type": "layoutColumn"}, {"attrs": {"width": 66.66}, "content": [{"content": [{"text": "b", "type": "text"}], "type": "paragraph"}], "type": "layoutColumn"}], "type": "layoutSection"}], "type": "doc", "version": 1}

A body saved as ADF with two layout columns of 33.33 and 66.66. body.storage returns a two_left_sidebar layout section.

Rendered view (HTML)

<div class="contentLayout2">
<div class="columnLayout two-left-sidebar" data-layout="two-left-sidebar">
<div class="cell aside" data-type="aside">
<div class="innerCell">
<p>a</p></div>
</div>
<div class="cell normal" data-type="normal">
<div class="innerCell">
<p>b</p></div>
</div>
</div>
</div>

Storage format after the round trip through ADF

<ac:layout><ac:layout-section ac:type="two_left_sidebar" ac:breakout-mode="default"><ac:layout-cell><p>a</p></ac:layout-cell><ac:layout-cell><p>b</p></ac:layout-cell></ac:layout-section></ac:layout>

Sent to Confluence Cloud on .

Storage format sent

ADF:{"content": [{"attrs": {"isNumberColumnEnabled": true, "layout": "wide"}, "content": [{"content": [{"content": [{"content": [{"text": "H1", "type": "text"}], "type": "paragraph"}], "type": "tableHeader"}, {"content": [{"content": [{"text": "H2", "type": "text"}], "type": "paragraph"}], "type": "tableHeader"}], "type": "tableRow"}, {"content": [{"attrs": {"colspan": 2}, "content": [{"content": [{"text": "merged", "type": "text"}], "type": "paragraph"}], "type": "tableCell"}], "type": "tableRow"}, {"content": [{"attrs": {"background": "#deebff"}, "content": [{"content": [{"text": "bg", "type": "text"}], "type": "paragraph"}], "type": "tableCell"}, {"content": [{"content": [{"text": "x", "type": "text"}], "type": "paragraph"}], "type": "tableCell"}], "type": "tableRow"}], "type": "table"}], "type": "doc", "version": 1}

A body saved as ADF with a numbered table, a merged cell and a cell background. body.storage returns numberingColumn cells with generated numbers and a colgroup.

Rendered view (HTML)

<div class="table-wrap"><table data-layout="wide" class="confluenceTable"><colgroup><col/></colgroup><tbody><tr><th class="numberingColumn confluenceTh" /><th class="confluenceTh"><p>H1</p></th><th class="confluenceTh"><p>H2</p></th></tr><tr><td class="numberingColumn confluenceTd">1</td><td colspan="2" class="confluenceTd"><p>merged</p></td></tr><tr><td class="numberingColumn confluenceTd">2</td><td data-highlight-colour="#deebff" class="confluenceTd"><p>bg</p></td><td class="confluenceTd"><p>x</p></td></tr></tbody></table></div>

Storage format after the round trip through ADF

<table data-layout="wide"><colgroup><col /></colgroup><tbody><tr><th class="numberingColumn" /><th><p>H1</p></th><th><p>H2</p></th></tr><tr><td class="numberingColumn">1</td><td colspan="2"><p>merged</p></td></tr><tr><td class="numberingColumn">2</td><td data-highlight-colour="#deebff"><p>bg</p></td><td><p>x</p></td></tr></tbody></table>

Sent to Confluence Cloud on .

What changes in conversion

  • body.storage is what was saved and normalised by Confluence. Macros gain ac:schema-version and a generated ac:macro-id, and empty macros are written as self-closing elements.
  • body.view is output only. It holds the rendered HTML, such as a code panel for noformat, a placeholder image for unknown macros, or an error message for a macro with bad parameters. It cannot be saved back.
  • body.atlas_doc_format is built from the stored page. A body saved as ADF is rewritten as storage on write, and the storage that results is the one that later reads return.
  • A save can fail. The probes with an iframe macro and a widget macro returned HTTP 500 with a MacroTypedParameterValueException in the message, and no representation of those bodies exists.

Pitfalls

  • Reading back the same representation you wrote is not proof of lossless storage. Read body.storage after an ADF write to see what the conversion produced.
  • body.view for macros that list site content depends on the content of the site, so it cannot serve as a stable test fixture.
  • Generated values (macro ids, localIds, _parentId) differ between saves. Strip them before comparing.

Questions and answers

Which representation should I edit?

The probes use body.storage for XHTML pages and body.atlas_doc_format for Cloud editor pages. Mixing them in one workflow rewrites the page through the conversion.

Sources

  1. Confluence Cloud REST API v1: content (Atlassian Developer)
  2. Confluence storage format (Atlassian Documentation)
  3. Atlassian Document Format: document structure (Atlassian Developer)

Markdown version · All storage format pages