Skip to content
jsontoimg
Start free
← All articles

Certificate Generator with QR Code Verification: How to Build It

Published · Balaji

How to Build a Certificate Generator with Verification QR Codes

Looking for the commercial API overview and pricing? Check out the primary Certificate Generator API hub.

Certificates are essential milestones for modern SaaS platforms, online courses, bootcamps, and professional accreditations. When a student completes a course, they expect an immediate, high-resolution certificate with a verifiable credential ID and a scannable QR code.

This tutorial walks through building a programmatic certificate generator with jsontoimg using Python or Node.js. By the end, you will have a pipeline that reads completion records from your database and renders print-ready vector PDFs and web-ready PNGs automatically.

Why Manual Certificate Workflows Fail

Most teams start with a graphic designer, a Figma or Canva template, and a spreadsheet. While manageable for 15 students, this approach breaks down at scale:

  • Time Drain: Exporting, naming, and emailing 500 certificates consumes 80–120 hours of manual labor per cohort.
  • Typo Exposure: Human copy-paste errors on recipient names or dates undermine institutional credibility.
  • No Instant Verification: Manual exports lack verifiable cryptographic UUIDs and tamper-evident QR lookups.

By treating certificates as a template driven by structured JSON, you turn graduation day into an automated 2-minute API background job.

Step 1: The Certificate Data Model

Every certificate requires a consistent JSON schema: recipient name, course title, completion date, credential UUID, and a verification URL:

{
  "certificate_id": "0190a7e2-5b1c-7c3e-9f00-2a6d1e4b8c11",
  "recipient_name": "Priya Sharma",
  "course_title": "Advanced Distributed Systems",
  "instructor": "Balaji R",
  "completion_date": "2026-11-17",
  "verification_url": "https://verify.example.com/c/0190a7e2-5b1c-7c3e-9f00-2a6d1e4b8c11"
}

In J2I Studio, design your certificate with dynamic text layers for recipient_name, course_title, completion_date, and certificate_id. Add a native Code layer named qr with format qrcode. Static elements (borders, emblems, background graphics, signatures) stay on fixed layers.

Step 2: Rendering a Single Certificate via REST

To issue a single certificate upon course completion, send a POST request to /api/v1/render:

curl -X POST "https://app.jsontoimg.com/api/v1/render?wait=60" \
  -H "Authorization: Bearer $JSONTOIMG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "template": "tpl_graduation_award",
    "version": 1,
    "format": "pdf",
    "layers": {
      "recipient_name": { "text": "Priya Sharma" },
      "course_title": { "text": "Advanced Distributed Systems" },
      "completion_date": { "text": "November 17, 2026" },
      "certificate_id": { "text": "0190a7e2-5b1c-7c3e" },
      "qr": { "text": "https://verify.example.com/c/0190a7e2-5b1c-7c3e" }
    }
  }'

The response returns a permanent asset URL for the rendered vector PDF. Each PDF page costs exactly 1 credit.

Step 3: Batch Rendering for Graduating Cohorts

For graduating cohorts of 100 to 1,000 students, use POST /api/v1/renders/batch to process jobs in batches of up to 50 certificates per request.

Here is the complete production batch script in Python:

import os
import sqlite3
import requests

API_KEY = os.environ.get("JSONTOIMG_API_KEY")
TEMPLATE_ID = "tpl_graduation_award"

conn = sqlite3.connect("lms.db")
cursor = conn.cursor()

# Query pending certificate awards
rows = cursor.execute("""
    SELECT certificate_id, recipient_name, course_title, completion_date
    FROM completions
    WHERE certificate_generated = 0
    LIMIT 50
""").fetchall()

jobs = [
    {
        "id": f"cert_{r[0]}",
        "template": TEMPLATE_ID,
        "version": 1,
        "format": "pdf",
        "layers": {
            "certificate_id": {"text": r[0]},
            "recipient_name": {"text": r[1]},
            "course_title": {"text": r[2]},
            "completion_date": {"text": r[3]},
            "qr": {"text": f"https://verify.example.com/c/{r[0]}"}
        }
    }
    for r in rows
]

