Templates
Use a built-in template for common document types, fork one from the catalog to customize it, or build your own from scratch.
Built-in Templates
Templates can be used in two modes:
- Data mode — pass
template+data. The template supplies the document structure; your data fills the variables. Nomarkdownneeded. - Styling mode — pass
template+markdown. Your markdown content is rendered into the template's styled layout.
Data mode is recommended when you want consistent, predictable output. Required fields are validated server-side — missing any returns a missing_fields error listing exactly which fields are absent.
| Template | Description |
|---|---|
invoice | Professional invoice with line items, totals, sender/recipient blocks, and logo |
receipt | Payment receipt with merchant, items, totals, and payment method |
resume | Clean typographic layout for CVs and resumes |
ai-summary | Dark report header, executive summary callout, key findings, and sections |
report | Business report with executive summary and structured sections |
letter | Formal business letter with sender, recipient, subject, and signature |
proposal | Project or sales proposal with structured sections and logo |
post | WordPress-style blog post with title, author, date, featured image, and Markdown body |
woo-invoice | WooCommerce order invoice with shop details, billing address, line items, and payment info |
Image fields (logo) accept either a public URL or a raw base64-encoded PNG/JPEG string. Base64 values are automatically prefixed with the appropriate data URI.
invoice
Professional invoice with a dark header bar, two-column sender/recipient block, styled line-item table, right-aligned totals, and an optional footer note.
| Field | Type | Description | |
|---|---|---|---|
name | required | string | Client or recipient name |
date | required | string | Invoice date |
total | required | number | Total amount due |
items | required | array | Line items: description, qty, unit_price, amount |
from | optional | string | Sender company name |
from_street | optional | string | Sender street address |
from_city | optional | string | Sender city, state, and zip |
from_email | optional | string | Sender email address |
due_date | optional | string | Payment due date |
invoice_number | optional | string | Invoice reference number |
title | optional | string | Document title (default: Invoice) |
subtotal | optional | number | Subtotal before tax |
tax | optional | number | Tax amount |
notes | optional | string | Footer note or payment instructions |
logo | optional | image | Sender logo — URL or base64 PNG/JPEG |
curl -X POST https://www.docrenders.com/render \
-H "Authorization: Bearer dcr_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "invoice",
"data": {
"from": "Acme Studio",
"from_street": "123 Main St",
"from_city": "San Francisco, CA 94105",
"from_email": "billing@acme.com",
"name": "TechCorp Inc.",
"date": "2026-06-03",
"due_date": "2026-06-17",
"invoice_number": "INV-0089",
"items": [
{ "description": "Design", "qty": 1, "unit_price": 4000, "amount": 4000 },
{ "description": "Development", "qty": 20, "unit_price": 150, "amount": 3000 }
],
"subtotal": 7000,
"tax": 577.50,
"total": 7577.50,
"notes": "Payment due within 14 days. Reference INV-0089 on transfer."
}
}' --output invoice.pdf
receipt
Clean payment receipt with merchant name, transaction metadata, line items, totals, and optional payment method.
| Field | Type | Description | |
|---|---|---|---|
merchant | required | string | Merchant or business name |
date | required | string | Transaction date |
total | required | number | Total charged |
items | required | array | Line items: description, amount |
transaction_id | optional | string | Transaction or order ID |
subtotal | optional | number | Subtotal before tax |
tax | optional | number | Tax amount |
payment_method | optional | string | e.g. Cash or VISA XXXXXX4242 |
notes | optional | string | Footer note or return policy |
logo | optional | image | Merchant logo — URL or base64 PNG/JPEG |
resume
Clean typographic CV layout with sections for experience, education, and skills.
| Field | Type | Description | |
|---|---|---|---|
name | required | string | Full name |
email | required | string | Email address |
phone | optional | string | Phone number |
location | optional | string | City, State or remote |
linkedin | optional | string | LinkedIn URL or handle |
github | optional | string | GitHub URL or handle |
summary | optional | string | Professional summary paragraph |
experience | optional | array | Work history: company, role, dates, bullets (array of strings) |
education | optional | array | Education: school, degree, year |
skills | optional | string | Skills summary — free text or comma-separated |
ai-summary
Dark header report layout with an executive summary callout block, key findings list, and freeform sections. Designed for AI-generated analysis outputs.
| Field | Type | Description | |
|---|---|---|---|
title | required | string | Report title |
date | required | string | Report date |
summary | required | string | Executive summary text |
model | optional | string | AI model name shown in header metadata |
author | optional | string | Author or team name |
key_points | optional | array | Key findings — array of strings |
sections | optional | array | Additional sections: heading, content |
report
General business report with optional logo, executive summary, and structured sections.
| Field | Type | Description | |
|---|---|---|---|
title | required | string | Report title |
author | required | string | Author name or team |
date | required | string | Report date |
sections | required | array | Report sections: heading, content |
executive_summary | optional | string | Executive summary paragraph shown before sections |
logo | optional | image | Organization logo — URL or base64 PNG/JPEG |
letter
Formal business letter with sender address, recipient, subject line, body, and closing signature.
| Field | Type | Description | |
|---|---|---|---|
sender_name | required | string | Sender full name |
recipient_name | required | string | Recipient full name or organization |
date | required | string | Letter date |
body | required | string | Letter body — Markdown supported |
signature_name | required | string | Signature name |
sender_address | optional | string | Sender address block |
recipient_address | optional | string | Recipient address block |
subject | optional | string | Re: subject line |
salutation | optional | string | Opening salutation word (default: Dear) |
closing | optional | string | Closing phrase (default: Sincerely) |
proposal
Project or sales proposal with client and preparer details, structured sections, and optional logo.
| Field | Type | Description | |
|---|---|---|---|
title | required | string | Proposal title |
client | required | string | Client name or organization |
date | required | string | Proposal date |
prepared_by | required | string | Your name or company |
sections | required | array | Proposal sections: heading, content |
logo | optional | image | Your logo — URL or base64 PNG/JPEG |
post
WordPress-style blog post layout with a featured image, byline, category and tag metadata, and a full Markdown body. Used by the DocRenders WordPress plugin to render posts and pages as PDFs.
| Field | Type | Description | |
|---|---|---|---|
title | required | string | Post title |
author | required | string | Author display name |
date | required | string | Publication date |
content | required | string | Post body — Markdown (GFM) supported |
category | optional | string | Primary category label shown in the header |
tags | optional | array | Tag strings displayed below the byline |
featured_image | optional | image | Featured image — public URL or base64 PNG/JPEG |
curl -X POST https://www.docrenders.com/render \
-H "Authorization: Bearer dcr_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "post",
"data": {
"title": "Getting Started with Headless WordPress",
"author": "Jordan Whistler",
"date": "June 6, 2026",
"category": "Development",
"tags": ["WordPress", "Headless", "API"],
"content": "## Introduction\n\nHeadless WordPress separates the CMS from the frontend..."
}
}' --output post.pdf
woo-invoice
WooCommerce order invoice with shop branding, billing address, a line-item table, tax and totals, and payment details. Used by the DocRenders WordPress plugin to generate downloadable invoices for WooCommerce orders.
Note: Both order_number and invoice_number are required — WooCommerce order IDs and invoice reference numbers are treated as distinct fields.
| Field | Type | Description | |
|---|---|---|---|
order_number | required | string | WooCommerce order number (e.g. 10482) |
invoice_number | required | string | Invoice reference (e.g. WC-10482) |
invoice_date | required | string | Invoice date |
shop_name | required | string | WooCommerce store name |
billing_name | required | string | Customer billing name |
due_date | optional | string | Payment due date |
shop_email | optional | string | Store contact email |
shop_address | optional | string | Store address |
billing_email | optional | string | Customer email |
billing_address | optional | string | Customer billing address |
items | required | array | Line items: name, qty, unit_price, total |
subtotal | optional | number | Subtotal before tax |
tax_lines | optional | array | Tax breakdown rows: { "label": "GST 9%", "amount": 13.32 } |
total | required | number | Order grand total |
payment_method | optional | string | Payment method label (e.g. Credit Card (Visa ending 4242)) |
notes | optional | string | Footer note or customer message |
curl -X POST https://www.docrenders.com/render \
-H "Authorization: Bearer dcr_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "woo-invoice",
"data": {
"order_number": "10482",
"invoice_number": "WC-10482",
"invoice_date": "June 6, 2026",
"shop_name": "Whistler Digital Goods",
"shop_email": "hello@whistlerdigital.com",
"billing_name": "Alex Rivera",
"billing_email": "alex.rivera@example.com",
"items": [
{ "name": "DocRenders Pro Plugin — Annual License", "qty": 1, "unit_price": 99, "total": 99 },
{ "name": "Priority Support Add-on", "qty": 1, "unit_price": 49, "total": 49 }
],
"subtotal": 148,
"tax_lines": [{ "label": "GST 9%", "amount": 13.32 }],
"total": 161.32,
"payment_method": "Credit Card (Visa ending 4242)"
}
}' --output woo-invoice.pdf
Custom Templates
In addition to the built-in templates, you can create your own templates and use them in API calls. Custom templates let you define a reusable Markdown layout with named fields, optional CSS, and a field schema that validates inputs — exactly like built-in templates, but fully under your control.
The fastest way to get started is to fork a built-in or community template from the Template Catalog. Forking copies the template's Markdown, CSS, and field definitions into your account so you can edit them independently.
- Open the Template Catalog and click any template card.
- In the preview modal, click Fork. The template is copied to your account and you are taken to the template editor.
- Edit the template to suit your needs, then click Save.
- Use the template's ID in your API or MCP calls. The ID is shown in the Templates table in your Dashboard — see Using in API & MCP.
You can also create a blank template from the Dashboard by clicking New Template.
Template Editor
The template editor has the following fields:
| Field | Required | Description |
|---|---|---|
| Name | Yes | A short display name for your template. Used as the template's slug-style identifier in API calls if you publish it. |
| Category | No | Groups the template in the catalog (e.g. business, legal, hr). |
| Description | No | Shown in the catalog and in MCP tool hints. Describe what the template produces so AI agents can select it automatically. |
| Tags | No | Comma-separated keywords for catalog search (e.g. invoice, billing, stripe). |
| Template Markdown | Yes | The Markdown (or HTML) source for the document. Use {{ variable }} syntax to insert field values. When a caller passes data in an API request, these placeholders are replaced before rendering. |
| Style CSS | No | Custom CSS injected into the page before rendering. Overrides the default DocRenders stylesheet for this template. |
| Field Schema | No | A JSON object that declares the fields your template accepts when used in data mode. See Field Schema below. |
| Preview Fields | No | A JSON object of sample field values used when generating the template preview image in the catalog. Should contain realistic data that makes the preview look complete. |
Field Schema
Field Schema is a JSON object where each key is a field name and the value is a definition object. When present, the API validates data payloads against this schema before rendering and returns a missing_fields error if required fields are absent.
Example:
{
"recipient_name": {
"type": "string",
"required": true,
"desc": "Full name of the recipient",
"example": "Jane Smith"
},
"invoice_total": {
"type": "string",
"required": true,
"desc": "Total amount due (e.g. $1,200.00)",
"example": "$1,200.00"
},
"notes": {
"type": "string",
"required": false,
"desc": "Optional payment notes",
"example": "Net 30"
}
}
Supported field definition properties:
| Property | Type | Description |
|---|---|---|
type | string | Data type: string, number, boolean, or array. |
required | boolean | If true, the field must be present in the data payload or the request is rejected. |
desc | string | Human-readable description shown in the catalog and used as MCP tool parameter documentation. |
example | string | Example value shown in documentation and used as a hint for AI agents. |
ai_hint | string | Optional additional guidance for AI agents on how to fill this field. |
item_schema | object | For array type fields: a nested Field Schema object describing each array element's fields. |
Preview Fields
Preview Fields is a JSON object with the same shape as a data payload. It is used to render the catalog thumbnail image. Fill it with realistic values so the preview looks like a real document:
{
"recipient_name": "Jane Smith",
"invoice_total": "$1,200.00",
"notes": "Net 30"
}
After saving, click Preview to check how the template renders with your preview data before publishing.
Using Custom Templates in API & MCP
Once saved, a custom template can be used in API calls the same way as a built-in template — just use the template's ID as the template field instead of a built-in name.
Your template ID has the format tpl_xxxxxxxxxxxxxxxx and is shown in the ID column of the Templates table in your Dashboard.
REST API
curl https://www.docrenders.com/render \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "tpl_xxxxxxxxxxxxxxxx",
"data": {
"recipient_name": "Jane Smith",
"invoice_total": "$1,200.00",
"notes": "Net 30"
},
"output": "url"
}'
MCP Server
Custom templates are automatically discovered by the MCP server. When the MCP server starts, it fetches your account's templates and exposes them as callable tools alongside the built-in ones. Pass the template ID as template_id in the render_template call:
{
"tool": "render_template",
"template_id": "tpl_xxxxxxxxxxxxxxxx",
"data": {
"recipient_name": "Jane Smith",
"invoice_total": "$1,200.00"
}
}
The MCP server uses the Field Schema to generate parameter documentation, so AI agents can understand which fields are required and what each one means without any extra prompting.
Styling mode
Custom templates also support styling mode: pass markdown instead of data and the template provides the CSS while your content provides the Markdown body:
curl https://www.docrenders.com/render \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "tpl_xxxxxxxxxxxxxxxx",
"markdown": "# My Report\n\nContent here...",
"output": "url"
}'
Publishing a Custom Template
Publishing shares your template in the public Template Catalog so other users can discover and fork it. Publishing is optional — unpublished templates are private to your account and still fully usable in API and MCP calls.
To publish:
- Open the template in the editor and make sure Name, Description, and Preview Fields are filled in.
- Click Preview and verify the rendered output looks correct with your preview data.
- Click Publish. The template status changes to published and a catalog thumbnail is generated automatically.
After publishing, your template appears in the catalog under the category you specified. Other users can fork it into their own accounts, but they cannot edit your original.
You can unpublish a template at any time from the editor — this removes it from the catalog but does not affect existing forks.
Diagrams
DocRenders automatically converts fenced code blocks with a recognized diagram language into inline SVG images in your PDF. No extra API parameters or preprocessing required — just write the diagram source in your Markdown.
```mermaid
graph TD
A[Start] --> B{Decision}
B -->|Yes| C[Do the thing]
B -->|No| D[Skip it]
```
Diagram blocks are processed before Chromium renders the page, so the resulting PDF contains vector SVG graphics — not rasterized screenshots.
Supported Diagram Formats
Use the format name as the fenced code block language identifier. For example: ```mermaid, ```graphviz, ```d2.
| Language | Format | Notes |
|---|---|---|
mermaid | Mermaid | Flowcharts, sequence, Gantt, ER, and more |
graphviz | Graphviz / DOT | Directed and undirected graphs |
d2 | D2 | Declarative diagramming language |
svgbob | Svgbob | ASCII art converted to SVG |
ditaa | Ditaa | ASCII diagrams → polished graphics |
erd | ERD | Entity-relationship diagrams |
nomnoml | Nomnoml | UML-like class and sequence diagrams |
pikchr | Pikchr | Lightweight diagram markup (SQLite project) |
bytefield | Bytefield | Byte-level protocol and data structure diagrams |
umlet | UMLet | UML diagrams via UMLet XML syntax |
wireviz | WireViz | Cable and wiring harness documentation |
dbml | DBML | Database markup language (schema diagrams) |
blockdiag | BlockDiag | Block, sequence, activity, and network diagrams |
vega | Vega | Declarative statistical visualizations |
vegalite | Vega-Lite | Concise Vega grammar for common chart types |
wavedrom | WaveDrom | Digital timing diagrams |
bpmn | BPMN | Business process model and notation |
