It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can I insert the History macro through REST API call?


      We are creating a page  "B" on a button click from a HTML macro on Page "A". Now while creating page B using an Ajax call from Page A, we would also like to enable the History macro at the bottom of Page B through the ajax call. Is this possible?



3 answers

1 accepted

0 votes
Answer accepted

Hello KC,

Using the REST API does allow for a lot of adaptability within the product. Ideally, you’re going to want to create the page via the API you will include the page info via the storage format. The storage format does allow for adding in macros. Additional information on the storage formats can be found at Confluence Storage Format along with the formatting of the Change-History Macro.

I hope this provides guidance and you’re able to include macros within your API calls on page creation within Confluence.

Stephen Sifers  

Thanks for the Answer Sifers.

When I insert a Change History macro on a page and check the Storage Format by clicking ... I am seeing few tags like ac:name="change-history" and a macro id. I then inserted a HTML macro on a page and pasted what ever content I found from Storage Format but that doesn't display the history macro. Do we need to send these through an API call, only then will the macro be enabled?

Hello again KC,

I was able to create a page within Confluence 6.14 using the REST API endpoint of POST /rest/api/content. I confirmed this endpoint works with a macro within the storage value of the JSON payload.

Here is an example of what I used to create a page with the History Macro within:

curl -v -u username:password -X POST -H 'Content-Type: application/json' -d '{"id":"1231235","type":"page","title":"History Macro","space":{"key":"SPACEKEY"},"body":{"storage":{"value":"<p>History macro test</p><p><ac:structured-macro ac:name=\"change-history\" ac:schema-version=\"1\" ac:macro-id=\"360a0d80-082e-4c82-9ee5-0aac5b72f828\" /></p>","representation":"storage"}}}'

Please give this a try and let us know if you’re able to create a Confluence page.

Stephen Sifers

Thanks Stephen, it worked, had to remove the ID.

How do you run the command?

Any change to run it within the HTML Macro and use the username and password of the logged-in user?

Hi Stefan,


I tried with the above command it did't worked in the cloud confluence.

Can you please help me to insert the macro to cloud confluence page.

Hi  @Stephen Sifers 


I have a similar requirement to Krishna in that I want to use the REST API to create a new page with the IFrame macro embedded and referring to an external site (i.e. the macro documented in

Where would I be able to find the reference for the IFrame macro (assuming that this can be done)?  

Thanks and regards,


The following REST API script creates a new page with the IFrame macro:

curl -u <username>:<password> -X POST -H 'Content-Type: application/json' -d '{"type":"page","title":"A Test Page", "space":{"key":"SPACE"}, "ancestors" : [ { "id": "115328548" } ],"body":{"storage":{"value":"<h1>IFrame Macro Test</h1><p>Foo Bar Blah</p><p><ac:structured-macro ac:schema-version=\"1\" ac:name=\"iframe\"><ac:parameter ac:name=\"URL\"></ac:parameter><ac:parameter ac:name=\"Width\">100%</ac:parameter><ac:default-parameter></ac:default-parameter></ac:structured-macro></p>","representation":"storage"}}}' https://localhost:8080/confluence/rest/api/content | python -mjson.tool;

However, the parameters like URL are not be ing set. Any suggestions would be gratefully received.

Thanks and regards,

The XHTML fragment needs to be as follows:


<ac:structured-macro ac:name="iframe" ac:schema-version="1" ac:macro-id="f3b89c73-0096-409c-84fa-0158bf4e0f4f" xmlns:ac="" xmlns:acxhtml="" xmlns:ri="">
    <ac:parameter ac:name="src">
        <ri:url ri:value=""/>
    <ac:parameter ac:name="width">100%</ac:parameter>
    <ac:parameter ac:name="height">750</ac:parameter>

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

What project did you transition or start on Confluence with the shift to remote work?

It’s been great to hear from fellow users over the last few weeks about the best tips and fun moments you’ve had working on Confluence since the transition to working remote. I’d love to keep the c...

382 views 11 11
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you