response = requests.post(
    "https://app.jsontoimg.com/api/v1/renders/batch",
    json={"jobs": jobs},
    headers={"Authorization": f"Bearer {API_KEY}"}
)

batch = response.json()
print(f"Batch {batch.get('id')} accepted with {batch.get('acceptedCount')} certificates queued.")

Step 4: Making Certificates Verifiable

A certificate without verification is vulnerable to screenshot forgery. To ensure credibility:

  1. Mint RFC 9562 UUIDs: Use UUID v4 or v7 rather than sequential IDs (#41, #42), which leak cohort volume and allow guessing adjacent URLs.
  2. Vector QR Code Layer: jsontoimg generates native vector QR codes on the canvas, ensuring maximum scannability on both phone screens and printed paper.
  3. Public Verification Page: Host a fast public route (e.g., https://verify.example.com/c/<uuid>) that looks up the UUID in your database and validates the recipient's name, issue date, and credential status.

Contrast & Print Accessibility

Certificates are frequently printed and framed:

  • Follow WCAG 2.1 contrast minimums (4.5:1 for body copy). Avoid light grey or subtle gold text against cream backgrounds.
  • Enable auto-fitting on the recipient_name layer in J2I Studio so unusually long names automatically scale down rather than overflowing the certificate border.

Related Resources

Frequently Asked Questions

Can I generate certificates as both PNG and PDF?

Yes. Requesting "format": "pdf" outputs a vector-sharp printable document. Requesting "format": "png" or "webp" outputs an image ideal for email attachments and LinkedIn sharing.

How does jsontoimg bill batch certificates?

Each rendered certificate or PDF page costs 1 credit. Failed renders never deduct credits. Prepaid credit packs ($5 for 250 certificates, $10 for 500) never expire.

Can I use n8n or Zapier to trigger certificates?

Yes. jsontoimg provides a native n8n community node (@j2i/n8n-nodes-j2i) and standard REST endpoints that connect to Zapier, Make, and Airtable via HTTP.

Get 25 free images →
"template": "certificate-award-v2",
"format": "png",
"layers": {
"certificate_id": { "text": "CERT-2026-004218" },
"recipient_name": { "text": "Arjun Mehta" },
"course_title": { "text": "Advanced SQL for Data Analysts" },
"completion_date": { "text": "2026-08-01" }
}
}
]
}'


Your LMS or course platform already has this data — you’re just exporting a few columns. Here’s the whole pipeline in Python against a typical database:

import requests
import sqlite3

API_KEY = "YOUR_API_KEY"
TEMPLATE_ID = "certificate-award-v2"

conn = sqlite3.connect("lms.db")
rows = conn.execute("""
SELECT certificate_id, recipient_name, course_title, completion_date
FROM completions
WHERE certificate_generated = 0
""").fetchall()

jobs = [{
"template": TEMPLATE_ID,
"format": "png",
"layers": {
"certificate_id": { "text": r[0] },
"recipient_name": { "text": r[1] },
"course_title": { "text": r[2] },
"completion_date": { "text": r[3] },
},
} for r in rows[:50]]

resp = requests.post(
"https://app.jsontoimg.com/api/v1/renders/batch",
json={"jobs": jobs},
headers={"Authorization": f"Bearer {API_KEY}"},
)
batch = resp.json()
print(batch["id"], batch.get("acceptedCount"))


That’s the whole generator: select ungenerated completions → render → save. Run it after every cohort closes, or on a schedule.

## Async Delivery with Webhooks

For very large batches — an event with 10,000 attendees, a certification body with quarterly exam cycles — synchronous rendering ties up your request for too long. Use async mode with a webhook instead:

curl -X POST https://app.jsontoimg.com/api/v1/renders/batch
-H "Authorization: Bearer $JSONTOIMG_API_KEY"
-H "Content-Type: application/json"
-d '{
"jobs": [ /* max 50; each job has template + layers; optional webhookUrl per job */ ]
}'

Then GET /api/v1/renders/batches/{id}


jsontoimg calls your webhook when each batch finishes, and your app emails the certificate or updates the participant record. The typical flow:

