Get Space page hierarchy using the REST api

We are looking into using the REST api to create backups for all the content on our confluence cloud page. We would like this content to match the structure within confluence. Is there a simple 'view space structure' REST call to get the hierarchical structure of the pages within a space? 

At the moment the only way I can think of is recursively accessing the "/content/{id}/child/page" starting with the space root page until it returns an empty list. However this could end up being a ridiculous number of requests. 

Thanks for your help and I'll be happy to clarify anything. 



1 answer

Hi Andrew,

I think that if you use the space content API rest point(with depth=all) and expand the ancestors you will be able to collect the structure in one call



Thanks for your help Peter. Perhaps I've not been setting up the pages correctly but my ancestors entry appears blank: 


_expandable: {
	ancestors: "",


I can get the descendants though of each page returned by doing:

Unsure if this is the best of doing it but it seems to work! 


Thanks for your help again,






Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

377 views 20 10
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you