Site settings and menus
Read and change the settings that apply to the whole store, and publish them.
get_site
Read the store's site settings (theme, brand, menus, announcement, seo, strings, routes, locales, storeUrl), its locales and which widget packs are enabled. Draft by default. The connections section answers { credentialSet, fingerprint } (whether a Throttle key is set, and the first 8 hex characters of the SHA-256 of that key, null when none is set), never the key. The routes section is read-only for an agent: a person sets it in the Builder.
- Needs: Read access or above. Scopes: site:read.
- Kind: reads only.
- Answers: { source, settings, draftRev (or publishedVersion), hasUnpublishedChanges, locales, packs, catalogLinked }. settings is the draft by default or the published copy with source: "published". The Throttle publishable key under connections is never shown, only whether one is set. packs lists the component and data source ids per pack.
update_site_settings
Change one or more site sections (theme, brand, menus, announcement, seo, strings, locales, storeUrl) in the draft. Each section you send replaces the whole section. Design lives in theme: preset ('clean', 'editorial', 'bold'); customized (true so your palettes apply instead of the preset's); light and dark palettes (14 colour tokens each: colorPrimary, colorPrimaryForeground, colorBackground, colorSurface, colorForeground, colorMuted, colorMutedForeground, colorBorder, colorBorderControl, colorAccent, colorSale, colorSuccess, colorWarning, colorDanger); fonts.heading, fonts.body and fonts.mono, each one of: Instrument Serif, Playfair Display, Lora, Merriweather, Cormorant Garamond, EB Garamond, Libre Baskerville, Source Serif 4, Fraunces, DM Serif Display, Inter, Schibsted Grotesk, DM Sans, Manrope, Poppins, Montserrat, Work Sans, Rubik, Nunito Sans, Open Sans, Lato, Raleway, Outfit, Plus Jakarta Sans, Figtree, Karla, DM Mono, JetBrains Mono, IBM Plex Mono, Space Mono, Bebas Neue, Oswald, Archivo Black, Space Grotesk, Syne, system-sans, system-serif, system-mono; radius (0 to 32 px); spacingScale ('compact', 'comfortable', 'roomy'); colorScheme ('light', 'dark', 'auto'); customCss (checked by the CSS sanitizer and scoped to the store's pages). Per-section layout, spacing and backgrounds are node settings (update_node). A bad value saves nothing and answers the issues. Nothing goes live until the site is published with publish.
- Needs: Draft access or above. Scopes: site:write.
- Kind: writes.
- Answers: { draftRev, issues: [] }. The patch is merged into the settings draft; nothing is live until it is published.
publish_site_settings
Publish the site settings draft on its own (theme, brand, menus, header and footer, announcement, SEO, strings), so it goes live. baseRev (the site settings draftRev you checked) is required, so nothing you have not checked is published. Answers the published settings version; when the live settings already are this draft it publishes nothing and answers { version: <the live one>, skipped: true }. It changes only the site-level scopes (site, menus, header, footer), never a page; to publish a page with them, use publish with includeSite. The code on/off switch is not part of the settings and is never touched. Only available at the Publish or Full level; a Draft or Read credential does not see it.
- Needs: Publish access or above. Scopes: site:write, pages:publish.
Also requires: level:publish. A key made before access levels also needs Allow publishing.
- Kind: writes; changes the live store or throws work away, so a client may ask you first; changes what shoppers see.
- Answers: { version, warnings } for the published site settings.
list_site_settings_versions
List the published versions of the site settings, newest first: version, who published it (actor), when, and which one is live, with the current draftRev and liveVersion. Pass version to read one in full. The Throttle publishable key is never shown (connections answers { credentialSet, fingerprint }). Use it to find the version to bring back with restore_site_settings_version.
- Needs: Read access or above. Scopes: site:read.
- Kind: reads only.
- Answers: The published settings versions (number, who, when), or one version in full when you pass version.
restore_site_settings_version
Load a published site settings version into the draft, exactly as it was published. Nothing goes live: publish it afterwards with publish_site_settings, using the draftRev this answers. The draft you replace is kept as a change you can undo with undo_change (document 'site'). Refused with CONNECTIONS_PERSON_ONLY (PERMISSION_REQUIRED) if the version would put back a different Throttle publishable key or different page routes: only a person sets those. Only available at the Publish or Full level.
- Needs: Publish access or above. Scopes: site:write, pages:publish.
Also requires: level:publish. A key made before access levels also needs Allow publishing.
- Kind: writes.
- Answers: { draftRev, restoredVersion, note }. The settings draft now holds that version; publish it with publish_site_settings. undo_change with document "site" puts the previous draft back.
import_catalog_display
Copy the Product Catalog's display settings (cards, badges, product page, strings) into the Builder's site settings draft and the product template draft. Refused with SHOP_DISPLAY_DRAFT_EXISTS when a draft already holds display settings: ask the user, then repeat with confirmOverwrite: true. Needs the Product Catalog linked (CATALOG_NOT_LINKED otherwise) and a store on the new site settings (SETTINGS_V2_NOT_ENABLED otherwise: tell the user, do not retry). Answers { written, importedFrom, adjustments? }. Nothing goes live until it is published.
- Needs: Draft access or above. Scopes: site:write.
- Kind: writes.
- Answers: { written, importedFrom, adjustments? }: the Product Catalog display settings copied into the settings draft and the product template draft.
What you can use
The components, data sources and link targets available to a page.
list_widgets
List every enabled widget with its settings (key, control, default, allowed values), its data inputs, where it may be placed and a minimal example node. Read this before add_widget.
- Needs: Read access or above. Scopes: widgets:read.
- Kind: reads only.
- Answers: { commonSettings, widgets }: each component with its type, version, group, placement rules, every setting (key, control, allowed values, default), data inputs and a ready example node.
list_data_sources
List the enabled data sources (products, a collection, categories, reviews, ...) with their params and the fields a widget may read.
- Needs: Read access or above. Scopes: widgets:read.
- Kind: reads only.
- Answers: { dataSources }: each source with id, provider, title, description, params, result shape, fields and whether it is per shopper.
No inputs.
query_data_source
Run a data source with params and answer a few sample results, for example to find a collection handle or see what a product grid would show. A collection, category or product param takes the handle from list_link_targets or the catalog id; an unknown handle answers NOT_FOUND (404). Prices are { amount, currency, display }; print display.
- Needs: Read access or above. Scopes: widgets:read.
- Kind: reads only.
- Answers: The data the source answers for the params you gave, read with the linked catalog key (never shown).
list_link_targets
Search pages, collections, categories and products for a link. Each result has a target ({ kind, id }) ready to use in a link setting or a menu item. A page link is stored by the page id, so it follows the page when its slug or title changes. A page result has a state: 'published' (the store links to it) or 'draft' (the store shows the link as plain text until the page is published).
- Needs: Read access or above. Scopes: pages:read.
- Kind: reads only.
- Answers: { targets, note? }: pages (with state published or draft), collections, categories and products, each with kind, label, handle and a target to put in a link. Catalog entries need a linked catalog key; without one a note says they are left out.
list_components
List the one components library: built-in widgets, custom widgets (code, composite and template kinds) and, when the credential also has pages:read, saved sections. Each entry has ref ('widget:<type>' or 'section:<id>'), kind ('builtin', 'custom' or 'saved'), subtype, type, title, group, status, usage (how many pages, templates and parts use it), version and who changed it last. Filter with kind, group or q (a text search). Read-only.
- Needs: Read access or above. Scopes: widgets:read.
- Kind: reads only.
- Answers: { components }: one entry per component of the Components screen with ref (widget:<type> or section:<id>), kind (builtin, custom, saved), subtype, type, title, group, status, usage, version and who changed it last. Saved sections are included only with pages:read.
Pages and templates
List, read, create, rename and delete pages, header and footer, slots and templates.
list_pages
List the site's pages, header and footer parts and slots with their state: draft changes, the published version and whether a deletion is waiting to be published.
- Needs: Read access or above. Scopes: pages:read.
- Kind: reads only.
- Answers: { documents }: id, address, kind (page, part, slot, section, template), key, pageType, title, draftRev, published, publishedVersion, hasUnpublishedChanges, updatedAt. A page deleted in the draft shows deleted: true, deletionWaitingToPublish: true.
get_page
Read a document, draft or published, with its node ids and draftRev. A draft with older widgets is upgraded first, so the draftRev you get is the one to write against. Use outline: true for a compact tree.
- Needs: Read access or above. Scopes: pages:read.
- Kind: reads only.
- Answers: { address, kind, key, pageType, title, seo, source, draftRev (or publishedVersion), hasUnpublishedChanges, document } with document replaced by an outline when you pass outline: true. A template with no saved row yet is shown as its default with stored: false. An older draft is upgraded when opened and the answer carries upgraded.
create_page
Create a landing or content page (blank, or from a starting document) with a title and slug. It starts as a draft and is not live until published. A catalog param in a binding takes the id; a handle is turned into its id, and a handle the catalog does not have is refused.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { id, address, draftRev, issues: [] }. The page is a draft; publish it to make it live.
create_slot
Create an empty slot document (a named area around the catalog's pages, such as product.below) so it can be edited with 'slot:<name>'. A slot is never deleted, only emptied. It is a draft until published.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { id, address: "slot:<name>", draftRev, issues: [] }.
update_page_meta
Change a page's title, slug, type, own path or SEO in the draft. path sets the page's own address ('/about'), or null removes it; a path the store itself answers on (such as /cart) is refused with PATH_RESERVED. Pass document 'template:<name>' (such as 'template:product') to change a template's seo.titleTemplate, seo.description, seo.noindex and seo.frame ('site' or 'none': draw it without the site header and footer) instead (a template has no slug, type, title or path). Nothing goes live until it is published.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues: [] }. Title, slug, page type, path and SEO are saved together or not at all.
delete_page
Delete a page in the draft (never the home page). A page that was never published is gone at once; a live page stays live until its deletion is published: by a Full level key with the publish tool, or by the merchant in the Builder (a Draft or Publish key cannot publish a deletion). The answer lists inboundReferences: every page, part, menu or announcement that links to the page, and a warning saying those links stop linking. Check them first and re-point or remove the links.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes; changes the live store or throws work away, so a client may ask you first.
- Answers: { deleted: true, pendingPublish, draftRev?, inboundReferences, warning?, note? }. A page that was live stays live until its deletion is published (Full level, or the merchant in the Builder). inboundReferences lists what linked to it.
get_page_references
Which documents and site settings link to or embed a page (draft and published counts), so you know what a rename, deletion or unpublish would affect.
- Needs: Read access or above. Scopes: pages:read.
- Kind: reads only.
- Answers: { references }: the documents and site settings that link to or embed the page, with draft and published counts.
reset_template
Put a template's DRAFT back to the pack's default layout (name: 'product', 'cart', 'shop', ...). Only the draft changes: the store keeps showing the published template until it is published. The previous draft is kept as a change you can undo with undo_change. variant picks one of the layouts the pack ships for the template (refused when it has none by that name). A catalog template on a store without the Product Catalog is TEMPLATE_UNAVAILABLE. baseRev (the template's draftRev) is optional; leave it out to reset whatever the draft holds now.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues: [], note }. Only the draft returns to the default layout; undo_change puts the previous draft back.
Editing a page
Add, change, move and remove sections and components in a draft.
add_section
Insert a section with N columns (1 to 6) and widths at an index. Answers the new section and column ids. Section settings go in props, all optional: width (boxed or full), contentWidth (600 to 1600), gap, paddingX and paddingY (none, xs, s, m, l, xl or 2xl, or a number), minHeight, verticalAlign, background ({ color: "token:<name>" or "#rrggbb", image, mobileImage (a media id shown instead of image at phone width), priority (true when the background is the main image above the fold: it loads first), overlay }) and entrance. Tabs, accordions, carousels and show/hide blocks are section settings, not widgets or code widgets: set props.interaction to "tabs", "accordion", "carousel" or "toggle". For tabs, accordion and carousel the columns become the panels; for tabs and accordion each column's props.panelTitle, such as { "en": "Shipping" }, is its heading (set it with update_node on each column id this answers; a carousel uses it only as the slide label). For toggle the whole row hides behind one button (toggleLabelClosed and toggleLabelOpen). Each mode has more options (accordionOpenFirst, carouselAutoplay and so on): validate_page names what is allowed. A countdown is the basic.countdown widget (list_widgets).
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues, sectionId, columnIds }. nodeFields (frame, cssClass, showWhen) can be set on the new section.
set_columns
Change the column count and widths of a section, for desktop, or only the widths for tablet or phone.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues }. Narrower widths can move the children of removed columns into moveChildrenTo.
add_widget
Insert a widget into a column (or inner column) with its settings and data bindings. Answers the new widget id. Read list_widgets for the settings first. A catalog param in a binding takes the id; a handle is turned into its id, and a handle the catalog does not have is refused.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues, widgetId }. The component is added at its latest version. nodeFields (cssClass, showWhen) can be set on the new component.
add_inner_section
Insert an inner section (columns inside a column) into a top-level column. props takes the section settings of add_section, including interaction ("tabs", "accordion", "carousel" or "toggle"); set each column's panelTitle with update_node on the column ids it answers.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues, ... } with the new inner section and its column ids. nodeFields (cssClass, showWhen) can be set on it.
update_node
Set settings on a section, column or widget (setProps). A section takes width, contentWidth, gap, paddingX, paddingY, minHeight, verticalAlign, background (color, image, mobileImage for the phone, priority for the main image above the fold, overlay), entrance and interaction ("none", "tabs", "accordion", "carousel" or "toggle"; see add_section); a column takes width, panelTitle (the heading of a tab or accordion panel, such as { "en": "Care" }), padding, background and verticalAlign. The node's own fields go in nodeFields, not props: frame (sections only: { sticky: "none"|"top", collapse: { below: "tablet"|"phone"|null, belowPx, label } }), cssClass (up to 5 class names) and showWhen ({ audience: "all"|"signed-in"|"guest", cart: "any"|"empty"|"has-items" }, presentation only, not access control) on a section, inner section, column or widget (not a saved section reference). null clears one; an omitted field stays. With props and nodeFields together the settings are saved first, then the fields, as two history entries.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues }. The props are merged into the node. nodeFields sets the node's own fields: frame on a section (sticky: "none" or "top"; collapse with below tablet, phone or null, belowPx and label), cssClass (up to 5 class names) and showWhen (audience and cart, presentation only) on a section, inner section, column or widget; null clears one. Give props, nodeFields or both: with both, the settings are saved first and then the fields, as two history entries.
set_responsive
Set or clear tablet or phone overrides on a node.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues }. The values apply to one device only.
set_data_binding
Bind a widget input to a data source, or remove the binding. A catalog param (collection, product, category, parent, a manual products list) takes the id; a handle is turned into its id, and a handle the catalog does not have is refused.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues }.
move_node
Move a node to another parent or position.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues }.
duplicate_node
Copy a node (with everything in it) right after the original. Answers the copy id.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues, copyId }. The copy gets new ids all the way down.
remove_node
Remove a node and everything in it.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues }.
apply_ops
Apply a batch of document operations atomically, for bigger builds. If any operation is invalid nothing is saved and the answer lists the issues. A catalog param in a binding takes the id; a handle is turned into its id, and a handle the catalog does not have is refused.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues }. Up to 500 operations, all applied or none. A node in an insert may carry frame, cssClass and showWhen next to its props; setProps cannot set them (use update_node with nodeFields).
Checking and previewing
Validate a draft and get links to look at it.
validate_page
Check the draft: structural issues and publish warnings (a missing image, an empty link, a missing collection, a link to a page that was deleted or is not published: PAGE_LINK_DELETED, PAGE_LINK_UNPUBLISHED).
- Needs: Read access or above. Scopes: pages:read.
- Kind: reads only.
- Answers: { draftRev, valid, issues, warnings }. warnings include PAGE_LINK_DELETED, PAGE_LINK_UNPUBLISHED, missing images and missing collections.
get_preview_url
Get the links to check your work in your own browser tool: draftUrl (the draft, read-only, no sign-in, valid 12 hours, drawn at the window's own width so open it at 390, 768 and 1280), liveUrl (the published page on the store, or null), storePreviewUrl (the draft on the store itself, the only place code widgets run) and the widths.
- Needs: Read access or above. Scopes: pages:read.
- Kind: reads only.
- Answers: { draftUrl, liveUrl, storePreviewUrl, widths: [390, 768, 1280], expiresAt, note }. draftUrl is read-only, needs no sign-in and lasts 12 hours. storePreviewUrl is the draft on the store itself (the only place code components run), lasts 1 hour and is null until a store URL is set in site settings and published. liveUrl is null until published.
get_site_preview_token
Get a site-wide, read-only preview token for the whole store: send it as the X-Builder-Preview header on the /v1 read API (or as the throttle_builder_preview query parameter on your store, which turns it into a cookie) and every read answers the DRAFT, never cached. Unlike get_preview_url it needs no storeUrl and no publish. It lasts at most 1 hour (pass ttlSeconds for less; more is capped at 3600), unlocks reads only, and is refused by every write. Answers { token, expiresAt, header, cookieParam }. Needs Draft access or above; a Read credential does not see it.
- Needs: Draft access or above. Scopes: pages:read.
Also requires: draft.
- Kind: reads only.
- Answers: { token, expiresAt, header, cookieParam }. Send the token as the X-Builder-Preview header on the read API, or as the throttle_builder_preview query parameter on your store, and every read answers the draft. Lasts at most 1 hour; reads only.
Publishing, versions and undo
Make a draft live, and step back.
publish
Publish a document, and optionally the site settings, so it goes live. baseRev (the draftRev you checked) is required, so nothing you have not checked is published. Answers the published version. Check the work first: validate_page, then open the draftUrl from get_preview_url in your own browser tool at 390, 768 and 1280 px wide. Publish once the work is correct. Only available when the merchant gave this credential the Publish or Full level (an older key needs Allow publishing turned on); a Draft or Read credential does not see it.
- Needs: Publish access or above. Scopes: pages:publish.
Also requires: level:publish. A key made before access levels also needs Allow publishing.
- Kind: writes; changes the live store or throws work away, so a client may ask you first; changes what shoppers see.
- Answers: { version, warnings, deleted? }. The draft is now live (in build-time delivery it goes live at the next release).
discard_draft
Reset a draft to its published copy, dropping unpublished changes.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes; changes the live store or throws work away, so a client may ask you first.
- Answers: { draftRev, issues: [] }. The draft is back to the published copy.
list_versions
List a document's saved versions, or read one in full.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: reads only.
- Answers: The saved versions of a document (number, kind such as published or checkpoint, who, when), or one version in full when you pass version.
restore_version
Load a saved version into the draft. The current draft is checkpointed first; nothing is published.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues: [], restoredVersion, checkpointVersion }. Your current draft is saved first as a checkpoint version, so the restore can itself be reversed.
list_changes
List the newest draft changes of a document (or of the site settings with document 'site'), newest first: seq, who made it, a summary, when, and whether it was undone. undoable marks the one change undo_change would undo now. Needs site:read for 'site'. Edits to a draft (and discard_draft and page title, address and SEO changes) are listed; restoring a version, deleting a page and the upgrade on open are not (a restore keeps its own checkpoint, see list_versions), and undo cannot step back past them.
- Needs: Read access or above. Scopes: pages:read.
- Kind: reads only.
- Answers: { changes }, newest first: seq, who, a summary, when, and whether it was undone. undoable marks the one change undo_change would undo now.
undo_change
Undo one change, by its seq from list_changes (document 'site' for the site settings; needs site:write). Only the change marked undoable works: the newest that is neither an undo nor already undone. Call again to walk further back. Anything else is refused with DRAFT_CONFLICT, and so is an undo that would step back past something the journal did not record (a version restore, a page deletion, the upgrade done when a page with older widgets is opened). An undo is itself a change in the list but cannot be undone: make the edit again instead. Edits the draft only; nothing is published.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues: [], undoneSeq }.
Saved sections
Sections you build once and use on many pages.
create_saved_section
Save a section as a saved section: build it once, put it on many pages by reference (insert_saved_section), and edit it once to change every page that uses it. Give fromNodeId (a top-level section already in a document) or section (a section node). It starts as a draft and is never shown on a store until it is published (publish_saved_section, Full level). Answers its id; edit it with the node tools and document 'section:<id>'. A catalog param in a binding takes the id; a handle is turned into its id, and a handle the catalog does not have is refused.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { id, address: "section:<id>", draftRev, published: false, note }. It is a draft until published.
list_saved_sections
List the saved sections with their published version, whether the draft has changes not yet published and the pages, parts and slots that use each (usedBy). Read one with get_page and document 'section:<id>'.
- Needs: Read access or above. Scopes: pages:read.
- Kind: reads only.
- Answers: { savedSections }: id, title, published version, whether the draft has unpublished changes and usedBy (the pages, parts and slots that use it).
No inputs.
insert_saved_section
Put a saved section on a page, header, footer or slot by reference, at a section index. The document shows the saved section's published content; changing the saved section later changes every document that uses it. A page that uses a saved section cannot be published until the saved section is published (PUBLISH_BLOCKED, SAVED_SECTION_UNPUBLISHED).
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues, ... } with the id of the linked block.
detach_saved_section
Replace a saved-section reference in a document with an ordinary copy of the saved section's PUBLISHED content (new ids), so this document can differ from it. Other documents keep using the saved section. Answers the new section id.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes.
- Answers: { draftRev, issues, sectionId, detachedFrom }. The block becomes a copy that belongs to this page.
delete_saved_section
Permanently delete a saved section that no page, header, footer or slot uses (draft or published). Refused with SAVED_SECTION_IN_USE and the list of documents that use it (usedBy): detach or remove those first. Destructive and not undoable: ask the user first.
- Needs: Draft access or above. Scopes: pages:write.
- Kind: writes; changes the live store or throws work away, so a client may ask you first.
- Answers: { deleted: true }.
publish_saved_section
Publish a saved section, so every published page, header, footer and slot that uses it shows the new content. It changes many pages at once, so it needs the Full level. baseRev (the saved section's draftRev you checked) is required. Check the work first: validate_page, then open the draftUrl from get_preview_url in your own browser tool at 390, 768 and 1280 px wide.
- Needs: Full access or above. Scopes: pages:publish.
Also requires: level:full.
- Kind: writes; changes the live store or throws work away, so a client may ask you first; changes what shoppers see.
- Answers: Same as publish: { version, warnings }. Pages that use the section show the new version once they are published or revalidated.