Write a page’s element tree from the REST API

The Create Page and Update Page endpoints now accept an optional elements field, so you can set a page’s element tree when you create or update the page.

POST /v6/pages
PATCH /v6/pages/{pageIdOrPathname}
  • Create: if you leave out elements, the page starts with an empty root.
  • Update: if you send elements, it replaces the page’s entire tree.
  • Tree shape: the root node has type set to ./components/Root/index.js, a key (a UUID that’s unique within the tree), and props. This is the same shape that expand=elements returns on Get Page.
  • Beta: this is part of the Resource APIs project, which is in Beta and may change. Requests return 403 until the feature is enabled for your site or workspace.

Error response changes

  • A pathname that’s invalid or already in use now returns 400 instead of 409. A 400 is also returned for an invalid element tree.
  • Create Page returns 404 if the site doesn’t exist. Update Page returns 404 if the page or its site doesn’t exist.

For details, see Create Page and Update Page.