Add Custom CSS
helpcenter_add_template_cssAdd a labelled block of custom CSS to the design, to restyle components, regions or the whole help center beyond what the settings offer.
It edits the help center's design DRAFT (its v2 template): the draft the dashboard's Template Editor opens, with a live preview. Nothing reaches visitors until helpcenter_publish_template — after editing, give the customer the Template Editor link from the result to review, and publish only when they ask. v2 help centers only (a classic one answers template_migration_required). Ids come from helpcenter_get_template.
The CSS is scoped to the help center automatically. Target one component with [data-hc-instance-id=""] and every component of a type with [data-hc-component-type="Hero"]; the guide's 'css' topic (helpcenter_get_template_guide) lists the other hooks. Use var(--hc-color-*) rather than literal colours so dark mode keeps working, and keep text at 4.5:1 contrast: on a primary-coloured band, set text and links to var(--hc-color-on-primary). Blocks apply in order and a later one wins, so override a theme's CSS with a block of your own rather than editing the theme's. @import and javascript: URLs are stripped. This is the guide's add_css operation.
Args:
css (string): the CSS.
label (string, optional): e.g. 'Cards · hover lift'.
enabled (boolean, optional): default true.
index (integer, optional): position among the blocks; omit to append.
id (string, optional): an id of your choosing.
etag (string, optional): from your last read or edit; refuses (stale_draft) if the draft changed since.
Returns: what each entry did (new ids), warnings worth relaying, and the draft status with its new etag.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Optional id of your choosing for the block. Omit and one is generated (and returned). | |
| css | Yes | The CSS. Scoped to the help center automatically; see the guide's 'css' topic. | |
| 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. | |
| index | No | 0-based position among the CSS blocks (they apply in order). Omit to append. | |
| label | No | A name for the block, e.g. 'Cards · hover lift'. | |
| enabled | No | false keeps the block without applying it. Default true. | |
| 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. |