Generate a Boarding Pass PDF via the API POST your data to /api/v1/generate and get a PDF back. Copy-paste an example, swap in your API key, and loop over a list to render thousands — one boarding pass per record.
cURL Node.js Python
curl -X POST https://pdfgen.com/api/v1/generate \
-H "Authorization: Bearer pdfg_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"html": "<div style=\"padding:28px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;color:#111827;\">\n <div style=\"max-width:560px;margin:0 auto;border-radius:16px;overflow:hidden;box-shadow:0 10px 30px rgba(0,0,0,0.12);\">\n <div style=\"background:#0ea5e9;color:#fff;padding:16px 24px;display:flex;justify-content:space-between;align-items:center;\">\n <span style=\"font-weight:800;font-size:16px;letter-spacing:1px;\">{{airline}}</span>\n <span style=\"font-size:11px;opacity:.85;letter-spacing:2px;\">BOARDING PASS</span>\n </div>\n <div style=\"background:#fff;padding:24px;\">\n <div style=\"display:flex;justify-content:space-between;align-items:center;margin-bottom:22px;\">\n <div style=\"text-align:center;\"><p style=\"font-size:30px;font-weight:800;margin:0;color:#0c4a6e;\">{{from.code}}</p><p style=\"font-size:11px;color:#6b7280;margin:2px 0 0;\">{{from.city}}</p></div>\n <div style=\"flex:1;text-align:center;color:#0ea5e9;font-size:20px;\">✈</div>\n <div style=\"text-align:center;\"><p style=\"font-size:30px;font-weight:800;margin:0;color:#0c4a6e;\">{{to.code}}</p><p style=\"font-size:11px;color:#6b7280;margin:2px 0 0;\">{{to.city}}</p></div>\n </div>\n <div style=\"display:flex;flex-wrap:wrap;gap:16px 26px;font-size:13px;\">\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">PASSENGER</p><p style=\"margin:2px 0 0;font-weight:700;\">{{passenger}}</p></div>\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">FLIGHT</p><p style=\"margin:2px 0 0;font-weight:700;\">{{flight}}</p></div>\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">DATE</p><p style=\"margin:2px 0 0;font-weight:700;\">{{formatDate date}}</p></div>\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">BOARDING</p><p style=\"margin:2px 0 0;font-weight:700;\">{{boarding}}</p></div>\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">GATE</p><p style=\"margin:2px 0 0;font-weight:700;\">{{gate}}</p></div>\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">SEAT</p><p style=\"margin:2px 0 0;font-weight:700;\">{{seat}}</p></div>\n </div>\n <div style=\"margin-top:22px;height:46px;background:repeating-linear-gradient(90deg,#111827 0 2px,#fff 2px 5px);border-radius:4px;\"></div>\n </div>\n </div>\n</div>",
"engine": "handlebars",
"format": "A5",
"data": {
"airline": "Skyline Air",
"from": {
"code": "SFO",
"city": "San Francisco"
},
"to": {
"code": "JFK",
"city": "New York"
},
"passenger": "Sam Reyes",
"flight": "SL 482",
"date": "2026-09-12",
"boarding": "7:30 AM",
"gate": "B12",
"seat": "14C"
}
}' --output boarding-pass.pdf
import fs from "node:fs" ;
const template = "<div style=\"padding:28px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;color:#111827;\">\n <div style=\"max-width:560px;margin:0 auto;border-radius:16px;overflow:hidden;box-shadow:0 10px 30px rgba(0,0,0,0.12);\">\n <div style=\"background:#0ea5e9;color:#fff;padding:16px 24px;display:flex;justify-content:space-between;align-items:center;\">\n <span style=\"font-weight:800;font-size:16px;letter-spacing:1px;\">{{airline}}</span>\n <span style=\"font-size:11px;opacity:.85;letter-spacing:2px;\">BOARDING PASS</span>\n </div>\n <div style=\"background:#fff;padding:24px;\">\n <div style=\"display:flex;justify-content:space-between;align-items:center;margin-bottom:22px;\">\n <div style=\"text-align:center;\"><p style=\"font-size:30px;font-weight:800;margin:0;color:#0c4a6e;\">{{from.code}}</p><p style=\"font-size:11px;color:#6b7280;margin:2px 0 0;\">{{from.city}}</p></div>\n <div style=\"flex:1;text-align:center;color:#0ea5e9;font-size:20px;\">✈</div>\n <div style=\"text-align:center;\"><p style=\"font-size:30px;font-weight:800;margin:0;color:#0c4a6e;\">{{to.code}}</p><p style=\"font-size:11px;color:#6b7280;margin:2px 0 0;\">{{to.city}}</p></div>\n </div>\n <div style=\"display:flex;flex-wrap:wrap;gap:16px 26px;font-size:13px;\">\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">PASSENGER</p><p style=\"margin:2px 0 0;font-weight:700;\">{{passenger}}</p></div>\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">FLIGHT</p><p style=\"margin:2px 0 0;font-weight:700;\">{{flight}}</p></div>\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">DATE</p><p style=\"margin:2px 0 0;font-weight:700;\">{{formatDate date}}</p></div>\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">BOARDING</p><p style=\"margin:2px 0 0;font-weight:700;\">{{boarding}}</p></div>\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">GATE</p><p style=\"margin:2px 0 0;font-weight:700;\">{{gate}}</p></div>\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">SEAT</p><p style=\"margin:2px 0 0;font-weight:700;\">{{seat}}</p></div>\n </div>\n <div style=\"margin-top:22px;height:46px;background:repeating-linear-gradient(90deg,#111827 0 2px,#fff 2px 5px);border-radius:4px;\"></div>\n </div>\n </div>\n</div>" ;
const res = await fetch ( "https://pdfgen.com/api/v1/generate" , {
method : "POST" ,
headers : {
Authorization : "Bearer pdfg_live_xxx" ,
"Content-Type" : "application/json" ,
} ,
body : JSON . stringify ( {
html : template ,
engine : "handlebars" ,
format : "A5" ,
data : {
"airline" : "Skyline Air" ,
"from" : {
"code" : "SFO" ,
"city" : "San Francisco"
} ,
"to" : {
"code" : "JFK" ,
"city" : "New York"
} ,
"passenger" : "Sam Reyes" ,
"flight" : "SL 482" ,
"date" : "2026-09-12" ,
"boarding" : "7:30 AM" ,
"gate" : "B12" ,
"seat" : "14C"
} ,
} ) ,
} ) ;
fs . writeFileSync ( "boarding-pass.pdf" , Buffer . from ( await res . arrayBuffer ( ) ) ) ;
import requests
template = "<div style=\"padding:28px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;color:#111827;\">\n <div style=\"max-width:560px;margin:0 auto;border-radius:16px;overflow:hidden;box-shadow:0 10px 30px rgba(0,0,0,0.12);\">\n <div style=\"background:#0ea5e9;color:#fff;padding:16px 24px;display:flex;justify-content:space-between;align-items:center;\">\n <span style=\"font-weight:800;font-size:16px;letter-spacing:1px;\">{{airline}}</span>\n <span style=\"font-size:11px;opacity:.85;letter-spacing:2px;\">BOARDING PASS</span>\n </div>\n <div style=\"background:#fff;padding:24px;\">\n <div style=\"display:flex;justify-content:space-between;align-items:center;margin-bottom:22px;\">\n <div style=\"text-align:center;\"><p style=\"font-size:30px;font-weight:800;margin:0;color:#0c4a6e;\">{{from.code}}</p><p style=\"font-size:11px;color:#6b7280;margin:2px 0 0;\">{{from.city}}</p></div>\n <div style=\"flex:1;text-align:center;color:#0ea5e9;font-size:20px;\">✈</div>\n <div style=\"text-align:center;\"><p style=\"font-size:30px;font-weight:800;margin:0;color:#0c4a6e;\">{{to.code}}</p><p style=\"font-size:11px;color:#6b7280;margin:2px 0 0;\">{{to.city}}</p></div>\n </div>\n <div style=\"display:flex;flex-wrap:wrap;gap:16px 26px;font-size:13px;\">\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">PASSENGER</p><p style=\"margin:2px 0 0;font-weight:700;\">{{passenger}}</p></div>\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">FLIGHT</p><p style=\"margin:2px 0 0;font-weight:700;\">{{flight}}</p></div>\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">DATE</p><p style=\"margin:2px 0 0;font-weight:700;\">{{formatDate date}}</p></div>\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">BOARDING</p><p style=\"margin:2px 0 0;font-weight:700;\">{{boarding}}</p></div>\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">GATE</p><p style=\"margin:2px 0 0;font-weight:700;\">{{gate}}</p></div>\n <div><p style=\"font-size:10px;color:#9ca3af;margin:0;letter-spacing:1px;\">SEAT</p><p style=\"margin:2px 0 0;font-weight:700;\">{{seat}}</p></div>\n </div>\n <div style=\"margin-top:22px;height:46px;background:repeating-linear-gradient(90deg,#111827 0 2px,#fff 2px 5px);border-radius:4px;\"></div>\n </div>\n </div>\n</div>"
res = requests . post (
"https://pdfgen.com/api/v1/generate" ,
headers = { "Authorization" : "Bearer pdfg_live_xxx" } ,
json = {
"html" : template ,
"engine" : "handlebars" ,
"format" : "A5" ,
"data" : {
"airline" : "Skyline Air" ,
"from" : {
"code" : "SFO" ,
"city" : "San Francisco"
} ,
"to" : {
"code" : "JFK" ,
"city" : "New York"
} ,
"passenger" : "Sam Reyes" ,
"flight" : "SL 482" ,
"date" : "2026-09-12" ,
"boarding" : "7:30 AM" ,
"gate" : "B12" ,
"seat" : "14C"
} ,
} ,
)
with open ( "boarding-pass.pdf" , "wb" ) as f :
f . write ( res . content )
Working in another language? Follow a full guide for your stack: