A REST API that generates business documents from templates your team already owns — populated from JSON, XML, Excel, or a database — without hardcoding a template into your application layer.
The common alternative to an API is coding document logic directly into core systems: one code path per template, per format. It works until a template changes — then every dependent code path needs a matching update, and none of that logic is reusable across templates.
A document generation API separates the two concerns. Business users manage templates in their native editor (Word, Excel, PowerPoint); developers call one API to merge data into whichever template ID they need, in whatever output format the request specifies. The EDocGen API handles generation and distribution together, so a single call can produce a document and route it to email, e-sign, or storage.
"Document generation API" now covers a wide range of tools with different trade-offs. Output format is one of the sharpest lines: Adobe's Document Generation API produces PDF or Word (DOCX) only , and CraftMyPDF, PDFMonkey, and APITemplate.io produce PDF (and, for some, images) only — none generate native Excel or PowerPoint files from a data-driven template. EDocGen generates PDF, Word, Excel, and PowerPoint from the same API and the same template model, so a single integration covers document types that would otherwise need a separate tool.
For a broader side-by-side across more vendors, see our comparison of the top document generation providers. This page focuses specifically on how EDocGen's own API works and how to integrate it.
Beyond output format, three features come up repeatedly when comparing EDocGen to HTML/CSS-based PDF generation APIs, which typically render a single flat template per call:
Because EDocGen's generation logic is defined explicitly in the template (conditions, calculations, loops) rather than drafted freeform, it's a predictable, auditable step for an AI agent to call — the same input always produces the same output. An agent handling a support ticket, a sales workflow, or a compliance process can call /document/generate as a deterministic action rather than asking a language model to draft the document text itself. The API is also exposed through EDocGen's MCP server for agent frameworks that consume MCP tools directly.
Business users create and edit PDF, Word, Excel, and PPTX templates in their native editors — no separate designer tool, no developer dependency for routine template changes. Templates live in a central repository with role-based permissions. Developers then generate documents two ways:
Output formats include PDF, Word, Excel, PowerPoint, image, and plain text.
Templates support dynamic text, tables, content blocks, hyperlinks, and images, plus conditional statements, arithmetic calculations, and loops evaluated at generation time.
The API also supports multi-lingual templates (including RTL languages), arithmetic calculations, and if-else conditional logic — used for proposals, invoices, contracts, and similar generated documents.
|
Data |
|
|
Databases |
MySQL, MSSQL, Oracle, MongoDB |
|
CRM |
Salesforce, Dynamics 365 |
After generation, documents distribute through several channels:
|
E-sign providers |
DocuSign, SignNow, Signaturely |
|
Document management |
SharePoint |
|
Cloud storage |
S3, Azure Blob, OneDrive, Google Drive |
|
Email providers |
Amazon SES, SendGrid, Office 365, GSuite |
A template is your normal Word/Excel/PDF/PPTX file with tags marking where data goes. Tag names in the template must match the keys in the JSON you send. Below is a sample Word invoice template.
{Invoice_Number} , {Invoice_Date} , {Company_Name} , and {Sum} are simple text tags. {Logo} is image tag . {#IT} ... {/IT} is a loop tag — everything between the opening and closing tag repeats once per object in the IT array, which is how a variable-length line-item table gets generated from a fixed template.
After uploading that template and getting back a documentId , a call to /document/generate supplies the data as JSON markers , with keys matching the template's tag names exactly:
{
"documentId": "69039b5b360e2742f966102e",
"format": "pdf",
"outputFileName": "Invoice-SBU-2053501",
"markers": {
"Invoice_Number": "SBU-2053501",
"Invoice_Date": "31-07-2026",
"Company_Name": "Acme Corp",
"Sum": "10,000",
"IT": [
{ "Item_Description": "Product Fees: X", "Amount": "2,000" },
{ "Item_Description": "Product Fees: Y", "Amount": "8,000" }
]
}
}
EDocGen matches each key in markers to the corresponding tag in the template, repeats the IT block once per array entry, and renders the result in the requested format (here, PDF). The output is a fully formatted invoice with two line-item rows — the template itself never changes; only the JSON payload does, which is what makes the same template reusable across every invoice you generate.
The example above uses /document/generate , which takes JSON and produces one document per call — the right endpoint for on-demand generation triggered from your application. For batch runs, /document/generate/bulk uses the same template but a different transport: it's a multipart/form-data request, and the data comes from a file or a database rather than an inline JSON body. Two ways to supply the data:
Other fields handle the details of matching that data to your template:
headerMappings
maps a template tag to a differently-named column or key when they don't already match;
sheetIndex
and
headerIsIn
apply to Excel input;
filterName
/
filterValue
filter which rows generate a document; and
keyForFileName
names each output file after a tag's value.
documentId
,
format
,
outputFileName
, and the
x-access-token
header are required, same as the single-document call.
An Excel-driven example: upload a spreadsheet of vendor invoice rows, and get one generated PDF per row back:
curl -X POST "https://app.edocgen.com/api/v1/document/generate/bulk" \
-H "accept: application/json" \
-H "x-access-token: YOUR_ACCESS_TOKEN" \
-F "documentId=69039b5b360e2742f966102e" \
-F "format=pdf" \
-F "outputFileName=Invoice" \
-F "keyForFileName=Invoice_Number" \
-F "inputFile=@vendor_invoices.xlsx"
Or, generating directly from a database instead of a file:
curl -X POST "https://app.edocgen.com/api/v1/document/generate/bulk" \
-H "accept: application/json" \
-H "x-access-token: YOUR_ACCESS_TOKEN" \
-F "documentId=69039b5b360e2742f966102e" \
-F "format=pdf" \
-F "outputFileName=Invoice" \
-F "keyForFileName=Invoice_Number" \
-F "dbVendor=mysql" \
-F "dbUrl=jdbc:mysql://db.example.com:3306/billing" \
-F "dbPassword=YOUR_DB_PASSWORD" \
-F "dbQuery=SELECT * FROM invoices WHERE status = 'pending'" \
-F "dbLimit=100"
The 200 response acknowledges that bulk generation has started asynchronously. Generated documents are retrieved afterward the same way as single-document output, or delivered directly to email, e-sign, or storage. A hundred-row spreadsheet becomes a hundred documents in one call. See the bulk generation endpoint reference for the full parameter list.
Full reference is in the API documentation. Document generation requires just four API calls—including the initial, one-time template upload.
curl -X POST "https://app.edocgen.com/api/v1/document/generate" \
-H "accept: application/json" \
-H "x-access-token: YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"documentId": "69039b5b360e2742f966102e",
"format": "pdf",
"outputFileName": "Test Invoice",
"markers": {
"Invoice_Number": "SBU-2053501",
"Invoice_Date": "31-07-2022",
"Company_Name": "Company A",
"Sum": "10,000",
"IT": [
{ "Item_Description": "Product Fees: X", "Amount": "2,000" },
{ "Item_Description": "Product Fees: Y", "Amount": "8,000" }
]
}
}'
The REST API can be consumed as SaaS or deployed on-premise. Full working examples in JavaScript, Java, Python, PHP, Ruby, and C# are in the quick-start docs.
EDocGen is chosen most often for business-user template ownership (no separate designer tool), enterprise data-source breadth (databases and CRMs, not just JSON/HTML), and asynchronous bulk generation at volume.
Business users create and edit PDF, Word, Excel, and PowerPoint templates in their native editors, without a separate designer tool or a developer in the loop for routine template changes.
Nested tables, loops, images, QR codes, HTML content, arithmetic calculations, and if-else logic run directly inside the template. Output covers PDF, DOCX, XLSX, PPTX, and TXT, with multi-lingual and RTL support.
Data sources include JSON, XML, Excel, and databases (MySQL, MSSQL, Oracle, MongoDB), plus CRMs like Salesforce and Dynamics 365. Distribution is pre-built for email, e-sign providers (DocuSign, SignNow), and cloud storage/DMS (OneDrive, SharePoint, Google Drive).
Bulk requests are asynchronous and built for high-volume, enterprise-level throughput. Deployment is flexible — SaaS or on-premise — to fit specific security and performance requirements.
EDocGen supports SAML-based Single Sign-On, so an organization's entire team authenticates through its existing identity provider — Okta, Microsoft Entra ID, or any SAML 2.0 IdP — instead of maintaining separate EDocGen passwords. SSO is configured by registering the IdP's SAML metadata via the /api/v1/sso/connections endpoint; see the SSO setup guide for the full request format.
On infrastructure, EDocGen runs on Google Cloud with AES-256 encryption, ISO 27001 certification, and GDPR and HIPAA compliance, alongside role-based access control and full audit trails. Structured-data processing is deterministic (no LLM in the generation pipeline); AI is used only where a customer opts into unstructured Excel extraction. Deployment on Azure, AWS, GCP, or fully on-premises is available where a security policy requires it.
The API generates PDF, Microsoft Word (DOCX), PowerPoint (PPTX), and Excel (XLSX) files. You send a template and a data source, and the API merges the data into the template and returns the finished document. Because the same REST endpoints handle all four formats, you can reuse one integration for every document type instead of building a separate pipeline for each.
EDocGen provides official SDKs for Python, Java, PHP, C#, and Node.js. If your stack uses a different language, you can call the REST API directly over HTTPS with any standard HTTP client. The SDKs handle authentication, request formatting, and file handling, so you can generate documents with just a few lines of code.
EDocGen states that its service is HIPAA and GDPR compliant, which makes it suitable for handling protected health information and personal data. Your own compliance depends on how you configure and use the service. Review EDocGen's current compliance documentation, sign a Business Associate Agreement (BAA) if you handle PHI under HIPAA, and consult your legal or compliance team to confirm your obligations.
You can get a free API key by signing up on the EDocGen website. After registering, your key appears in your account dashboard. Include the key in the request header of each API call to authenticate. Keep it secret and never expose it in client-side code or public repositories. Store it in environment variables or a secrets manager instead.
Yes. EDocGen supports SAML-based SSO with identity providers such as Okta and Microsoft Entra ID, configured by registering your IdP's SAML metadata through the API. See the SSO documentation for setup steps.
Yes. You can generate password-protected PDF files with watermarks, and send the instructions for opening the file to the recipient by email along with the attachment.
Yes. You can create drafts and update them by populating data from multiple data sources until you generate the final output.