Event Ticket PDF generation API
Generate an event ticket PDF from a template and your order JSON in a single call. Docweave binds the attendee name, seat, and QR/barcode into an HTML ticket template and returns a ready-to-scan PDF — no headless browser to run yourself.
Generate an event ticket 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" \
-H "Accept: application/pdf" \
-d '{
"source": {
"type": "template",
"template": "<h1>{{ event_name }}</h1><p>{{ attendee_name }} — Seat {{ seat }}</p><p>Ticket {{ ticket_id }}</p>",
"data": {
"event_name": "Northside Music Festival",
"attendee_name": "Jordan Ellis",
"seat": "GA-Floor",
"ticket_id": "NMF26-00481"
}
},
"options": { "format": "A6" },
"idempotencyKey": "NMF26-00481"
}' \
--output ticket-NMF26-00481.pdf…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>{{ event_name }}</h1><p>{{ attendee_name }} — Seat {{ seat }}</p><p>Ticket {{ ticket_id }}</p>",
data: { event_name: "Northside Music Festival", attendee_name: "Jordan Ellis", seat: "GA-Floor", ticket_id: "NMF26-00481" }
},
outputPath: "/tmp/ticket-NMF26-00481.pdf"
})Template example
Any HTML works as a template. Use {{ placeholders }} for the values you pass in data:
<article style="font-family: sans-serif; border: 2px solid #111; border-radius: 12px; padding: 24px;">
<header style="display:flex; justify-content:space-between; align-items:flex-start;">
<div>
<h1 style="margin:0;">{{ event_name }}</h1>
<p style="margin:4px 0 0;">{{ venue_name }}, {{ venue_city }}</p>
<p style="margin:2px 0 0;">{{ event_date }} · Doors {{ door_time }}</p>
</div>
<img src="{{ qr_code_url }}" alt="Entry QR code" width="110" height="110" />
</header>
<hr style="margin:16px 0; border-top:1px dashed #999;" />
<table style="width:100%; border-collapse:collapse;">
<tr>
<td>Attendee</td>
<td style="text-align:right;"><strong>{{ attendee_name }}</strong></td>
</tr>
<tr>
<td>Ticket type</td>
<td style="text-align:right;">{{ ticket_type }}</td>
</tr>
<tr>
<td>Section / Seat</td>
<td style="text-align:right;">{{ section }} / {{ seat }}</td>
</tr>
<tr>
<td>Order</td>
<td style="text-align:right;">{{ order_id }}</td>
</tr>
</table>
<p style="margin-top:16px; font-size:12px; color:#555;">Ticket ID {{ ticket_id }} · Non-transferable · Present this barcode at entry.</p>
<div style="text-align:center; margin-top:8px;">{{{ barcode_svg }}}</div>
</article>FAQ
How do I generate an event ticket PDF from the API?
Send a POST to /api/v1/pdf with a source of type "template": pass your ticket HTML template and a data object with the event, attendee, seat, and ticket ID. Docweave binds the JSON into the {{ placeholders }} — including a QR or barcode image URL — and returns the ticket PDF.
Can I include a QR code or barcode on the ticket?
Yes. Generate the QR/barcode image (or SVG markup) yourself and pass its URL or markup as a template value, for example {{ qr_code_url }} in an <img> tag or {{{ barcode_svg }}} inline. Docweave renders it as part of the PDF like any other HTML content.
How do I avoid generating a duplicate ticket PDF for the same order?
Include an idempotencyKey (for example the ticket ID). A repeat request with the same key returns the stored result instead of re-rendering or re-billing, so retries from a checkout flow are always safe.
How is event ticket PDF generation priced?
Pricing is per document, not per page. A single-page ticket and a multi-page ticket bundle for a group order count the same way, so batch-generating tickets for an event never costs extra per page.
Ready to generate event ticket PDFs in production?
Get an API key