Generate Documents Multiple
Generate → Generate Documents Multiple
The Generate Documents Multiple API generates multiple documents from one template and multiple data items. You send the template (templateFileType, templateFileName, templateFileData Base64), documentDataType (Json or XML), outputType (Docx, PDF, Word, Excel, HTML), documentDataText or documentDataFile, optional fileMetaData and metaDataJson, and async. The API returns JSON with an outputDocuments array (or a polling URL when async). Use the tester below to try it; more details are in the sections that follow.
Try the Generate Documents Multiple API
:::note Quick reference
Endpoint: POST /api/v2/GenerateDocumentMultiple · Required: api-key, templateFileType, templateFileName, templateFileData, documentDataType, outputType, documentDataText
:::
:::info 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 JSON with generated documents. No code required—fill the fields and click Send request. :::
Overview, parameters, and use cases
- Overview
- Parameters
- Use cases
What is Generate Documents Multiple?
This endpoint generates multiple documents from one template and multiple data records (JSON or XML). You provide the template (Word, HTML, or PDF as Base64), documentDataType (Json or XML), outputType (Docx, PDF, Word, Excel, HTML), and data via documentDataText or documentDataFile. The API produces one document per data record and returns them in the outputDocuments array (or a polling URL when async).
Key features
- One template, many documents – Same template merged with each data record.
- Template types – Docx, Word, HTML, or PDF (Base64).
- Data – documentDataType: Json or XML; data in documentDataText or documentDataFile.
- Output – outputType: Docx, PDF, Word, Excel, or HTML.
- Async – Use async for large batches.
:::tip Best for Use when you need many documents from one template (batch letters, certificates, labels). For a single document per call use Generate Document Single. :::
API parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| api-key | string | Yes | Your PDF4me API key, Base64 encoded. Get it from the dashboard. |
| templateFileType | string | Yes | Docx, Word, HTML, or PDF. |
| templateFileName | string | Yes | Template file name with extension (e.g. sample.docx). |
| templateFileData | base64 | Yes | Template file content (Base64). |
| documentDataType | string | Yes | Json or XML. |
| outputType | string | Yes | Docx, PDF, Word, Excel, or HTML. |
| documentDataText | string | Yes | JSON/XML data as text (if documentDataFile not provided). |
| documentDataFile | base64 | No | Data file (Base64), alternative to documentDataText. |
| fileMetaData, metaDataJson | string | No | Additional metadata. |
| async | boolean | No | Enable asynchronous processing. |
When to use Generate Documents Multiple
- Batch letters and certificates – Generate many documents from one template with different data (letters, certificates, labels).
- Bulk reports – Produce multiple reports in one request.
- Mass mailings – Merge one template with a list of recipients or data rows.
:::info Need the full API? For request/response schemas and code samples, see Generate Documents Multiple in the PDF4me API docs. :::
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 JSON with outputDocuments array containing the generated documents for synchronous processing (200 OK) or provides a polling URL for asynchronous processing (202 Accepted).