Skip to main content

In your app

A controller answers a route on your app: it calls updatePage() and returns the answer.

Add the controller

app/controllers/update_page_controller.ts

Add the route

start/routes.ts
Put it behind your auth middleware (.use(middleware.auth())): it acts with your key’s access.

Call it

Your own page’s form or script sends PATCH /page/ckitdo5oq004pu69kr6oxo6fr:en:published and gets back its answer as JSON. Test it, below, calls it.
Perfect for:
  • Updating page titles or content
  • Moving pages within the tree
  • Making incremental changes
Can use MongoDB-style operators and dot notation for nested properties. Include _targetId and _position to move the page within the tree.

Find the id

id is the document’s _id, from a list. Ask the list for only the fields you need: each row is a document’s id and those fields.
AdonisJS
Pass row.id as id. Drafts: list with { aposMode: 'draft' } to get the draft’s id (Find an id).

Required parameters

One object, e.g. updatePage({ id }); leave out the optional fields.
string
required
Required. Computed document ID (can optionally include mode and locale, e.g., id:en:published) Matches ^\S+$.
AposMode | null | undefined
Optional. Leave it out and the site uses "published". published (the default) or draft. Drafts need a credential that may see them: an API key with the type’s write scope (content:<type>:write), or a signed-in editor. The public and a key with only the read scope get 403. One of draft, published.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. The locale to read or write, e.g. en (default: the site’s default locale).
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. The page to place it beside or under, by _id (_home and _archive work too). Default _home.
Position | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Where, relative to _targetId. Default lastChild. One of before, after, firstChild, lastChild.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. URL slug for the page.
boolean | null | undefined
Optional. Leave it out and the site uses false. Whether page is orphaned (not in tree structure)
FlatPageResponseResultsItemVisibility | null | undefined
Optional. Leave it out and the site uses "public". Page visibility setting. One of public, loginRequired, private.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. The page type: one of the site’s page types (the type its pages carry). Anything else is refused with the list.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Page title. At most 100 characters.
MainArea | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Widgets, top to bottom: send { "items": [ … ] }, one object per widget with its type. Writing it replaces the whole area.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. An ISO 8601 date and time, e.g. 2026-10-21T14:30:00.000Z.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. An ISO 8601 date and time, e.g. 2026-10-21T14:30:00.000Z.
string | null | undefined
Optional. Leave it out and the site uses "". Overrides the document title in the browser tab and search results. Leave blank to use the regular title.
string | null | undefined
Optional. Leave it out and the site uses "". Shown in search results and link previews. Aim for 150–160 characters.
ImageArea | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Used for Open Graph / social link previews. Recommended 1200×630. Widgets, top to bottom: send { "items": [ … ] }, one object per widget with its type. Writing it replaces the whole area.
readonly PagePageFontOverridesItem[] | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Optional. Set part of this page in a different typeface. Leave empty to follow the site’s fonts (Site design → Typography). Individual sections can still override this for themselves. At most 4 items.
Optional. Leave it out and the site uses "inherit". The ribbon of phrases scrolling across the top of the footer. Its phrases and the site-wide default are set in Site design → Footer: Marquee. One of inherit, on, off.
SectionsArea | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Widgets, top to bottom: send { "items": [ … ] }, one object per widget with its type. Writing it replaces the whole area. A new document starts with page-header.
string | null | undefined
Optional. Leave it out and the site uses "sparkles". Any Font Awesome icon name, e.g. star, bolt, arrow-left-to-bracket (no “fa-” prefix). Browse at fontawesome.com/icons.
ComingSoonIconFamily | null | undefined
Optional. Leave it out and the site uses "classic-regular". Icon family. One of classic-regular, duotone-regular, brands, jelly, jelly-duo, whiteboard.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Optional — leave empty to use the design’s own color rhythm.
ComingSoonIconAnimation | null | undefined
Optional. Leave it out and the site uses "none". Icon animation. One of none, fa-beat, fa-bounce, fa-fade, fa-beat-fade, fa-flip, fa-shake, fa-spin.
ComingSoonIconSize | null | undefined
Optional. Leave it out and the site uses "5x". Relative to the component’s base icon size. One of default, sm, lg, xl, 2xl, 2x, 3x, 4x, 5x.
string | null | undefined
Optional. Leave it out and the site uses "". Optional. Shown under the icon while this page has no content. Leave empty for a tasteful default line.
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Optional. Color of the ”← back” link at the top of every post. Leave empty to use the site accent color.
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Optional light-theme override. Falls back to the dark-theme color, then the accent.
Optional. Leave it out and the site uses "semibold". Back link weight. One of normal, medium, semibold, bold, extrabold.
Optional. Leave it out and the site uses "normal". Back link size. One of small, normal, large, xlarge.
SectionsArea | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Widgets, top to bottom: send { "items": [ … ] }, one object per widget with its type. Writing it replaces the whole area. A new document starts with page-header.
BlogListArea | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Widgets, top to bottom: send { "items": [ … ] }, one object per widget with its type. Writing it replaces the whole area. A new document starts with blog-list.
SectionsArea | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Widgets, top to bottom: send { "items": [ … ] }, one object per widget with its type. Writing it replaces the whole area.
string | null | undefined
Optional. Leave it out and the site uses "Back to all posts". The visible button text. Leave empty to hide the button.
BackButtonVariant | null | undefined
Optional. Leave it out and the site uses "outline". Solid fills with the color; Outline / Soft / Text link use it for the border + text. One of solid, outline, soft, link.
BackButtonSize | null | undefined
Optional. Leave it out and the site uses "normal". Button size. One of small, normal, large.
BackButtonRadius | null | undefined
Optional. Leave it out and the site uses "slight". Corner radius. One of pill, rounded, slight, square.
string | null | undefined
Optional. Leave it out and the site uses "--fetchski-accent". Solid fill, or the border + text for the other styles. Defaults to the brand accent; CLEAR it for a transparent, outline-only button.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Optional light-theme override. Falls back to the dark-theme color. (Brand tokens already flip per theme.)
string | null | undefined
Optional. Leave it out and the site uses "--fetchski-ink". The text/icon color. Clear it to derive from the button color (readable on solid fills).
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Optional light-theme override. Falls back to the dark-theme label color.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Optional. Drives the hover treatment. Leave empty to derive it from the button color.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Optional light-theme override. Falls back to the dark-theme hover color.
BackButtonStyle | null | undefined
Optional. Leave it out and the site uses "sweep". The hover treatment: a soft shadow, a colored offset shadow, a glow, a fill sweep, or a thicker border. One of none, single, dual, glow, sweep, thicken.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Optional. The offset-shadow or glow color on hover. Leave empty to use the site secondary color.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Optional light-theme override. Falls back to the dark-theme shadow color.
BackButtonAnimation | null | undefined
Optional. Leave it out and the site uses "lift-scale". Hover motion. One of lift, scale, lift-scale, none.
string | null | undefined
Optional. Leave it out and the site uses "arrow-left". Any Font Awesome icon name, e.g. star, bolt, arrow-left-to-bracket (no “fa-” prefix). Browse at fontawesome.com/icons.
BackButtonIconFamily | null | undefined
Optional. Leave it out and the site uses "classic-regular". Icon family. One of classic-regular, duotone-regular, brands, jelly, jelly-duo, whiteboard.
BackButtonIconPosition | null | undefined
Optional. Leave it out and the site uses "before". Which side of the label the icon sits on (when an icon name is set). One of before, after.
boolean | null | undefined
Optional. Leave it out and the site uses false. The icon slides toward its side on hover (e.g. an arrow edges outward).
readonly PagePostFontOverridesItem[] | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Optional. Set part of every post in a different typeface. Leave empty to follow the site’s fonts (Site design → Typography). An individual post can replace this on its own Fonts tab. At most 4 items.
PostTextSize | null | undefined
Optional. Leave it out and the site uses "normal". Body text size. One of small, normal, large, xlarge.
PostTextWeight | null | undefined
Optional. Leave it out and the site uses "normal". Body text weight. One of normal, medium, semibold.
PostContentWidth | null | undefined
Optional. Leave it out and the site uses "normal". Reading measure — how wide the article column gets. Posts that contain section widgets open to Full width automatically so the widgets have room. One of narrow, normal, wide, xwide, full.
PostLineHeight | null | undefined
Optional. Leave it out and the site uses "normal". Line height. One of tight, normal, relaxed.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Links, the blockquote rule, and heading accents. Leave empty to use the site link color.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Optional light-theme override. Falls back to the dark-theme color, then the link color.
PostHeadingWeight | null | undefined
Optional. Leave it out and the site uses "bold". Heading weight. One of normal, medium, semibold, bold, extrabold.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Optional. Overrides in-article heading color. Leave empty to track the theme’s text color.
string | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. Optional light-theme override. Falls back to the dark-theme color, then the theme default.
PostCustomCSS | null | undefined
Optional. Leave it out (or pass null) and it isn’t sent: the site’s default applies. CSS for every blog post’s page: the title band, the article and its parts. It wins over Site design → Custom CSS → Blog post.
A Page. A page: the fields every page has, and each page type’s own (type says which page type it is; a field belongs only to the page types that define it). Read its properties (page.id): each says whether the site always sends it. The example answer is the site’s wire JSON: some keys differ from the property names (_id → id, _ancestors → ancestors, _children → children …).
string
Always sent. Unique document identifier, may include mode and locale (e.g., “id:en:published”)
string
Always sent. Base document ID without mode/locale qualifiers.
string
Always sent. Document locale code.
Date
Always sent. Page last update timestamp. Format: an ISO 8601 date and time.
string
Always sent. URL slug for the page.
string
Always sent. Full hierarchical path in the page tree.
number
Always sent. Depth level in the page tree (0 = root level)
FlatPageResponseResultsItemVisibility
Always sent. Page visibility setting. One of public, loginRequired, private; a newer site may send others, so keep a fallback.
string
Always sent. Page type module name.
string
Always sent. Page title. At most 100 characters.
AposMode | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Document mode (draft or published) One of draft, published; a newer site may send others, so keep a fallback.
boolean | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Whether the page is archived.
Date | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Page creation timestamp. Format: an ISO 8601 date and time.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Sortable version of the page title.
number | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Sort order within parent page.
boolean | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Whether page is orphaned (not in tree structure)
readonly string[] | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Array of parking lot configurations if page is parked.
MainArea
Sometimes sent: undefined when the site leaves it out. A MainArea. Widgets, top to bottom: send { "items": [ … ] }, one object per widget with its type. Writing it replaces the whole area.
readonly Page[] | null
Sometimes sent: undefined when the site leaves it out, and it can be null. A list of Page. The page’s ancestors, from the home page down (each without its own _ancestors and _children).
readonly Page[] | null
Sometimes sent: undefined when the site leaves it out, and it can be null. A list of Page. Its child pages, each with its own _children where the request asked for more levels. Its fields are listed under the first Page above.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Full URL to the page. Format: an absolute URL.
boolean | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Whether current user can edit this page.
boolean | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Whether current user can publish this page.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. The _id of the piece/page that was copied to create this document (only present if created via _copyingId)
Page
Sometimes sent: undefined when the site leaves it out. A Page. A page: the fields every page has, and each page type’s own (type says which page type it is; a field belongs only to the page types that define it). Its fields are listed under the first Page above.
Page
Sometimes sent: undefined when the site leaves it out. A Page. A page: the fields every page has, and each page type’s own (type says which page type it is; a field belongs only to the page types that define it). Its fields are listed under the first Page above.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. The draft’s preview share key, while its share link is on: the link is the draft’s _url with aposShareKey and aposShareId (the draft’s _id) in its query. Absent otherwise, and on published documents.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. An ISO 8601 date and time, e.g. 2026-10-21T14:30:00.000Z.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. An ISO 8601 date and time, e.g. 2026-10-21T14:30:00.000Z.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Overrides the document title in the browser tab and search results. Leave blank to use the regular title.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Shown in search results and link previews. Aim for 150–160 characters.
ImageArea
Sometimes sent: undefined when the site leaves it out. An ImageArea. Used for Open Graph / social link previews. Recommended 1200×630. Widgets, top to bottom: send { "items": [ … ] }, one object per widget with its type. Writing it replaces the whole area. Its fields are listed under the first ImageArea above.
readonly PagePageFontOverridesItem[] | null
Sometimes sent: undefined when the site leaves it out, and it can be null. A list of PagePageFontOverridesItem. Optional. Set part of this page in a different typeface. Leave empty to follow the site’s fonts (Site design → Typography). Individual sections can still override this for themselves. At most 4 items. Its fields are listed under the first PagePageFontOverridesItem above.
Sometimes sent: undefined when the site leaves it out, and it can be null. The ribbon of phrases scrolling across the top of the footer. Its phrases and the site-wide default are set in Site design → Footer: Marquee. One of inherit, on, off; a newer site may send others, so keep a fallback.
SectionsArea
Sometimes sent: undefined when the site leaves it out. A SectionsArea. Widgets, top to bottom: send { "items": [ … ] }, one object per widget with its type. Writing it replaces the whole area. A new document starts with page-header. Its fields are listed under the first SectionsArea above.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Any Font Awesome icon name, e.g. star, bolt, arrow-left-to-bracket (no “fa-” prefix). Browse at fontawesome.com/icons.
ComingSoonIconFamily | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Icon family. One of classic-regular, duotone-regular, brands, jelly, jelly-duo, whiteboard; a newer site may send others, so keep a fallback.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Optional — leave empty to use the design’s own color rhythm.
ComingSoonIconAnimation | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Icon animation. One of none, fa-beat, fa-bounce, fa-fade, fa-beat-fade, fa-flip, fa-shake, fa-spin; a newer site may send others, so keep a fallback.
ComingSoonIconSize | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Relative to the component’s base icon size. One of default, sm, lg, xl, 2xl, 2x, 3x, 4x, 5x; a newer site may send others, so keep a fallback.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Optional. Shown under the icon while this page has no content. Leave empty for a tasteful default line.
Sometimes sent: undefined when the site leaves it out, and it can be null. Optional. Color of the ”← back” link at the top of every post. Leave empty to use the site accent color.
Sometimes sent: undefined when the site leaves it out, and it can be null. Optional light-theme override. Falls back to the dark-theme color, then the accent.
Sometimes sent: undefined when the site leaves it out, and it can be null. Back link weight. One of normal, medium, semibold, bold, extrabold; a newer site may send others, so keep a fallback.
Sometimes sent: undefined when the site leaves it out, and it can be null. Back link size. One of small, normal, large, xlarge; a newer site may send others, so keep a fallback.
SectionsArea
Sometimes sent: undefined when the site leaves it out. A SectionsArea. Widgets, top to bottom: send { "items": [ … ] }, one object per widget with its type. Writing it replaces the whole area. A new document starts with page-header. Its fields are listed under the first SectionsArea above.
BlogListArea
Sometimes sent: undefined when the site leaves it out. A BlogListArea. Widgets, top to bottom: send { "items": [ … ] }, one object per widget with its type. Writing it replaces the whole area. A new document starts with blog-list. Its fields are listed under the first BlogListArea above.
SectionsArea
Sometimes sent: undefined when the site leaves it out. A SectionsArea. Widgets, top to bottom: send { "items": [ … ] }, one object per widget with its type. Writing it replaces the whole area. Its fields are listed under the first SectionsArea above.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. The visible button text. Leave empty to hide the button.
BackButtonVariant | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Solid fills with the color; Outline / Soft / Text link use it for the border + text. One of solid, outline, soft, link; a newer site may send others, so keep a fallback.
BackButtonSize | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Button size. One of small, normal, large; a newer site may send others, so keep a fallback.
BackButtonRadius | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Corner radius. One of pill, rounded, slight, square; a newer site may send others, so keep a fallback.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Solid fill, or the border + text for the other styles. Defaults to the brand accent; CLEAR it for a transparent, outline-only button.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Optional light-theme override. Falls back to the dark-theme color. (Brand tokens already flip per theme.)
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. The text/icon color. Clear it to derive from the button color (readable on solid fills).
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Optional light-theme override. Falls back to the dark-theme label color.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Optional. Drives the hover treatment. Leave empty to derive it from the button color.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Optional light-theme override. Falls back to the dark-theme hover color.
BackButtonStyle | null
Sometimes sent: undefined when the site leaves it out, and it can be null. The hover treatment: a soft shadow, a colored offset shadow, a glow, a fill sweep, or a thicker border. One of none, single, dual, glow, sweep, thicken; a newer site may send others, so keep a fallback.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Optional. The offset-shadow or glow color on hover. Leave empty to use the site secondary color.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Optional light-theme override. Falls back to the dark-theme shadow color.
BackButtonAnimation | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Hover motion. One of lift, scale, lift-scale, none; a newer site may send others, so keep a fallback.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Any Font Awesome icon name, e.g. star, bolt, arrow-left-to-bracket (no “fa-” prefix). Browse at fontawesome.com/icons.
BackButtonIconFamily | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Icon family. One of classic-regular, duotone-regular, brands, jelly, jelly-duo, whiteboard; a newer site may send others, so keep a fallback.
BackButtonIconPosition | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Which side of the label the icon sits on (when an icon name is set). One of before, after; a newer site may send others, so keep a fallback.
boolean | null
Sometimes sent: undefined when the site leaves it out, and it can be null. The icon slides toward its side on hover (e.g. an arrow edges outward).
readonly PagePostFontOverridesItem[] | null
Sometimes sent: undefined when the site leaves it out, and it can be null. A list of PagePostFontOverridesItem. Optional. Set part of every post in a different typeface. Leave empty to follow the site’s fonts (Site design → Typography). An individual post can replace this on its own Fonts tab. At most 4 items. Its fields are listed under the first PagePostFontOverridesItem above.
PostTextSize | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Body text size. One of small, normal, large, xlarge; a newer site may send others, so keep a fallback.
PostTextWeight | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Body text weight. One of normal, medium, semibold; a newer site may send others, so keep a fallback.
PostContentWidth | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Reading measure — how wide the article column gets. Posts that contain section widgets open to Full width automatically so the widgets have room. One of narrow, normal, wide, xwide, full; a newer site may send others, so keep a fallback.
PostLineHeight | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Line height. One of tight, normal, relaxed; a newer site may send others, so keep a fallback.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Links, the blockquote rule, and heading accents. Leave empty to use the site link color.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Optional light-theme override. Falls back to the dark-theme color, then the link color.
PostHeadingWeight | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Heading weight. One of normal, medium, semibold, bold, extrabold; a newer site may send others, so keep a fallback.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Optional. Overrides in-article heading color. Leave empty to track the theme’s text color.
string | null
Sometimes sent: undefined when the site leaves it out, and it can be null. Optional light-theme override. Falls back to the dark-theme color, then the theme default.
PostCustomCSS | null
Sometimes sent: undefined when the site leaves it out, and it can be null. A PostCustomCSS. CSS for every blog post’s page: the title band, the article and its parts. It wins over Site design → Custom CSS → Blog post. Its fields are listed under the first PostCustomCSS above.
Readonly<Record<string, unknown>>
Always there: {} when there are none. Any keys the site sent that aren’t listed above (such as one added after this SDK was built), by their wire names, as sent. Pass this model to a write and they are sent too.
Nothing to catch: the SDK retries what is safe, and throws the rest as the classes below. Your exception handler turns them into your app’s own answers, once for every call (see Map SDK errors to responses); catch only what you want to react to here.
400
The site refused what was sent: errors lists each field’s problem, siteMessage the first.Retried first: No. Read: errors (field → messages), siteMessage.
401
The API key is missing or refused (malformed, revoked, expired), or a signature its signing mode needs is missing or stale.Retried first: No. Read: siteMessage, errorName, data.
403
The key may not do this: a scope it lacks, or an address outside its allowlist. siteMessage names it.Retried first: No. Read: siteMessage, errorName, data.
404
Nothing matches, or the caller may not see it.Retried first: No. Read: siteMessage, errorName, data.
500
The site failed. Its logs say why.Retried first: No: a write may have landed. Read: siteMessage, errorName, data.
no answer
No answer: DNS, a refused connection, TLS, or the timeout (15 s per attempt by default).Retried first: Only when nothing reached the site (neverConnected()); never after a timeout, when it may have landed. Read: reason, neverConnected.
not sent
The client refused to send it (e.g. a path segment of ..); the site never saw it.Retried first: No. Read: reason (what to change).
any other
Any other status, or a success whose JSON doesn’t match this SDK version’s types (update the SDK).Retried first: No. Read: reason, status.
setup
sites.forSite('acme') named a slug config/attract.ts doesn’t list (with the keys in the database: no row in attract_api_keys).Retried first: No: nothing was sent. Read: message, slug.
setup
The site’s entry is wrong: a malformed baseUrl or key, a key filed under another slug, or no default site. node ace attract:check names the fix.Retried first: No: nothing was sent. Read: message (what to fix).

