Document Generation
What it does
Document Generation (slug doc-gen) fills your own Word templates (.docx, .dotx) with the rows of a data product and renders one Word file per row and template, plus a PDF where conversion is available. Every value names where it came from. It is for teams that send letters, notices and agreements from contract or customer records. The full walkthrough is in Generate documents.
doc-gen). A workspace owner adds it in Apps: choose Create an App, then Add a standard app, then Add on its tile (or POST /v1/apps with slug doc-gen). Until it is added, its /v1 routes answer 404 and its agent tools do not appear. A switched-off app still answers reads and settings, but calls that start work answer 409; switch it on from the card menu in Apps or with POST /v1/apps/{id}/enable.What you give it
- A Word template whose changing parts are content controls.
- A data product with the rows to write from, and optionally rules for derived values and your writer profile (name, initials, signature line).
What you get
- A field sheet per template with a suggested source and reason for every field, which you confirm.
- Drafts that show each value with its origin and the fields still missing, before anything is generated.
- Batches of Word and PDF files, downloadable one by one or as a ZIP.
Run it in the app
- Open Apps → Document Generation and upload a Word template.
- Choose a data product and let Talonic propose the field sheet. Review each reason and confirm.
- Pick rows, check the draft, and generate. Download the files or the ZIP.
Run it with the API
Main routes: POST /v1/doc-gen/templates (base64 Word file), POST /v1/doc-gen/templates/{id}/propose, GET /v1/doc-gen/templates/{id}/proposal, POST /v1/doc-gen/templates/{id}/confirm, POST /v1/doc-gen/drafts, POST /v1/doc-gen/jobs, GET /v1/doc-gen/jobs/{id}, GET /v1/doc-gen/jobs/{id}/documents/{doc}/file and GET /v1/doc-gen/jobs/{id}/zip.
curl -X POST "https://api.talonic.com/v1/doc-gen/jobs" \
-H "Authorization: Bearer $TALONIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"template_ids": ["'$TEMPLATE_ID'"], "data_product_id": "'$PRODUCT_ID'", "record_ids": ["'$RECORD_ID'"]}'
curl -o letter.pdf "https://api.talonic.com/v1/doc-gen/jobs/$JOB_ID/documents/$DOC_ID/file?kind=pdf" \
-H "Authorization: Bearer $TALONIC_API_KEY"const res = await fetch('https://api.talonic.com/v1/doc-gen/drafts', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.TALONIC_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
template_ids: [process.env.TEMPLATE_ID],
data_product_id: process.env.PRODUCT_ID,
record_ids: [process.env.RECORD_ID],
}),
});
console.log(await res.json()); // values with their origins, and missing fieldsFull reference: Document Generation API.
Run it with an agent
Tools: talonic_doc_gen_status, talonic_doc_gen_issues, talonic_doc_gen_templates, talonic_doc_gen_upload_template, talonic_doc_gen_update_template, talonic_doc_gen_delete_template, talonic_doc_gen_propose, talonic_doc_gen_confirm_fields, talonic_doc_gen_products, talonic_doc_gen_rules, talonic_doc_gen_profile, talonic_doc_gen_draft, talonic_doc_gen_generate, talonic_doc_gen_jobs, talonic_doc_gen_file and talonic_doc_gen_retry_pdf. Example ask: "Generate the renewal letter for the ten contracts that expire next quarter."
Limits and costs
The request body limit is 5 MB, so a Word file can be about 3.7 MB. A multi-template proposal call starts at most 10 proposals. With save_to_workspace: false, files are deleted 24 hours after generation. Work an app does for you draws on the same credit balance as the rest of the platform; no separate per-app price is published. See Billing, credits and usage and rate limits.
Errors
Status codes
| Parameter | Type | Description |
|---|---|---|
| 401 | auth | Missing or invalid API key. Send `Authorization: Bearer $TALONIC_API_KEY`. |
| 403 | auth | The key lacks the scope (`read` for reads, `write` for writes), or the person behind it is below member for a write. |
| 404 | not found | The workspace has not added the app (the message names slug `doc-gen`), or the id does not exist in this workspace. Add the app, then retry. |
| 409 | conflict | The app is switched off, so it starts no work. Switch it on in Apps or with `POST /v1/apps/{id}/enable`. |
| 410 | gone | The batch's files were deleted (generated with `save_to_workspace: false`). Generate again. |
| 413 | too large | The upload exceeds the 5 MB body limit. |
| 422 | validation | The file is not a readable Word document, or documents would leave fields empty. Fill them, or send `allow_missing: true`. |
Next
- Generate documents: the full guide.
- Contract Party Management: the right recipient.
- Deliver data.
Frequently asked questions
Who can read the generated documents?+
What if a field has no value for a row?+
allow_missing: true.