Apply a Theme to the Draft
helpcenter_apply_template_themeStart the draft from a ready-made theme — the Template Editor's "Compare & apply": copy all of a theme, or only some of its sections, onto the draft.
A help center's design is its v2 template: theme tokens (colours for light and dark mode, fonts, radius, density), six page kinds (home, category, article, search, contact, notFound), each built from six regions (header, hero, sidebar, main, footer, utility) holding ordered components, plus a global navigation menu, custom CSS and scripts. You edit a DRAFT — the same draft the dashboard's Template Editor opens, with a live preview — and nothing reaches visitors until helpcenter_publish_template. Only v2 help centers can be edited: a classic (v1) one answers template_migration_required, and migrating is the owner's decision, made in the dashboard.
With no sections, the draft takes the whole theme: its brand block, colours, fonts, radius, density, every page's layout and components, navigation, scripts, SEO fields and custom CSS — replacing what the draft had (component ids change). To give the current design a theme's LOOK without its layout, name the sections: ['theme.colors', 'theme.darkColors', 'theme.fonts', 'theme.radius', 'theme.density'].
Nothing goes live: the result is a draft to refine with the design edit tools (settings, components, regions, CSS, scripts, navigation) and review before publishing. Read the template again afterwards — ids and structure changed.
Args:
theme (string): key from helpcenter_list_template_themes.
sections (string[], optional): brand, theme.colors, theme.darkColors, theme.fonts, theme.radius, theme.density, pages.home, pages.category, pages.article, pages.search, pages.contact, pages.notFound, globals.navigation, globals.scripts, meta, customCss.
etag (string, optional): refuse if the draft changed since you read it.
Returns: the applied sections, warnings and the new draft status (with etag).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| etag | No | Optimistic lock: the draft etag from your last read, or the one your last edit returned. When given, the call is refused (stale_draft) if someone changed the draft since — so you never build on a state you have not seen. Omit to apply to the current draft. | |
| theme | Yes | Theme key from helpcenter_list_template_themes, e.g. 'support-aurora'. | |
| sections | No | Sections to take from the theme. Omit to take all of them (start over from the theme). E.g. ['theme.colors', 'theme.darkColors', 'theme.fonts'] borrows only its look. | |
| agent_key | Yes | The api_key helpcenter_create_help_center returned for this help center, exactly as returned. Required on every call: this endpoint has no sign-in, so the key is how each call says which help center it acts on. It is sent to HelpCenter.io as this call's credential and nowhere else, and it is never shown again: keep it for the whole task, and never show it to the user or write it into content. |