Webhook trigger (course completion)
→ Look up participant row
→ Render certificate (sync for singles, batch for cohorts)
→ Upload to storage / attach to email
→ Mark certificate_generated = 1


## Verification: Unique IDs and QR Codes

A certificate without verification is just a nice picture. Put the `certificate_id` on the certificate itself, and optionally a QR code that resolves to a public verification page:

1.  Generate a unique ID per recipient in your database (`CERT-2026-004217`).
2.  Pass it into the render as a dynamic layer — it appears on the certificate.
3.  Publish a public endpoint: `https://verify.yoursite.com/CERT-2026-004217` shows “Valid — issued to Priya Sharma for Advanced SQL for Data Analysts.”
4.  Render the same ID as a QR code layer so employers can scan and verify instantly.

This is the same pattern event platforms use for attendee badges and [event tickets](/use-cases/event-tickets/): unique identifier in, tamper-evident image out.

Two of the choices above have published guidance behind them. For the identifier, [RFC 9562](https://datatracker.ietf.org/doc/html/rfc9562) is the current UUID specification and the reason to mint a v4 or v7 UUID rather than an incrementing integer: a sequential certificate number tells a holder how many you have issued and lets anyone guess a neighbour's URL. For legibility, [WCAG 2.1's contrast minimum](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html) applies to a certificate as much as to a web page, and a recipient name set in light grey on a cream background fails it on every copy. The format call is the last one — [MDN's image file type guide](https://developer.mozilla.org/en-US/docs/Web/Media/Guides/Formats/Image_types) covers PNG for the screen-shared version, while PDF is what survives being printed.

## Real-World Numbers

An online learning platform with 5 concurrent courses, 100 graduates each per month:

| Step | Manual | jsontoimg pipeline |
| --- | --- | --- |
| Design template | 1 designer, ~4 hours | 1 designer, ~4 hours (once) |
| Generate 500 certificates | 80–125 hours | ~2 minutes of API time |
| Error rate | Typos happen per-certificate | Zero — data in, image out |
| Delivery time | 3 days processing | Minutes after completion |
| Verification | None or manual lookup | Built-in IDs + QR |

The template cost is paid once; the marginal cost of the 501st certificate is a single API call.

## Key Takeaways

-   Certificates are a data problem, not a design problem — one template plus JSON per recipient is the whole system.
-   Batch rendering handles entire cohorts in one request; webhooks make it async for events at any scale.
-   Unique IDs and QR codes turn generated certificates into verifiable credentials.
-   The same pipeline pattern applies across use cases: product banners, OG images, tickets, welcome graphics.

## FAQ

### How do I generate hundreds of certificates at once?

One row per recipient, then `POST /api/v1/renders/batch` in chunks of 50. Five hundred certificates is ten sequential batch requests.

### Can the certificates come out as PDF instead of PNG?

Yes. Send `format: "pdf"` and a multi-page template becomes a multi-page PDF, billed one credit per page — the same as a still.

### How do I make a generated certificate verifiable?

Mint a unique ID per recipient, render it into the certificate as text, and point a QR image layer at a verification URL containing that ID. The image becomes a lookup key rather than a claim.

### Do I need a webhook for a certificate run?

For a cohort of a few dozen, waiting on the batch response is fine. Past a few hundred, pass a webhook so the run does not hold a connection open while the queue drains.

## Related Resources

-   [Building a Certificate Generator with a Template-to-Image API](/use-cases/certificates/) — the use case overview
-   [Getting Started with jsontoimg: Your First API Call](/blog/getting-started-with-jsontoimg-first-api-call/) — template basics before you build
-   [Auto-Generate Open Graph Images for Your Blog](/blog/auto-generate-og-images-with-jsontoimg) — another data-to-image pipeline
-   [Event Ticket Generation with jsontoimg](/use-cases/event-tickets/) — unique-ID patterns for per-person assets
-   [bulk certificate generation from a CSV](/blog/certificate-generator-api-guide)

Zoom out: [How JSON-to-Image Conversion Works](/blog/json-to-image-converter) maps the whole template, named-layer, and render-job architecture.

Your first 25 images are on us.

Design a template, grab an API key, and render your first PNG or PDF in minutes. No card required.