Report & statement PDF generation API
Generate a report or statement PDF from a template and your data JSON in a single call. Docweave binds the period, figures, and transactions into an HTML report template and returns a multi-page PDF — priced per document, never per page.
Generate a report PDF via the API
POST your template and data to /api/v1/pdf:
curl https://docweave.dev/api/v1/pdf \
-H "Authorization: Bearer dw_live_your_key" \
-H "Content-Type: application/json" \
-d '{
"source": {
"type": "template",
"template": "<h1>Monthly Statement — {{ period }}</h1><p>Account: {{ account }}</p><p>Closing balance: {{ balance }}</p>",
"data": {
"period": "July 2026",
"account": "Acme Inc.",
"balance": "$12,940.00"
}
},
"options": { "format": "A4" },
"idempotencyKey": "statement-acme-2026-07"
}'…or from an AI agent
Add the Docweave MCP server and your agent gets a generate_pdf tool — the same orchestration, no HTTP boilerplate:
// From an AI agent over MCP — no HTTP plumbing:
generate_pdf({
source: {
type: "template",
template: "<h1>Monthly Statement — {{ period }}</h1><p>Account: {{ account }}</p><p>Closing balance: {{ balance }}</p>",
data: { period: "July 2026", account: "Acme Inc.", balance: "$12,940.00" }
},
outputPath: "/tmp/statement-2026-07.pdf"
})Template example
Any HTML works as a template. Use {{ placeholders }} for the values you pass in data:
<article style="font-family: sans-serif;">
<header>
<h1>Monthly Statement — {{ period }}</h1>
<p>Account: {{ account }}</p>
</header>
<section>
<h2>Summary</h2>
<p>Opening balance: {{ opening_balance }}</p>
<p>Closing balance: {{ balance }}</p>
</section>
<section>
<h2>Transactions</h2>
<table style="width:100%; border-collapse:collapse;">
{{ transactions }}
</table>
</section>
<footer style="font-size:12px; color:#666;">
Generated {{ generated_at }}
</footer>
</article>FAQ
How do I generate a report PDF from the API?
Send a POST to /api/v1/pdf with a source of type "template": pass your report or statement HTML template and a data object with the period, account, and figures. Docweave binds the JSON into the {{ placeholders }} and returns the report PDF.
Can Docweave generate multi-page reports?
Yes. Reports flow across pages automatically as the content grows, and you can set the format, margins, and headers/footers through the options field. Pricing stays per document, so page count never changes the cost.
Can I schedule monthly statement generation?
Yes. Call the endpoint from a cron job or scheduled worker with each account's data. Use an idempotencyKey like the account and period so a re-run of the job returns the stored PDF instead of regenerating it.
How is report PDF generation priced?
Pricing is per document, not per page. A one-page summary and a long multi-page statement each count as a single document, so detailed reports do not cost more.
Ready to generate report PDFs in production?
Get an API key