Save a template as a draft
save_templateSaves template changes as a draft version, so renders keep the published version until a person publishes it; also creates new templates as drafts and returns a review URL.
Instructions
Saves a template as a draft, never published: renders keep using the published version until a person publishes the draft in Formfeed. With template and base_checksum it saves a new version of that template: read it with get_template_source first, change what the user asked for, and pass only the parts you changed (the others are kept from the version you read). With new_template and html it creates a template whose version 1 is the draft. change_note says what changed; the person reads it before publishing. Returns the saved version, the check of the draft with its sample data (fix every error and save again) and review_url, the page where the person reviews and publishes it: hand that to the user. Needs an API key with template:write, or, for a signed-in agent, the person's permission under Account → Connected agents in Formfeed. Word and PowerPoint templates cannot be saved here. Free; a new template counts towards the plan's template limit.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| css | No | The stylesheet; up to 1 MB | |
| head | No | Extra markup for <head>, such as font links | |
| html | No | The body markup in the template language, without <html>, <head> or <body>; up to 2 MB | |
| i18n | No | Translations: locale → key → text, read by the t helper | |
| partials | No | Partials the template includes (name → source) | |
| settings | No | Paper, margins, header, footer, fonts and the other settings, as get_template_source returns them; replaces the stored settings as a whole | |
| template | No | Slug or tpl_ id of the template to save a new draft of; pass this or new_template | |
| data_sets | No | Named sample data sets besides sample_data (name → data) | |
| change_note | Yes | What the draft changes, in one sentence, shown in the version history | |
| data_schema | No | JSON Schema of data; null removes the stored one | |
| sample_data | No | The data the editor previews with and the draft is checked with; never used by a render | |
| new_template | No | Creates a template whose version 1 is this draft; pass this and html, or template | |
| base_checksum | No | With template: the checksum get_template_source returned. When someone saved a newer version since, nothing is saved: read the source again and redo the change on it |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | false when the check of the draft found an error; null when the check could not run | |
| next | Yes | ||
| version | Yes | ||
| template | Yes | ||
| review_url | No | The page in Formfeed where the person reviews and publishes the draft | |
| diagnostics | Yes |