Create a Page

With HAPI, we've made it easy for you to create new pages in your Confluence instance!

Create a new page

To create a new page, run a script like this in the Script Console:

Pages.create("DS", "2023 Page 1") {
    setParentPage("2023 Pages")
}

A note about parent pages

  • The parent page must already be created. If you don't specify a parent page, the space's homepage is the default parent page.
  • A user will have access to the page they create even if they don’t have access to the parent page.

This script creates a new page in the Demonstration Space (DS), under the parent page 2023 Pages

The result of the HAPI script, which is a new page.

Customize the above script

You can customize the script by changing the space, page title, and parent page. 

Pages.create("SPACEKEY", "NEW PAGE TITLE") {
    setParentPage("PARENT PAGE TITLE")
}

Create a new page with labels

We'll build on the above script to add a new page with labels! 

Pages.create("DS", "2023 Page 2") {
    setLabels("new", "2023")
    setParentPage("2023 Pages")
}

And here is your new page with labels: 

The result of the HAPI script, which is a new page with labels.

To learn about HAPI labels, visit Work with Labels.

Customize the above script

You can customize the script by changing the space, page title, labels and parent page. 

Pages.create("SPACEKEY", "NEW PAGE TITLE") {
    setLabels("LABEL-1", "LABEL-2")
    setParentPage("PARENT PAGE TITLE")
}



Related pages


On this page