Behavior

  • Access: an API key with content:pages:write (or a master above it: content:pages:all, content:all, admin:all). In published mode (the default) it goes live too, so the key also needs content:pages:publish (or a master above it); send aposMode=draft (or a draft _id and no aposMode) to change only the draft. A signed-in person may call it as far as their own permissions allow; anyone else gets 403.
  • Rate limit: the key’s own writes-per-minute limit, set when the key is created (default 120); over it, 429 with Retry-After. The client waits and retries for you; you see RateLimited only if that runs out.
  • Retries: a write is sent again only after a 429 (refused before it acted) or when it never reached the site. After a timeout or a 5xx it may have landed: check before you send it again.
  • Timeout: 15 s per attempt by default; raise timeout (milliseconds) in config/attract.ts for longer.

Test it

It calls the controller above with the SDK faked: fakeAttract() puts the fake in the container for this one test, and it answers every call with a valid example, so nothing leaves your machine and no key is read. Save it as tests/unit/pages_update_page.spec.ts, then run your tests:
tests/unit/pages_update_page.spec.ts
Terminal
Answer with your own values: fake pages.updatePage with factories.Page({...}), the fields you give over a valid example.
tests/unit/pages_update_page_answers.spec.ts

List pages

site.pages().listPages()

Create a page

site.pages().createPage()

Archive pages

site.pages().archivePages()

Copy pages to another locale

site.pages().localizePages()

Publish pages

site.pages().publishPages()

Restore pages

site.pages().restorePages()

PATCH /@apostrophecms/page/{_id}

The endpoint this calls, in the API reference: the HTTP request and answer, and every rule the site checks.