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. No markdown needed.
  • 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.

TemplateDescription
invoiceProfessional invoice with line items, totals, sender/recipient blocks, and logo
receiptPayment receipt with merchant, items, totals, and payment method
resumeClean typographic layout for CVs and resumes
ai-summaryDark report header, executive summary callout, key findings, and sections
reportBusiness report with executive summary and structured sections
letterFormal business letter with sender, recipient, subject, and signature
proposalProject or sales proposal with structured sections and logo
postWordPress-style blog post with title, author, date, featured image, and Markdown body
woo-invoiceWooCommerce 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.

FieldTypeDescription
namerequiredstringClient or recipient name
daterequiredstringInvoice date
totalrequirednumberTotal amount due
itemsrequiredarrayLine items: description, qty, unit_price, amount
fromoptionalstringSender company name
from_streetoptionalstringSender street address
from_cityoptionalstringSender city, state, and zip
from_emailoptionalstringSender email address
due_dateoptionalstringPayment due date
invoice_numberoptionalstringInvoice reference number
titleoptionalstringDocument title (default: Invoice)
subtotaloptionalnumberSubtotal before tax
taxoptionalnumberTax amount
notesoptionalstringFooter note or payment instructions
logooptionalimageSender 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.

FieldTypeDescription
merchantrequiredstringMerchant or business name
daterequiredstringTransaction date
totalrequirednumberTotal charged
itemsrequiredarrayLine items: description, amount
transaction_idoptionalstringTransaction or order ID
subtotaloptionalnumberSubtotal before tax
taxoptionalnumberTax amount
payment_methodoptionalstringe.g. Cash or VISA XXXXXX4242
notesoptionalstringFooter note or return policy
logooptionalimageMerchant logo — URL or base64 PNG/JPEG

resume

Clean typographic CV layout with sections for experience, education, and skills.

FieldTypeDescription
namerequiredstringFull name
emailrequiredstringEmail address
phoneoptionalstringPhone number
locationoptionalstringCity, State or remote
linkedinoptionalstringLinkedIn URL or handle
githuboptionalstringGitHub URL or handle
summaryoptionalstringProfessional summary paragraph
experienceoptionalarrayWork history: company, role, dates, bullets (array of strings)
educationoptionalarrayEducation: school, degree, year
skillsoptionalstringSkills 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.

FieldTypeDescription
titlerequiredstringReport title
daterequiredstringReport date
summaryrequiredstringExecutive summary text
modeloptionalstringAI model name shown in header metadata
authoroptionalstringAuthor or team name
key_pointsoptionalarrayKey findings — array of strings
sectionsoptionalarrayAdditional sections: heading, content

report

General business report with optional logo, executive summary, and structured sections.

FieldTypeDescription
titlerequiredstringReport title
authorrequiredstringAuthor name or team
daterequiredstringReport date
sectionsrequiredarrayReport sections: heading, content
executive_summaryoptionalstringExecutive summary paragraph shown before sections
logooptionalimageOrganization logo — URL or base64 PNG/JPEG

letter

Formal business letter with sender address, recipient, subject line, body, and closing signature.

FieldTypeDescription
sender_namerequiredstringSender full name
recipient_namerequiredstringRecipient full name or organization
daterequiredstringLetter date
bodyrequiredstringLetter body — Markdown supported
signature_namerequiredstringSignature name
sender_addressoptionalstringSender address block
recipient_addressoptionalstringRecipient address block
subjectoptionalstringRe: subject line
salutationoptionalstringOpening salutation word (default: Dear)
closingoptionalstringClosing phrase (default: Sincerely)

proposal

Project or sales proposal with client and preparer details, structured sections, and optional logo.

FieldTypeDescription
titlerequiredstringProposal title
clientrequiredstringClient name or organization
daterequiredstringProposal date
prepared_byrequiredstringYour name or company
sectionsrequiredarrayProposal sections: heading, content
logooptionalimageYour 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.

FieldTypeDescription
titlerequiredstringPost title
authorrequiredstringAuthor display name
daterequiredstringPublication date
contentrequiredstringPost body — Markdown (GFM) supported
categoryoptionalstringPrimary category label shown in the header
tagsoptionalarrayTag strings displayed below the byline
featured_imageoptionalimageFeatured 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.

FieldTypeDescription
order_numberrequiredstringWooCommerce order number (e.g. 10482)
invoice_numberrequiredstringInvoice reference (e.g. WC-10482)
invoice_daterequiredstringInvoice date
shop_namerequiredstringWooCommerce store name
billing_namerequiredstringCustomer billing name
due_dateoptionalstringPayment due date
shop_emailoptionalstringStore contact email
shop_addressoptionalstringStore address
billing_emailoptionalstringCustomer email
billing_addressoptionalstringCustomer billing address
itemsrequiredarrayLine items: name, qty, unit_price, total
subtotaloptionalnumberSubtotal before tax
tax_linesoptionalarrayTax breakdown rows: { "label": "GST 9%", "amount": 13.32 }
totalrequirednumberOrder grand total
payment_methodoptionalstringPayment method label (e.g. Credit Card (Visa ending 4242))
notesoptionalstringFooter 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.

  1. Open the Template Catalog and click any template card.
  2. In the preview modal, click Fork. The template is copied to your account and you are taken to the template editor.
  3. Edit the template to suit your needs, then click Save.
  4. 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:

FieldRequiredDescription
NameYesA short display name for your template. Used as the template's slug-style identifier in API calls if you publish it.
CategoryNoGroups the template in the catalog (e.g. business, legal, hr).
DescriptionNoShown in the catalog and in MCP tool hints. Describe what the template produces so AI agents can select it automatically.
TagsNoComma-separated keywords for catalog search (e.g. invoice, billing, stripe).
Template MarkdownYesThe 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 CSSNoCustom CSS injected into the page before rendering. Overrides the default DocRenders stylesheet for this template.
Field SchemaNoA JSON object that declares the fields your template accepts when used in data mode. See Field Schema below.
Preview FieldsNoA 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:

PropertyTypeDescription
typestringData type: string, number, boolean, or array.
requiredbooleanIf true, the field must be present in the data payload or the request is rejected.
descstringHuman-readable description shown in the catalog and used as MCP tool parameter documentation.
examplestringExample value shown in documentation and used as a hint for AI agents.
ai_hintstringOptional additional guidance for AI agents on how to fill this field.
item_schemaobjectFor 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:

  1. Open the template in the editor and make sure Name, Description, and Preview Fields are filled in.
  2. Click Preview and verify the rendered output looks correct with your preview data.
  3. 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.

LanguageFormatNotes
mermaidMermaidFlowcharts, sequence, Gantt, ER, and more
graphvizGraphviz / DOTDirected and undirected graphs
d2D2Declarative diagramming language
svgbobSvgbobASCII art converted to SVG
ditaaDitaaASCII diagrams → polished graphics
erdERDEntity-relationship diagrams
nomnomlNomnomlUML-like class and sequence diagrams
pikchrPikchrLightweight diagram markup (SQLite project)
bytefieldBytefieldByte-level protocol and data structure diagrams
umletUMLetUML diagrams via UMLet XML syntax
wirevizWireVizCable and wiring harness documentation
dbmlDBMLDatabase markup language (schema diagrams)
blockdiagBlockDiagBlock, sequence, activity, and network diagrams
vegaVegaDeclarative statistical visualizations
vegaliteVega-LiteConcise Vega grammar for common chart types
wavedromWaveDromDigital timing diagrams
bpmnBPMNBusiness process model and notation