Skip to content

Let business users edit content

Content fields are the parts of a template that a content editor may change in Studio without seeing its code: a logo, an accent colour, payment terms, a closing line. A developer marks them once. A content editor then fills them in a form, previews the document, and publishes it.

Open the template in Workspace → Editor and choose + → Add fields.json at the end of the tab bar under its source. List the fields there:

fields.json
[
{
"key": "accent",
"label": "Accent colour",
"type": "colour",
"group": "Brand"
},
{ "key": "logo", "label": "Logo", "type": "image", "group": "Brand" },
{
"key": "terms",
"label": "Payment terms",
"type": "richText",
"group": "Footer"
}
]
Property What it does
key Required. The name the template reads it by: a letter, then letters, digits or _, up to 64.
label Required. What the form shows.
type Required. One of the types below.
group Fields with the same group are shown together under it.
help A hint shown under the input.
multiline A text field that holds several lines.
maxLength The most characters a text or richText value holds.
options Required for choice, and only allowed there: the values it offers.
type Value Default limit
text Plain text, one line unless multiline 2,000 characters
richText Paragraphs, bold, italic, underline, links and bulleted or numbered lists, as HTML 20,000 characters
image An uploaded PNG, JPEG or SVG
colour A colour such as #1f4fd1
toggle On or off
choice One of options
number A number
date A date such as 2026-10-16

A template has up to 100 fields, and their values take up to 64 KB together. The Invoice example template comes with an accent colour, a logo and payment details already marked.

In a component template opened in the visual editor, nobody writes fields.json by hand. Select a block, and under Content editors in the block panel click Make editable:

  1. Pick what may change: the text of a text block or a totals cell, the text of a rich text block, an image, the text, background or border colour, or whether the block shows at all.
  2. Name the field, and for text choose the kind of value: text, a choice from a list, a number or a date. Or pick a field the template has already, so several blocks change together.
  3. Click Make editable. The field is added to fields.json with what the block showed as its value, and the block reads it from then on.

A text that shows data cannot be made editable, and neither can a table column, since a column shows one value per row. Make fixed writes the field’s current value back into the block and removes the field once no block uses it.

To change the values yourself, switch the editor’s header from Visual to Content: the pages lock as they do for a content editor. The code editor has the same switch once the template’s fields.json is saved, and for an HTML template, Content shows the fields as a form.

Make editable, with the text of a heading offered to content editors under a label

The values are in the data as $content:

