Boarding Pass PDF generation API
Generate a boarding pass PDF from a template and your flight JSON in a single call. Docweave binds passenger name, flight number, seat, gate, and boarding time into an HTML boarding pass template and returns a ready-to-scan PDF — no headless browser to run yourself.
Generate a boarding pass 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" \
--output boarding-pass.pdf \
-d '{
"source": {
"type": "template",
"template": "<h1>{{ airline }}</h1><p>{{ passenger_name }} — {{ flight_number }}</p><p>{{ departure_code }} to {{ arrival_code }} — Seat {{ seat }}</p><p>Gate {{ gate }} — Boards {{ boarding_time }}</p>",
"data": {
"airline": "Aurora Air",
"passenger_name": "J. RIVERA",
"flight_number": "AU 482",
"departure_code": "JFK",
"arrival_code": "LAX",
"seat": "14C",
"gate": "B22",
"boarding_time": "09:35"
}
},
"options": { "format": "A4" },
"idempotencyKey": "AU482-JRIVERA-20260714"
}'…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>{{ airline }}</h1><p>{{ passenger_name }} — {{ flight_number }}</p><p>{{ departure_code }} to {{ arrival_code }} — Seat {{ seat }}</p><p>Gate {{ gate }} — Boards {{ boarding_time }}</p>",
data: {
airline: "Aurora Air",
passenger_name: "J. RIVERA",
flight_number: "AU 482",
departure_code: "JFK",
arrival_code: "LAX",
seat: "14C",
gate: "B22",
boarding_time: "09:35"
}
},
outputPath: "/tmp/boarding-pass-au482.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: 1px solid #ccc;">
<header style="display:flex; justify-content:space-between; align-items:center;">
<h1>{{ airline }}</h1>
<div>{{ ticket_class }} · Group {{ boarding_group }}</div>
</header>
<p style="font-size:1.1em;"><strong>{{ passenger_name }}</strong></p>
<table style="width:100%; border-collapse:collapse;">
<tr>
<td>From</td>
<td>{{ departure_city }} ({{ departure_code }})</td>
<td>To</td>
<td>{{ arrival_city }} ({{ arrival_code }})</td>
</tr>
<tr>
<td>Flight</td>
<td>{{ flight_number }}</td>
<td>Date</td>
<td>{{ flight_date }}</td>
</tr>
<tr>
<td>Gate</td>
<td>{{ gate }}</td>
<td>Seat</td>
<td>{{ seat }}</td>
</tr>
<tr>
<td>Boarding time</td>
<td>{{ boarding_time }}</td>
<td>Departure time</td>
<td>{{ departure_time }}</td>
</tr>
</table>
<p>PNR / Confirmation: {{ confirmation_code }}</p>
<p>Sequence No: {{ sequence_number }}</p>
<footer style="text-align:center; margin-top:1em;">
{{{ barcode_svg }}}
</footer>
</article>FAQ
How do I generate a boarding pass PDF from the API?
Send a POST to /api/v1/pdf with a source of type "template": pass your boarding pass HTML template and a data object with passenger name, flight number, seat, gate, and boarding time. Docweave binds the JSON into the {{ placeholders }} and returns the boarding pass PDF.
Can the boarding pass PDF include a barcode or QR code?
Yes. Render your barcode or QR code as an SVG or image string (for example a data URI) and pass it as a field in data, then place it in the template with a triple-mustache placeholder like {{{ barcode_svg }}} so the markup renders instead of being escaped.
How do I avoid generating a duplicate boarding pass PDF?
Include an idempotencyKey built from a stable identifier such as the flight number, passenger, and date. A repeat request with the same key returns the stored result instead of re-rendering or re-billing, so retries when a gate or seat changes are always safe.
How is boarding pass PDF generation priced?
Pricing is per document, not per page. A single-passenger boarding pass and a multi-page itinerary with connecting flights count the same, so multi-leg trips never cost extra.
Ready to generate boarding pass PDFs in production?
Get an API key