DoConure

Example payloads

Five documents people make every day, each as the JSON you send and a minimal template that reads it. Copy the pair, render it once, then make the template yours: the shape of the data stays.

Each template is HTML because it fits on the page; the same tags work in a Word or Excel template (Writing a template, Lists and repeating rows). Send any payload as data in POST /api/v1/compose/documents/generate, with your template's id in settings.templateId (Generating a document). For a template you already uploaded, the console pre-fills its own example on the template's page, under Test with JSON.

An invoice: lines and totals

One list (lines) that becomes one row each, and totals you compute and format yourself: the template places values, it does not do arithmetic.

{
  "number": "2026-001",
  "date": "31/10/2026",
  "customer": {"name": "Acme S.r.l.", "vatNumber": "IT01234567890",
               "address": "Via Roma 1, 20121 Milano"},
  "lines": [
    {"description": "Consulenza", "quantity": "2", "price": "500,00", "amount": "1.000,00"},
    {"description": "Trasferta", "quantity": "1", "price": "240,00", "amount": "240,00"}
  ],
  "net": "1.240,00", "vat": "272,80", "total": "1.512,80"
}
<h1>Fattura {{ number }} del {{ date }}</h1>
<p>{{ customer.name }} &middot; P.IVA {{ customer.vatNumber }}<br>{{ customer.address }}</p>
<table style="table-layout: fixed; width: 100%">
  <thead><tr><th>Descrizione</th><th>Q.tà</th><th>Prezzo</th><th>Importo</th></tr></thead>
  <tbody>
  {% for l in lines %}
    <tr><td>{{ l.description }}</td><td>{{ l.quantity }}</td><td>{{ l.price }}</td><td>{{ l.amount }}</td></tr>
  {% endfor %}
  </tbody>
</table>
<p>Imponibile {{ net }} &middot; IVA {{ vat }} &middot; <strong>Totale {{ total }}</strong></p>

A quote: a part that appears only when it applies

A discount section printed only when the payload carries one. Leave the field out, or send it empty, and the section is not in the document.

{
  "number": "PREV-2026-014",
  "customer": {"name": "Acme S.r.l."},
  "validUntil": "30/11/2026",
  "items": [
    {"description": "Licenza annuale", "amount": "1.200,00"},
    {"description": "Formazione (1 giorno)", "amount": "600,00"}
  ],
  "discount": "10%",
  "total": "1.620,00"
}
<h1>Preventivo {{ number }}</h1>
<p>Per {{ customer.name }}, valido fino al {{ validUntil }}.</p>
<ul>{% for i in items %}<li>{{ i.description }}: {{ i.amount }}</li>{% endfor %}</ul>
{% if discount %}<p>Sconto applicato: {{ discount }}</p>{% endif %}
<p><strong>Totale {{ total }}</strong></p>

A delivery note: a list inside a list

Packages, each with its own goods: a loop inside a loop. The inner name (i) reads the current package's list. Inside an object, do not call a list items, keys or values: p.items is the object's own method, not your list.

{
  "number": "DDT-2026-087",
  "date": "31/10/2026",
  "recipient": {"name": "Acme S.r.l.", "address": "Via Roma 1, 20121 Milano"},
  "packages": [
    {"label": "Collo 1", "goods": [{"code": "A-100", "description": "Staffa", "quantity": "20"},
                                   {"code": "A-200", "description": "Vite M6", "quantity": "200"}]},
    {"label": "Collo 2", "goods": [{"code": "B-310", "description": "Pannello", "quantity": "4"}]}
  ]
}
<h1>Documento di trasporto {{ number }} del {{ date }}</h1>
<p>Destinatario: {{ recipient.name }}, {{ recipient.address }}</p>
{% for p in packages %}
  <h2>{{ p.label }}</h2>
  <table style="table-layout: fixed; width: 100%">
    {% for i in p.goods %}<tr><td>{{ i.code }}</td><td>{{ i.description }}</td><td>{{ i.quantity }}</td></tr>{% endfor %}
  </table>
{% endfor %}

A monthly report: figures and a table

A few headline figures and a table of rows. A long table renders faster with a fixed layout: A long table: fix its layout.

{
  "month": "Ottobre 2026",
  "company": {"name": "Acme S.r.l."},
  "figures": {"orders": "128", "revenue": "48.200,00", "returns": "3"},
  "rows": [
    {"day": "01/10/2026", "orders": "4", "revenue": "1.520,00"},
    {"day": "02/10/2026", "orders": "6", "revenue": "2.310,00"}
  ]
}
<h1>{{ company.name }}: {{ month }}</h1>
<p>Ordini {{ figures.orders }} &middot; Fatturato {{ figures.revenue }} &middot; Resi {{ figures.returns }}</p>
<table style="table-layout: fixed; width: 100%">
  <thead><tr><th>Giorno</th><th>Ordini</th><th>Fatturato</th></tr></thead>
  <tbody>{% for r in rows %}<tr><td>{{ r.day }}</td><td>{{ r.orders }}</td><td>{{ r.revenue }}</td></tr>{% endfor %}</tbody>
</table>

An agreement: parties and numbered clauses

Two parties and a list of clauses, ready to be sent for signature: compose it and sign it in one call with Document Fly, placing the signatures with the fields or the tags of the signing guide.

{
  "title": "Contratto di servizio",
  "date": "31/10/2026",
  "provider": {"name": "Acme S.r.l.", "representative": "Anna Rossi"},
  "client": {"name": "Acme Servizi S.p.A.", "representative": "Marco Bianchi"},
  "clauses": [
    {"title": "Oggetto", "text": "Il fornitore presta il servizio descritto nell'allegato A."},
    {"title": "Durata", "text": "Dodici mesi dalla firma, rinnovabili per iscritto."},
    {"title": "Corrispettivo", "text": "1.200,00 euro annui, IVA esclusa, fatturati anticipatamente."}
  ]
}
<h1>{{ title }}</h1>
<p>Tra {{ provider.name }}, rappresentata da {{ provider.representative }}, e
{{ client.name }}, rappresentata da {{ client.representative }}, il {{ date }}.</p>
<ol>{% for c in clauses %}<li><strong>{{ c.title }}.</strong> {{ c.text }}</li>{% endfor %}</ol>

Your own payload

Any shape your system already has will do: a template reads nested objects with dots (customer.address) and lists with a loop. Names are matched without regard to case. A field the template reads and the payload lacks renders empty and is reported, as TEMPLATE_FIELDS_MISSING: see Missing and extra fields. To check a payload without generating anything, use Validate before you send.