template.html
<style>
h1 { color:{{$content.accent}}; }
</style>
{{#if $content.logo}}<img src="{{$content.logo}}" alt="" />{{/if}}
<h1>Invoice</h1>
{{#each items}}
<p style="border-color: {{@root.$content.accent}}">{{description}}</p>
{{/each}}
<footer>{{{$content.terms}}}</footer>
  • Write rich text with three braces, {{{$content.terms}}}, so its formatting renders. Whatever is typed or pasted, only paragraphs, line breaks, bold, italic, underline, links (http, https and mailto) and lists are kept.
  • Inside {{#each}} and other blocks, read the values as @root.$content.key.
  • In a component template, bind the path ["$content", "key"]. Show rich text with a richText component and "as": "html".
  • An image value is the uploaded image’s ID; use it as an src as above. In a component template, an image bound to a field shows its binding’s fallback while the field has no value, and no image once a content editor removes it.
  • A field without a value renders as empty.
  • The content.json tab holds the values. The Bindings tab and autocomplete list them.
  • Request data cannot set $content: a render or preview whose data has a $content key answers 400 BAD_REQUEST.

A component template reads them with bindings that start at the root of the data:

{
"type": "text",
"text": { "path": ["$content", "title"], "scope": "root", "fallback": "" },
"style": { "color": { "path": ["$content", "accent"], "scope": "root" } }
}

A cleared colour leaves the style unset, or uses the binding’s fallback. See styles from data. To use one colour field across the whole template, bind a theme colour to it.

Publish the template once yourself. A content editor can only publish a template that has been published before.

In Settings → Team, invite the person with the role Content editor, or select someone and Change role. A content editor sees only Editor in Studio, which opens the editor in content mode, and can:

  • change the values of content fields, preview the document with sample data, and publish it;
  • upload images for image fields;
  • read templates, render them, and read the workspace’s renders.

They cannot change a template’s code, its sample data or workspace files, and cannot see API keys, webhooks, the team or the audit log.

A content editor opens Editor, which lists the documents that have content fields, whether their changes are published, and when they last changed, and picks one. The editor opens in content mode, without the switch to the visual or code editor.

A component template opens on its pages. Only the parts made editable can be changed, each with a dashed outline; the rest of the document is fixed. Click a part to change it: text and formatted text are typed on the page, and every field also has its input beside the pages, including fields no block on them shows. The pages are drawn again with each change.

Other templates show their fields as a form. Click Update preview to see the document with the template’s sample data, or, for a template that fills an Excel workbook, Download spreadsheet.

Then:

  1. Click Save. Each save is kept as a revision; History shows the earlier versions and what each changed, and Use this version loads one back.
  2. Click Publish. Documents render with the new values from then on.

A content editor’s publish never ships a developer’s unfinished work. It is refused with 403 FORBIDDEN while the draft has changes other than content values that are not published yet; a developer publishes those first.

When two people change the same template, a save keeps what the other saved in the meantime, and never replaces it unseen. The page shows who else has the template open.

  • Two content editors: each save keeps the other’s values and changes only the fields this editor changed. If both changed the same field, the save stops and names who changed it: Load theirs or Save mine over theirs.
  • A content editor and a developer with the template open: the developer’s next save keeps the content editor’s values. If the developer changed content.json too, the save stops and offers to compare the two versions first.

A value left over from a field a developer removed is dropped at the next save.

Save content values with PUT /v1/templates/{id}/content and the template:content scope, plus template:read. It replaces the values on the latest draft and keeps everything else:

Terminal window
curl -X PUT "https://app.typefold.dev/v1/templates/$TEMPLATE_ID/content" \
-H "x-api-key: YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{"values":{"accent":"#1f4fd1","terms":"<p>Due in <strong>30 days</strong>.</p>"}}'
  • Values must fit their fields; a key no field declares, or a value of the wrong kind, answers 400 BAD_REQUEST. A template without content fields answers 400 too.
  • Send "expectedRevision" to refuse the change with 409 CONFLICT if the draft has changed since you read it.
  • GET /v1/templates?content=true lists the templates that have content fields. Each template carries publishedRevision, the draft revision its live version was published from.
  • Publishing with template:publish but without template:write follows the rule above.
  • Uploading an image for an image field needs template:content or asset:manage.

Each save is recorded in the audit log as template.content_updated, with the fields it changed. A workspace export carries fields.json and content.json, and importing it replaces the values in the target environment.

A content set is a named set of values for a template’s content fields, such as one per customer or brand. One template then renders with each customer’s logo, colours and wording: a render names the set with contentSet, and without it the template’s own values are used.

  • A field the set has no value for keeps the template’s own value. So does a value that no longer fits its field, such as after a developer changed the field’s type, and an image that was deleted.
  • A saved set applies to renders at once; it is not published like the template.
  • Set names are unique within a template, up to 80 characters. Each set holds up to 64 KB of values, as the template’s own do.
  • How many sets a template may have depends on the plan: 3 on Free, 25 on Starter, 100 on Pro and 500 on Business. See limits.

In the editor’s content mode, the Content set menu beside History picks what you edit: Template content, or one of the template’s sets. Save your changes before you switch. Its last option, New content set…, starts a set as a copy of the content shown. While a set is chosen, the pencil and bin beside the menu rename and delete it. Renders that name a set by its old name, or name a deleted set, fail. While a set is chosen:

  • Save stores the set’s values, and renders that name the set use them from then on. There is no Publish for a set.
  • The pages, or Update preview, show the document with the set’s values, filled in with the template’s own values for any field the set has none for.
  • History lists the set’s last 20 saves; Use this version loads one back into the form.

Add contentSet to a Reports API request:

Terminal window
curl "https://app.typefold.dev/v1/reports/render" \
-H "x-api-key: YOUR_API_KEY" \
-H "content-type: application/json" \
--fail-with-body -o invoice.pdf \
-d '{
"format": "pdf",
"template": { "name": "Invoice" },
"contentSet": "Acme",
"data": { "invoice": { "number": "INV-2041" } }
}'

A Renders API request for a template or a template version, and each item of a batch, takes contentSet the same way: ContentSet on the .NET client’s TemplateRenderRequest and TemplateVersionRenderRequest, contentSet in TypeScript and JavaScript, and content_set in Python. A name the template has no set for answers 404 NOT_FOUND.

Request Does
GET /v1/templates/{id}/content-sets Lists the template’s sets.
POST /v1/templates/{id}/content-sets Creates a set from name and values.
GET /v1/templates/{id}/content-sets/{setId} Reads a set with its values.
PATCH /v1/templates/{id}/content-sets/{setId} Renames a set, saves new values, or both.
DELETE /v1/templates/{id}/content-sets/{setId} Deletes a set and its history.
GET /v1/templates/{id}/content-sets/{setId}/revisions Lists the set’s last 20 saves, newest first.

Reading needs template:read; the rest needs template:content too. Create a set:

Terminal window
curl -X POST "https://app.typefold.dev/v1/templates/$TEMPLATE_ID/content-sets" \
-H "x-api-key: YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{"name":"Acme","values":{"accent":"#c2410c","terms":"<p>Due in 14 days.</p>"}}'
  • Values are checked against the content fields of the template’s latest draft, as PUT /v1/templates/{id}/content checks them. An image value must be an uploaded image.
  • New values replace the set’s values and count as its next revision. Send "expectedRevision" to refuse the change with 409 CONFLICT if the set was saved since.
  • To restore an earlier save, send its values again.
  • A name the template already has answers 409 CONFLICT. A set past the plan’s allowance answers 402 QUOTA_EXCEEDED.

Changes are recorded in the audit log as template.content_set_created, template.content_set_updated and template.content_set_deleted. A workspace export carries each template’s sets in content-sets.json. Importing it creates the sets the target template lacks and saves the others as their next revision when their values differ; sets the export does not name are kept.

To let your own customers edit their set inside your app, embed the content editor.