Documents Active

DOCX Template API

Generate professional Word documents from templates with dynamic placeholders. Perfect for contracts, letters, invoices, and any document that needs personalization at scale.

https://docx-tpl.localapi.ro
< 2s Response Time
1/sec Rate Limit
None Auth Required
Free Pricing

Quick Start

Request
curl -X POST "https://docx-tpl.localapi.ro/generate" \
  -F "template=@contract_template.docx" \
  -F 'data={"name": "John Doe", "date": "2025-01-16"}' \
  --output contract_filled.docx
Request
import requests
import json

with open("contract_template.docx", "rb") as template:
    response = requests.post(
        "https://docx-tpl.localapi.ro/generate",
        files={"template": template},
        data={"data": json.dumps({
            "name": "John Doe",
            "date": "2025-01-16"
        })}
    )

with open("contract_filled.docx", "wb") as f:
    f.write(response.content)
Request
const formData = new FormData();
formData.append("template", templateFile);
formData.append("data", JSON.stringify({
  name: "John Doe",
  date: "2025-01-16"
}));

const response = await fetch("https://docx-tpl.localapi.ro/generate", {
  method: "POST",
  body: formData
});

const blob = await response.blob();
// Download the generated document

Response

200 OK application/vnd.openxmlformats-officedocument.wordprocessingml.document
Binary DOCX content

Available Endpoints

POST /generate

Generate a document by filling template placeholders with data.

Parameters

Parameter Type Required Description
template file Yes DOCX template file with {{placeholders}}
data string (JSON) Yes JSON object with placeholder values
GET /health

Check service health and availability status.

Error Codes

Code Description
400 Invalid request - missing template or data
415 Unsupported media type - not a DOCX file
422 Processing error - invalid JSON or template
429 Rate limit exceeded
500 Internal server error