Set up a template and its bindings
Turn a document into a template with named inputs, and produce filled documents from it.
A template is a document whose changeable parts are named. Instead of copying last quarter’s contract and hunting for every place a name or a fee is buried, you mark those places once — and from then on, producing a document means supplying values, not re-editing wording.
Mark the changeable parts
In the template document, replace each changeable value with a data field and
give it a name. The name is the field’s identity everywhere: in the form
someone fills in, and as the api_key an integrator sends over the
Document API. Fields are typed — text,
number, date, yes/no — so a date cannot be handed a sentence.
A field can be required or optional. Required means a document cannot be produced without it; optional fields may carry a default, and an optional field left blank is simply omitted — an omitted optional list, for example, repeats zero times rather than failing.
Repeat and conditional content
Whole blocks can depend on the values. A repeating block produces one occurrence per item of a list value — line items, parties, annexes — and a conditional block appears only when its condition holds. Both live in the template’s wording, so the person supplying values never decides what the document says, only which of the prepared content applies.
Preview with a scenario
While you write, the template stays neutral: Edit and View show the authored structure — every field as a named placeholder, every condition and repeat as a readable boundary — without pretending to know values it does not have. To see the template as a reader will, save a scenario: a named, complete set of trial values, such as “Acme, three line items, no annex.”
A template PDF renders only from a scenario you explicitly choose — never from values the editor happens to remember — and each run is pinned to that scenario’s revision and to an exact template version, so a preview is reproducible rather than a snapshot of someone’s session. Keep one scenario per case worth checking — the minimal filing, the fully loaded contract — and they double as worked examples of what the template’s inputs mean. A template with no inputs needs none of this and previews directly.
Produce a document from it
Choose the template, use it, and fill in its fields. The values are checked against the template’s definition before anything is created: a missing required field, a malformed date, or a value of the wrong kind is reported by field, and nothing half-filled comes into existence. The result is a normal document — it goes through comments, approvals and generation like any other.
When a system produces the documents instead, the same definition drives the Document API: the template publishes a machine-readable input schema, and the API validates submitted values against it exactly as the form does.