Skip to content

CMS Page — Update

Edits one locale of an existing CMS page. Equivalent to PUT /api/admin/cms/pages/{id}.

Prerequisites

The example uses an illustrative id value. Replace it with the id of a CMS page that exists in your store — use the adminCmsPages query to discover valid ids.

Operation

OperationType
updateAdminCmsPageMutation

Input

FieldTypeRequiredNotes
idID!yesResource IRI — /api/admin/cms/pages/{id}.
localeString!yesWhich locale block is being written. Only this locale's content changes; other locales are left untouched.
channels[Int!]!yesNon-empty list of channel IDs. Replaces the page's current channel assignment.
<locale>ObjectyesA block keyed by the locale value above — { url_key, page_title, html_content, meta_title, meta_keywords, meta_description }. url_key, page_title, and html_content are required inside it.

Locale-nested payload

Update is per-locale, mirroring the admin edit form. The top-level locale names which language you are editing, and the matching block (e.g. en: { … }) carries that locale's content. To update a second language, send another request with locale: "fr" and an fr: { … } block. The block name must equal the locale value — locale: "en" requires an en block.

This differs from Create, which takes flat top-level fields broadcast to every locale.

Changing url_key creates a redirect

When you change a locale's url_key, the store automatically records a 301 redirect from the old slug to the new one, so existing links and bookmarks keep working. Deleting the page later removes those redirects.

Response

The mutation returns the updated page. Every scalar resolves — urlKey, pageTitle, htmlContent, metaTitle, metaKeywords, metaDescription, locale, previewUrl, createdAt, updatedAt — and translations / channels are field-selectable connections ({ edges { node { … } } }) reflecting the post-update state. Select only what you need.

Errors

ConditionResult
url_key, page_title, or html_content missing in the locale blockvalidation error
url_key already used by another pagevalidation error
channels empty or contains an unknown IDvalidation error
Page ID not foundnot-found error
Admin role lacks cms.editpermission error

Released under the MIT License.