API Reference

Generate PDF and HTML documents from Word templates via a simple REST API.

Try it live — Open Swagger UI
OpenAPI 3.0 v1.0.0
https://us.api.tmplvision.io

Authentication

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.

Header
x-apitoken: your-api-token-uuid

You can generate API tokens from your TmplVision dashboard.

Endpoints

POST /v1/generation/pdf

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

data string required
JSON string containing generation parameters.
Example value
{
  "templateId": "abc-123",
  "variables": {
    "name": "John Doe",
    "date": "2026-01-15"
  },
  "metadataOnly": false
}
image_<key> file
Image upload where <key> matches a template placeholder name. Multiple image fields are supported (e.g. image_logo, image_signature). Max 10 MB per file.

Responses

201
Document generated successfully

Returns the PDF file (application/pdf) or JSON metadata when metadataOnly is true.

Metadata response example
{
  "filename": "template_1738900200000.pdf",
  "filesize": 145678,
  "createdAt": "2026-02-07T10:30:00Z"
}
400
Bad request

Invalid data, missing templateId, or template not active.

402
Payment required

Monthly document generation quota exceeded.

403
Forbidden

Template access denied or API token expired.

404
Not found

Template does not exist.

POST /v1/generation/html

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

data string required
JSON string containing generation parameters.
Example value
{
  "templateId": "abc-123",
  "variables": {
    "name": "John Doe",
    "date": "2026-01-15"
  },
  "metadataOnly": false
}
image_<key> file
Image upload where <key> matches a template placeholder name. Multiple image fields are supported (e.g. image_logo, image_signature). Max 10 MB per file.

Responses

201
Document generated successfully

Returns the HTML file (text/html) or JSON metadata when metadataOnly is true.

Metadata response example
{
  "filename": "template_1738900200000.html",
  "filesize": 24560,
  "createdAt": "2026-02-07T10:30:00Z"
}
400
Bad request

Invalid data, missing templateId, or template not active.

402
Payment required

Monthly document generation quota exceeded.

403
Forbidden

Template access denied or API token expired.

404
Not found

Template does not exist.

GET /v1/generation/document-list/{templateId}

List generated documents

Returns a list of all PDF documents previously generated for the given template.

Path Parameters

templateId string required
The template ID to list generated documents for.

Responses

200
List of generated documents
Response example
{
  "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"
    }
  ]
}
400
Bad request

Missing templateId.

403
Forbidden

Access denied to template.

404
Not found

Template does not exist.

GET /v1/generation/document/{templateId}/{filename}

Download a generated document

Downloads a specific previously generated PDF document.

Path Parameters

templateId string required
The template ID.
filename string required
The PDF filename to download.

Responses

200
PDF file download

Returns the PDF file as application/pdf.

400
Bad request

Missing templateId or filename.

403
Forbidden

Access denied to template.

404
Not found

Template or file does not exist.

Schemas

DocumentMetadata

filename string
The generated PDF filename. Example: template_1738900200000.pdf
filesize integer
File size in bytes. Example: 145678
createdAt date-time
ISO 8601 creation timestamp. Example: 2026-02-07T10:30:00Z