Marketing

Gift card PDF generator API

A branded gift card with amount, unique redeem code and expiry — generated in bulk for every purchase.

Deliver a beautiful digital gift card the instant someone buys one. Pass the brand, amount, unique redeem code, recipient and expiry, and PDFgen returns a branded gift card PDF ready to email.

Generate one per purchase — or thousands for a promotion — from a single reusable template.

Generate a Gift Card 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 gift card per record.

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:32px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;color:#111827;\">\n <div style=\"max-width:480px;margin:0 auto;border-radius:18px;overflow:hidden;box-shadow:0 14px 40px rgba(0,0,0,.18);background:linear-gradient(135deg,#7c3aed,#db2777);color:#fff;\">\n <div style=\"padding:32px;\">\n <div style=\"display:flex;justify-content:space-between;align-items:flex-start;\">\n <span style=\"font-size:18px;font-weight:800;letter-spacing:1px;\">{{brand}}</span>\n <span style=\"font-size:11px;letter-spacing:3px;opacity:.85;\">GIFT CARD</span>\n </div>\n <p style=\"font-size:52px;font-weight:800;margin:24px 0 0;\">{{formatCurrency amount currency}}</p>\n <p style=\"font-size:13px;opacity:.85;margin:6px 0 0;\">{{message}}</p>\n </div>\n <div style=\"background:rgba(255,255,255,.12);padding:18px 32px;display:flex;justify-content:space-between;align-items:center;\">\n <div>\n <p style=\"font-size:10px;letter-spacing:2px;opacity:.8;margin:0;\">REDEEM CODE</p>\n <p style=\"font-size:20px;font-weight:700;letter-spacing:3px;margin:4px 0 0;\">{{code}}</p>\n </div>\n <div style=\"text-align:right;font-size:11px;opacity:.85;\">\n <p style=\"margin:0;\">For {{to}}</p>\n <p style=\"margin:2px 0 0;\">Exp {{formatDate expires}}</p>\n </div>\n </div>\n </div>\n</div>",
"engine": "handlebars",
"format": "A5",
"data": {
"brand": "Bloom & Co.",
"amount": 50,
"currency": "USD",
"message": "Treat yourself to something lovely.",
"code": "BLOOM-7F4K-2QX9",
"to": "Alex Carter",
"expires": "2027-06-30"
}
}' --output gift-card.pdf

Working in another language? Follow a full guide for your stack:

What you can build

  • Emailing a gift card PDF right after purchase
  • Bulk-issuing promo or loyalty gift cards
  • Generating unique-code cards for a campaign
  • Letting customers re-download a gift card from your app

Frequently asked questions

Can each gift card have a unique code?
Yes — generate the code in your system and pass it per render; the template prints it in the redeem-code block.
Can I show the balance and expiry?
Yes — the amount, recipient and expiry date are all Handlebars tokens you pass in your data.
Can I generate gift cards in bulk for a promotion?
Yes — loop over your code list and call /api/v1/generate per card to produce them all.

Related templates

Ship your gift card PDF endpoint today

Generate this template with AI, tweak it to match your brand, then render at scale with a single API call — no headless browsers to babysit.