Update Revision Theme File
/v3/kb/themes/{themeId}/revisions/{revisionId}/files/{id}org.permission.kb.updateThe API key or user must hold at least one of them. Legacy roles still work; prefer the others for new keys.
Updates theme files based on the revision ID.
Knowledge base themes
A theme controls how a help center looks and is laid out, from colors and fonts to the code for each page. Themes keep a history of revisions, so you can edit and preview a draft before you publish it. Templates are the ready-made starting points that new themes are copied from.
Admins customize themes in the theme editor in the knowledge base settings. Each knowledge base displays the theme set in its theme field. A theme's active and default fields are left over from an older model, so ignore them. The public endpoint for the active theme returns the theme of the knowledge base that the request's host identifies.
A theme is customized at two levels. The manifest holds settings that admins change without code. It is grouped into sections such as design, header, footer, searchBar, announcement and featuredArticles, and each variable has a type such as color, select, slider, text, link, list, boolean or file. Theme files hold the code.
Theme files
type |
What it is | Examples |
|---|---|---|
page |
One help center page | homepage.jsx, article.jsx, categories.jsx, search.jsx, tag.jsx, contact.jsx, 404.jsx |
component |
A piece shared between pages | Nav.jsx, Footer.jsx, ArticleBreadcrumbs.jsx |
asset |
Stylesheets and scripts, used as written | styles.css, utils.js |
Pages and components are JSX. Kustomer compiles them when you save and returns the output in compiled. If the content doesn't compile, the save fails with 400. File names must be unique within a revision. Text in a theme can use snippets, so one theme serves every language. Kustomer collects the snippet keys in the manifest into configSnippets for you. List the keys your code uses in the theme's jsxSnippets and in each file's snippets, and make sure each key exists, because Kustomer rejects a file that lists an unknown key.
Drafts and revisions
A theme keeps a stack of revisions, and each revision has its own files. The newest revision is either the published one or a single draft on top of it. The theme's status is draft while a draft exists and published otherwise.
POST …/revisions/draftcreates the draft from thename,manifestandjsxSnippetsyou send, with a copy of the published revision's files. To copy an older revision's settings and files instead, send onlyduplicateRevisionId. If a draft already exists, it is replaced, and edits to its files are lost.- Edit the draft's
name,manifestandjsxSnippetswithPUT …/revisions/draft, and edit its files through the file endpoints using the draft's revision ID. - Preview the draft with the public endpoints by passing
status=draftor therevisionId. - Send
{ "publish": true }toPUT …/revisions/draftto publish, orDELETEthe draft to discard it.
Kustomer keeps the 30 most recent revisions. When a publish pushes out the oldest revision, its files are deleted.
Templates
Templates aren't page templates. Each template is a complete starter theme that Kustomer provides, such as "Midtown". It has a title, a description, preview images, a version and a default manifest. Templates are read-only. To start from one, create a theme with duplicateTemplateId, and the theme's templateVersionId records the template version it came from. To copy one of your own themes, use duplicateThemeId instead. You can't send both. A new knowledge base created without a theme gets one built from Midtown.
Which endpoint to use
| To | Call |
|---|---|
| List themes, or read one | GET /v3/kb/themes or GET /v3/kb/themes/{id} |
| Create a theme from a template or another theme | POST /v3/kb/themes |
| Load the live theme or a preview, without an API key | GET /p/v3/kb/themes/active, GET /p/v3/kb/themes/{id} or GET /p/v3/kb/themes/{id}/files |
| Browse revision history | GET …/revisions or GET …/revisions/{id} |
| Start, edit, publish or discard the draft | POST, PUT or DELETE /v3/kb/themes/{themeId}/revisions/draft |
| List or read a revision's files | GET …/revisions/{revisionId}/files or GET …/files/{id} |
| Add, change or remove a file | POST …/files, PUT …/files/{id} or DELETE …/files/{id} |
| List the starter templates, or read one | GET /v3/kb/templates or GET /v3/kb/templates/{id} |
The public theme endpoints return the published revision unless you ask for a draft or a specific revision. Reads need a knowledge base read role, and writes need org.admin.kb.write or the matching permission.
Path parameters
Theme ID
"6026aba3fcca5f03e5541cd5"Theme revision ID
"6026aba3fcca5f03e5541cd6"Theme file ID
"6026aba3fcca5f03e5541cd7"Request body
application/jsonrequired"page""component""asset"Responses
OK