

DocGen API
by RoarAPI · base path /docgen-api
Create PDFs and images from HTML, Markdown, or reusable templates, merge and protect PDF files, fill PDF forms, add watermarks, and manage document templates through a single high-performance API.
Loading endpoints…Documentation
Document Generation API
Document Generation API is a comprehensive document automation platform that enables developers to create, render, customize, and manage professional documents entirely through REST APIs.
Whether you're generating invoices, contracts, reports, certificates, shipping labels, marketing materials, legal documents, or business forms, this API provides all the tools needed to automate document workflows.
The API supports rendering documents from HTML, Markdown, and reusable Jinja2 templates, producing high-quality PDF, PNG, and JPG outputs with configurable page layouts, margins, headers, footers, and page numbering. It also includes powerful PDF utilities such as merging multiple PDFs, filling interactive AcroForms, applying AES-256 password protection, and stamping watermarks across documents.
For teams building scalable document workflows, the API includes a complete template management system with versioning, preview capabilities, rendering, updates, and deletion, allowing developers to build once and generate unlimited documents using dynamic data.
Built with a stateless architecture and optimized for production environments, Document Generation API is ideal for SaaS platforms, enterprise applications, CRM systems, ERP software, HR systems, finance platforms, healthcare applications, legal technology, and automation workflows.
Features
Document Rendering
- Render HTML to PDF
- Render HTML to PNG
- Render HTML to JPG
- Render Markdown to PDF
- Render Markdown to PNG
- Render Markdown to JPG
- Custom page layouts
- Custom page margins
- Portrait and landscape orientation
- Headers and footers
- Page numbering
- Render individual document pages
Template Engine
- Create reusable templates
- Versioned templates
- Jinja2 template engine
- Render templates with JSON data
- Preview templates
- Update templates
- Delete templates
- List templates
- Retrieve template details
PDF Utilities
- Merge multiple PDF files
- Fill interactive PDF forms (AcroForms)
- Flatten filled forms
- Add text watermarks
- AES-256 PDF encryption
- Owner password protection
- User password protection
General
- REST API
- API Key authentication
- Stateless architecture
- High performance
- Production-ready
- Lightweight JSON requests
- Cloud-native
- Easy integration
Output Formats
| Format | Description |
|---|---|
| High-quality printable documents | |
| PNG | Raster image output |
| JPG | JPEG image output |
API Endpoints
System Information
Get Current Limits
GET
/meta/limits
Returns supported rendering engines, output formats, and service limitations.
HTML Rendering
Render HTML
POST
/render/html
Render HTML into PDF, PNG, or JPG.
Features
- HTML rendering
- Print-ready output
- Page size selection
- Margins
- Headers
- Footers
- Page numbers
- Orientation control
- Render specific pages
Markdown Rendering
Render Markdown
POST
/render/markdown
Convert Markdown into professionally formatted PDF or image documents.
Template Rendering
Render Template
POST
/render/template/{template_id}
Render a stored Jinja2 template using dynamic JSON data.
Template Preview
Preview Template
POST
/templates/{template_id}/preview
Render a template using sample data before production use.
Template Management
Create Template
POST
/templates
Store a reusable template.
List Templates
GET
/templates
Retrieve paginated template listings.
Get Template
GET
/templates/{template_id}
Retrieve template source, page configuration, and version history.
Update Template
PUT
/templates/{template_id}
Update template source or page settings.
Delete Template
DELETE
/templates/{template_id}
Remove a stored template.
PDF Form Filling
Fill PDF Form
POST
/pdf/forms/fill
Populate interactive PDF form fields from JSON data.
Optional form flattening converts fields into permanent, non-editable content.
Merge PDF Files
Merge PDFs
POST
/pdf/merge
Combine multiple PDF files into a single document.
Protect PDF
Encrypt PDF
POST
/pdf/protect
Encrypt PDF documents using AES-256 encryption.
Supports:
- Owner password
- User password
- Secure document distribution
Watermark PDF
Add Watermark
POST
/pdf/watermark
Apply a translucent text watermark across every page.
Configurable opacity and custom watermark text.
Rendering Options
The rendering endpoints support professional print configuration.
Page Size
Examples
- A4
- A3
- Letter
- Legal
- Custom sizes
Orientation
- Portrait
- Landscape
Margins
Configure:
- Top
- Right
- Bottom
- Left
Headers
Add custom text headers to every page.
Footers
Add custom text footers.
Page Numbers
Enable automatic page numbering.
Authentication
Every request requires an API Key.
Include the following header:
x-service-api-key: YOUR_API_KEY
Example Requests
Render HTML
POST /render/html
Render Markdown
POST /render/markdown
Render Template
POST /render/template/tpl_ab12cd34ef56
Merge PDFs
POST /pdf/merge
Fill Form
POST /pdf/forms/fill
Protect PDF
POST /pdf/protect
Watermark PDF
POST /pdf/watermark
Example Responses
HTML Render
{
"success": true,
"format": "pdf",
"download_url": "https://..."
}
Template Render
{
"template_id": "tpl_ab12cd34ef56",
"version": 3,
"format": "pdf",
"download_url": "https://..."
}
Merge
{
"merged": true,
"pages": 28,
"download_url": "https://..."
}
Form Fill
{
"filled": true,
"flattened": true,
"download_url": "https://..."
}
Protect
{
"encrypted": true,
"algorithm": "AES-256"
}
Common Use Cases
Perfect for:
- Invoice generation
- Contracts
- Reports
- Certificates
- Purchase orders
- Shipping labels
- Quotes
- Business proposals
- Financial statements
- Tax documents
- HR documents
- Employment agreements
- Healthcare forms
- Insurance documents
- Legal paperwork
- Marketing brochures
- Product catalogs
- Event tickets
- Boarding passes
- Membership cards
- Educational certificates
- CRM systems
- ERP software
- SaaS platforms
- Workflow automation
- No-code platforms
- Internal business tools
Performance
- High-performance rendering engine
- Low-latency document generation
- Stateless architecture
- Cloud-native deployment
- Horizontally scalable
- Production-ready
- Optimized for large workloads
- Reliable document processing
Best Practices
- Store reusable layouts as templates instead of sending HTML repeatedly.
- Use Markdown for simple reports and documentation.
- Use HTML when advanced layouts or CSS styling are required.
- Protect confidential PDFs with AES-256 encryption before distribution.
- Flatten completed PDF forms to prevent further editing.
- Apply watermarks to drafts, confidential documents, and internal reports.
- Preview templates before deploying them to production.
- Version templates to safely manage updates without affecting existing workflows.
SDK Compatibility
Compatible with every HTTP client and programming language, including:
- JavaScript
- TypeScript
- Python
- Go
- Java
- C#
- PHP
- Ruby
- Rust
- Swift
- Kotlin
- Dart
- Node.js
- cURL
Endpoints
14Every endpoint DocGen exposes, and what each one does.
- 1POST
/docgen-api/render/htmlRender HTML to PDF/PNG/JPG
Render an HTML document with full print control (size, margins, headers, page numbers).
- 2POST
/docgen-api/render/markdownRender Markdown to PDF/PNG/JPG
Render a Markdown document to a styled PDF (or image).
- 3POST
/docgen-api/render/template/{template_id}Render a stored template with data
Render a stored, versioned template by binding `data` — build once, render forever.
- 4POST
/docgen-api/templatesCreate a template
Store a reusable, versioned template (Jinja2 source + page options).
- 5GET
/docgen-api/templatesList templates
List stored templates (paginated).
- 6GET
/docgen-api/templates/{template_id}Get a template
Fetch a template with its current source, page options, and version history.
- 7PUT
/docgen-api/templates/{template_id}Add a new template version
Append a new immutable version — old versions stay renderable via `version`.
- 8DELETE
/docgen-api/templates/{template_id}Delete a template
Delete a template and all its versions.
- 9POST
/docgen-api/templates/{template_id}/previewPreview a template with sample data
Render a stored template with ad-hoc data — the same path `/render/template/{id}` uses.
- 10POST
/docgen-api/pdf/mergeMerge several PDFs into one
Concatenate the uploaded PDFs, in order, into a single document.
- 11POST
/docgen-api/pdf/watermarkStamp a text watermark on every page
Overlay a translucent diagonal watermark across each page.
- 12POST
/docgen-api/pdf/protectEncrypt a PDF with a password
Encrypt with AES-256 (owner and/or user password) — no Ghostscript involved.
- 13POST
/docgen-api/pdf/forms/fillFill AcroForm fields
Populate form fields from a JSON object; `flatten` makes the values read-only.
- 14GET
/docgen-api/meta/limitsCurrent limits, engines, and formats
Report the input caps plus the supported render engines and output formats.
Pricing
| Plan | Pricing | Rate limits | Quotas | Compare all 4 plans |
|---|---|---|---|---|
| Basic | Free | 5 requests / second | 100 requests / month | |
| Pro | $29/mo | 20 requests / second | 100000 requests / month | |
| Max | $99/mo | 50 requests / second | 1000000 requests / month | |
| Ultra | $299/mo | 100 requests / second | 10000000 requests / month |