API Reference
Generate PDF and HTML documents from Word templates via a simple REST API.
Try it live — Open Swagger UIAuthentication
All requests require an API token passed in the x-apitoken header. The token must belong to the same organisation as the template being accessed.
x-apitoken: your-api-token-uuid
You can generate API tokens from your TmplVision dashboard.
Endpoints
Generate a PDF document
Generates a PDF from a Word template with variable substitution. Send template data as a JSON string in the data field and optional images as image_<key> file uploads.
By default the generated PDF is returned as a file download. Set metadataOnly: true in the data payload to receive only the document metadata.
Request Body required
Content-Type: multipart/form-data
{
"templateId": "abc-123",
"variables": {
"name": "John Doe",
"date": "2026-01-15"
},
"metadataOnly": false
}
<key> matches a template placeholder name. Multiple image fields are supported (e.g. image_logo, image_signature). Max 10 MB per file.Responses
Returns the PDF file (application/pdf) or JSON metadata when metadataOnly is true.
{
"filename": "template_1738900200000.pdf",
"filesize": 145678,
"createdAt": "2026-02-07T10:30:00Z"
}
Invalid data, missing templateId, or template not active.
Monthly document generation quota exceeded.
Template access denied or API token expired.
Template does not exist.
Generate an HTML document
Generates an HTML document from a Word template with variable substitution. The Word docx is rendered with variables and then converted to HTML. Send template data as a JSON string in the data field and optional images as image_<key> file uploads.
By default the generated HTML is returned as a file download. Set metadataOnly: true in the data payload to receive only the document metadata. Images embedded in the template are included as base64-encoded inline images.
Supported Elements
Paragraphs, headings, lists, bold/italic/underline/strikethrough, basic tables, hyperlinks, and images.
Limitations
The HTML output produces semantic markup. The following Word features are not fully supported: complex page layouts (columns, page breaks, margins), headers/footers, precise font sizes/colors, and complex table formatting (e.g. merged cells). For pixel-perfect output use the PDF endpoint.
Request Body required
Content-Type: multipart/form-data
{
"templateId": "abc-123",
"variables": {
"name": "John Doe",
"date": "2026-01-15"
},
"metadataOnly": false
}
<key> matches a template placeholder name. Multiple image fields are supported (e.g. image_logo, image_signature). Max 10 MB per file.Responses
Returns the HTML file (text/html) or JSON metadata when metadataOnly is true.
{
"filename": "template_1738900200000.html",
"filesize": 24560,
"createdAt": "2026-02-07T10:30:00Z"
}
Invalid data, missing templateId, or template not active.
Monthly document generation quota exceeded.
Template access denied or API token expired.
Template does not exist.
List generated documents
Returns a list of all PDF documents previously generated for the given template.
Path Parameters
Responses
{
"documents": [
{
"filename": "template_1738900200000.pdf",
"filesize": 145678,
"createdAt": "2026-02-07T10:30:00Z"
},
{
"filename": "template_1738903500000.pdf",
"filesize": 156789,
"createdAt": "2026-02-07T11:45:00Z"
}
]
}
Missing templateId.
Access denied to template.
Template does not exist.
Download a generated document
Downloads a specific previously generated PDF document.
Path Parameters
Responses
Returns the PDF file as application/pdf.
Missing templateId or filename.
Access denied to template.
Template or file does not exist.
Schemas
DocumentMetadata
template_1738900200000.pdf1456782026-02-07T10:30:00Z