Skip to content

Preview

The sections a channel would draw if its staged edits were published: draft content replaces published content, staged status and order are applied, sections that are off are left out, and footer_links stays last.

A headless storefront renders this to show a merchant their unpublished work. The storefront's own sections endpoint never returns staged content, which is why the preview lives on the admin side and needs an admin token.

Endpoint

MethodPathPurpose
GET/api/admin/appearance/themes/{code}/sections/previewPreview a theme with staged edits applied

Path parameters

ParameterDescription
codeTheme being previewed.

Query parameters

ParameterDescription
channelChannel being previewed. Falls back to the current channel.
localeLocale the content is read in. Must be one the channel runs; otherwise the app locale, then the channel's first locale.

Response fields

FieldTypeDescription
themeCodestringTheme that was previewed.
channelIdintegerChannel that was previewed.
localestringLocale the content was read in.
sectionsarraySections in the order they would be drawn.
sections[].idintegerSection ID.
sections[].namestringSection name.
sections[].typestringSection type.
sections[].sortOrderintegerPosition, staged value applied.
sections[].statusbooleanOn/off, staged value applied. Always true for returned sections.
sections[].hasDraftbooleanWhether this section is holding a staged edit.
sections[].optionsobject | nullContent for the locale, staged value applied.

Use cases

  • Render an unpublished storefront page — the array is ready to draw in order, with each section's content already resolved for the locale.
  • Show a merchant what publishing would change — compare hasDraft per section against the published List sections response.

Best practices

  • Sections staged off do not appear at all. The preview is what shoppers would see, so an off section is absent rather than present with status: false — do not use this endpoint to build the editor's list.
  • A section with no staged edits is returned with its published values, so the preview is complete even when only one section was touched.

Errors

StatusWhen
404Unknown theme code.

Permissions

Requires appearance.sections.

Released under the MIT License.