# CMS v2 pages

Module-based page editing

## Load a page for the builder

 - [GET /api/v2/webpages/v2/pages/{recordUuid}](https://developer.caraer.com/apis/cms-v2-pages/get.md)

## Replace a page draft

 - [PUT /api/v2/webpages/v2/pages/{recordUuid}](https://developer.caraer.com/apis/cms-v2-pages/save.md)

## Take one locale offline

 - [PUT /api/v2/webpages/v2/pages/{recordUuid}/unpublish](https://developer.caraer.com/apis/cms-v2-pages/unpublish.md)

## Publish one locale, or all of them

 - [PUT /api/v2/webpages/v2/pages/{recordUuid}/publish](https://developer.caraer.com/apis/cms-v2-pages/publish.md): Copies the draft over the published document. Publishing is per locale so a translated page can ship without republishing the others.

## Update slug, title, excerpt, SEO and page scripts

 - [PUT /api/v2/webpages/v2/pages/{recordUuid}/meta](https://developer.caraer.com/apis/cms-v2-pages/savemeta.md)

## Preview field values on the forked module

 - [PUT /api/v2/webpages/v2/pages/{recordUuid}/ai/module-fork/sessions/{sessionId}/fields](https://developer.caraer.com/apis/cms-v2-pages/updatemoduleforkfields.md): Writes test values into the playground session without changing the live page.

## CMS v2 object template document

 - [GET /api/v2/webpages/v2/pages/templates/{objectUuid}](https://developer.caraer.com/apis/cms-v2-pages/gettemplate.md)

## Replace a CMS v2 object template

 - [PUT /api/v2/webpages/v2/pages/templates/{objectUuid}](https://developer.caraer.com/apis/cms-v2-pages/savetemplate.md)

## Apply patches to a page draft

 - [POST /api/v2/webpages/v2/pages/{recordUuid}/patch](https://developer.caraer.com/apis/cms-v2-pages/patch.md): Rejected with 409 when expectedRevision does not match, so a stale client cannot overwrite another editor's work.

## Restore a draft snapshot

 - [POST /api/v2/webpages/v2/pages/{recordUuid}/history/{index}/restore](https://developer.caraer.com/apis/cms-v2-pages/restorehistory.md)

## Create a translated sibling page for an environment

 - [POST /api/v2/webpages/v2/pages/{recordUuid}/environments/{key}/translate](https://developer.caraer.com/apis/cms-v2-pages/createtranslation.md)

## Host this page on another environment

 - [POST /api/v2/webpages/v2/pages/{recordUuid}/environments/{key}/host](https://developer.caraer.com/apis/cms-v2-pages/hostonenvironment.md)

## Rewrite a page or a module from a prompt

 - [POST /api/v2/webpages/v2/pages/{recordUuid}/ai/rewrite](https://developer.caraer.com/apis/cms-v2-pages/airewrite.md): Returns patches the editor applies through the same revision channel as a manual edit, so the change is undoable. Page scope may add, remove and reorder modules. A module's code lives in a shared npm package, so the AI rewrites field values and composition, never the component itself.

## Start a Modify-this-module playground session

 - [POST /api/v2/webpages/v2/pages/{recordUuid}/ai/module-fork/sessions](https://developer.caraer.com/apis/cms-v2-pages/startmodulefork.md): CMS v2 companies and pages only. Copies the installed module's published source into a playground session. Live code edits stay off the company site until save publishes a platform v2 private-app package and a rebuild compiles it.

## Publish the forked module into a private app

 - [POST /api/v2/webpages/v2/pages/{recordUuid}/ai/module-fork/sessions/{sessionId}/save](https://developer.caraer.com/apis/cms-v2-pages/savemodulefork.md): Merges the new module into the whole npm package so sibling modules are not retired, then swaps this placement with set_module.

## Rewrite forked module source from a prompt

 - [POST /api/v2/webpages/v2/pages/{recordUuid}/ai/module-fork/sessions/{sessionId}/prompt](https://developer.caraer.com/apis/cms-v2-pages/promptmodulefork.md)

## Create or reuse the custom 404 page

 - [POST /api/v2/webpages/v2/pages/not-found](https://developer.caraer.com/apis/cms-v2-pages/ensurenotfound.md): Finds the page at /404 on the root Webpage object, or creates an empty draft there, and stores it as the company custom 404 page.

## Signed preview URL for the builder iframe

 - [GET /api/v2/webpages/v2/pages/{recordUuid}/preview-link](https://developer.caraer.com/apis/cms-v2-pages/previewlink.md): The iframe renders the draft document, which the public API will not serve. The signature covers the page and an expiry so a leaked link cannot be retargeted or replayed.

## Draft snapshots for one locale

 - [GET /api/v2/webpages/v2/pages/{recordUuid}/history](https://developer.caraer.com/apis/cms-v2-pages/history.md)

## Environment coverage for the builder dropdown

 - [GET /api/v2/webpages/v2/pages/{recordUuid}/environments](https://developer.caraer.com/apis/cms-v2-pages/environmentcoverage.md)

## Modules available to this company

 - [GET /api/v2/webpages/v2/pages/library/modules](https://developer.caraer.com/apis/cms-v2-pages/library.md): Backs the builder's library picker. Only modules from installed apps, and never retired ones, because a new page must be able to render them.

## Remove an environment from this page only

 - [DELETE /api/v2/webpages/v2/pages/{recordUuid}/environments/{key}](https://developer.caraer.com/apis/cms-v2-pages/unselectenvironment.md)

## Discard a Modify-this-module playground session

 - [DELETE /api/v2/webpages/v2/pages/{recordUuid}/ai/module-fork/sessions/{sessionId}](https://developer.caraer.com/apis/cms-v2-pages/discardmodulefork.md)

