Word Templates
Upload a .docx or .dotx as a template, list and read its field sheet, change metadata and field sources by key, and delete it through /v1/doc-gen/templates.
A template is a Word file kept exactly as uploaded, plus a field sheet derived from its content controls. POST /v1/doc-gen/templates stores the file and creates the sheet with every field unconfirmed and a suggested source. kind is letter unless the request or the file name says agreement; group is a free label for organizing templates; version defaults to a (MM-YYYY) date found in the file name; and pairId links a companion template that is generated together with this one when a request sets with_pair.
The list route returns templates in the order they were created, without their fields. Each entry carries field_count, unconfirmed and entered_per_document (fields with a case source) instead, so a client can find the templates that still need attention in one call. GET /v1/doc-gen/templates/{id} returns the full field sheet together with the state of the latest proposal, null when none ran. The q filter is a case-insensitive substring over the name, group and file name; group is an exact match.
PATCH changes metadata and fields by key, and fields it does not name stay as they are. A field accepts a new label, a new source, a confirmed flag and a reason. Unknown field keys, a source of no known shape and conditions that read themselves are refused with 422 and nothing is stored. With dry_run: true the response is the template as it would be after the change and nothing is written, which is the safe way to check a generated source before committing it.
/v1/doc-gen/templatesQuery parameters
Response fields (per entry)
/v1/doc-gen/templatesBody fields
Response: 201 Template with its field sheet (excerpt)
{
"id": "3b1f6a52-8c0e-4f0a-9d5e-2a7c1e4b9d10",
"index": 3,
"name": "contract-letter",
"file": "contract-letter.docx",
"group": "Letters",
"kind": "letter",
"pairId": null,
"version": "",
"fields": [
{
"key": "addressee",
"label": "Addressee",
"kind": "text",
"options": [],
"dateFormat": null,
"where": ["body"],
"zone": "address",
"group": "address",
"controls": ["1048211"],
"source": { "type": "product", "field": "counterparty_name" },
"confirmed": false,
"reason": "The product column holds the counterparty name."
}
],
"dataProductId": null,
"updatedAt": "2026-10-21T09:12:44.000Z",
"uploadedBy": "api:5d1c0e7a",
"generated": 0,
"lastUsedAt": null
}/v1/doc-gen/templates/{id}Field fields (each entry of fields[])
/v1/doc-gen/templates/{id}Body fields (all optional)
cURL: Re-source one field and confirm it (dry run)
curl -X PATCH "https://api.talonic.com/v1/doc-gen/templates/$TEMPLATE_ID" \
-H "Authorization: Bearer $TALONIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"fields": [
{
"key": "addressee",
"source": { "type": "reference", "column": "contact_name" },
"confirmed": true
}
],
"dry_run": true
}'/v1/doc-gen/templates/{id}.docx or .dotx) or cannot be read, and 502 when the template file could not be stored.