Skip to main content

Generate Document Single

GenerateGenerate Document Single

The Generate Document Single API generates one document from a template and data. You send the template (templateFileType, templateFileName, templateFileData Base64), documentDataType (text, JSON, XML), outputType (html, PDF, Word, Excel), documentDataText or documentDataFile, optional fileMetaData and metaDataJson, and async. The API returns the generated document (binary or polling URL). Use the tester below to try it; more details are in the sections that follow.

Try the Generate Document Single API

Quick reference

Endpoint: POST /api/v2/GenerateDocumentSingle · Required: api-key, templateFileType, templateFileName, templateFileData, documentDataType, outputType, documentDataText

Try it live

Use the form below to send your API key, template file (Base64), data type, output type, and data (JSON/XML text or file). The response is the generated document. No code required—fill the fields and click Send request.

Loading API Tester...

Overview, parameters, and use cases

What is Generate Document Single?

This endpoint generates a single document from a template (Word, HTML, or PDF) and data (JSON or XML). You provide the template file (Base64), templateFileType and templateFileName, documentDataType (text, JSON, XML), outputType (html, PDF, Word, Excel), and data via documentDataText or documentDataFile. The API merges the data into the template and returns the generated document. Use optional fileMetaData and metaDataJson for extra metadata.

Key features

  • Template types – Word, HTML, or PDF templates (Base64).
  • DatadocumentDataType: text, JSON, or XML; data in documentDataText or documentDataFile (Base64).
  • OutputoutputType: html, PDF, Word, or Excel.
  • Async – Use async for large templates or data.
Best for

Use when you need one document per call (invoices, letters, reports). For many documents from one template use Generate Documents Multiple.

Prerequisites

Before using this endpoint, make sure you have:

  • A valid PDF4me API key (Get your API Key)
  • A template file (Word, HTML, or PDF) in Base64 format
  • Data in JSON or XML format

Response Format

The API returns the generated document as binary data for synchronous processing (200 OK) or provides a polling URL for asynchronous processing (202 Accepted).

Get Help