Skip to content

Templates + data → PDF

Instead of sending the full HTML every time, store a template once and call it by name with your data. Perfect for invoices, receipts, certificates, and reports where the layout is fixed and only the values change.

Stored templates are a Pro feature

Rendering inline HTML with {{ variables }} works on every tier (see Quickstart). Storing named templates and calling POST /pdf/v1/template requires the Pro plan. See Pricing.

1. Create a template

Manage templates in the portal (app.kikidoc.dev → Templates) — or have your AI agent create one via MCP. A template is just HTML with placeholders:

<h1>Invoice {{ number }}</h1>
<p>Billed to: {{ customer.name }}</p>
<table>
  {% for item in items %}
  <tr><td>{{ item.name }}</td><td>{{ item.price }}</td></tr>
  {% endfor %}
</table>
<p><strong>Total: {{ total }}</strong></p>

The engine is sandboxed Jinja2: {{ var }}, {% if %}, {% for %}, and an allowlist of safe filters. HTML is autoescaped. Unknown variables are left as-is rather than erroring.

2. Render it with data

curl -X POST https://api.kikidoc.dev/pdf/v1/template \
  -H "X-API-Key: $KIKIDOC_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "template_name": "invoice",
    "data": {
      "number": "1024",
      "customer": { "name": "Acme Inc." },
      "items": [
        { "name": "Pro plan", "price": "$15.00" },
        { "name": "Overage",  "price": "$2.00" }
      ],
      "total": "$17.00"
    }
  }' --output invoice.pdf

options, security, and delivery work exactly as in the HTML → PDF guide.

List your templates

curl https://api.kikidoc.dev/pdf/v1/templates -H "X-API-Key: $KIKIDOC_API_KEY"
{ "templates": [ { "id": 1, "name": "invoice", "description": "Standard invoice" } ] }

Prefer a visual editor?

KikiDoc is HTML/template-first — which means your template is plain HTML you (or an AI) can generate in seconds. If a non-technical teammate needs to tweak the design, the simplest path is to ask ChatGPT/Claude for the HTML and paste it in. (A built-in visual editor may come later.)