Create Confluence Pages in Bulk with the REST API

If you are comfortable with a script, the Confluence Cloud REST API can create pages from any data source. This is the outline, plus the parts that usually go wrong.

The request

Confluence Cloud's v2 API creates a page with POST /wiki/api/v2/pages. The body needs the space ID (a number, not the space key), a title, and the body content:

{
  "spaceId": "123456",
  "status": "current",
  "title": "Acme onboarding",
  "parentId": "987654",
  "body": { "representation": "storage", "value": "<p>Owner: Sam</p>" }
}

Authenticate with your Atlassian account email and an API token using basic auth. Look up the space ID first with GET /wiki/api/v2/spaces?keys=KEY.

Body format

The storage representation is Confluence's XHTML-based format. Plain paragraphs and tables are straightforward. Macros, panels and status lozenges use ac: elements, and the easiest way to get them right is to build one page by hand and read its storage body back with GET /wiki/api/v2/pages/{id}?body-format=storage. Escape every value you insert; a customer name with an ampersand breaks the request.

Parents, order and labels

  • Create parents before children, and keep a map from each row to the ID Confluence returns, so child rows can set parentId.
  • Labels are added after the page exists, with a separate call per page.
  • Check for an existing page with the same title under the parent before creating, or a re-run of the script creates duplicates or fails partway through.

Rate limits and partial failure

Large runs hit Atlassian's rate limits. Handle HTTP 429 by waiting for the Retry-After value and retrying, and log the result of every row to a file so a failed run can resume from where it stopped rather than starting over.

When a script is not worth it

The script is a good fit when pages come from another system on a schedule. For a one-off batch from a spreadsheet, the work is mostly the parts above: escaping, parent ordering, duplicate checks and a dry run. Bulk Page Creator for Confluence does those inside Confluence, as you, with no API token to create and no data leaving Atlassian. It previews every row as create, skip, update or error before writing anything.

The same result without the script

30-day free trial from the Atlassian Marketplace, then US$20/month for up to 10 users, billed by Atlassian.

See Bulk Page Creator for Confluence Install from Atlassian Marketplace

I'm the developer of Bulk Page Creator for Confluence, so weigh this guide accordingly. Atlassian and Confluence are trademarks of Atlassian. This app is independent and is not affiliated with or endorsed by Atlassian.