DEV Community

Mark Turner
Mark Turner

Posted on

A Production-Ready QR Code API for Real-World Apps

The problem with generating QR codes yourself

QR codes quietly become a requirement in many systems

Marketing material. Posters. Product packaging. Event check-ins. Mobile onboarding. Payment links.

And every time, it starts simple… until it isn’t.

You need consistent output, proper error correction, sizing control, branding, and predictable formats — all without pulling in heavy libraries or custom image pipelines.

So I decided to turn that recurring problem into a reusable API.


The problem with rolling your own QR generator

Generating a QR code is easy.

Generating production-ready QR codes consistently across systems is not.

At scale, you start dealing with:

  • Image format handling (PNG / SVG)
  • Error-correction levels
  • Output sizing and margins
  • Branding and logo overlays
  • Color contrast and scan reliability
  • API authentication and rate limits

Why maintain QR-generation logic when you can use a clean API?


Enter myapi.rest

myapi.rest is a unified API platform that bundles common developer utilities behind one REST interface.

One of those utilities is a QR Code Generation API designed for real-world, production use.

Key features

  • High-quality QR output (PNG / SVG)
  • Full control over size, margins, and colors
  • Error-correction level selection
  • Optional logo embedding
  • API key–based authentication
  • Clean JSON responses

Generating a QR code via API

Here’s what generating a QR code looks like.

POST

curl --location 'https://api.myapi.rest/api/qrcode/generate' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API_KEY>' \
--data '{
  "data": "https://marquis.it.com",
  "output_format": "PNG",
  "pixels_per_module": 20,
  "margin": 0,
  "ecc_level": "H",
  "dark_color_hex": "#000000",
  "light_color_hex": "#FFFFFF",
  "draw_quiet_zones": true,
  "image_base64": "",
  "logo_size_percent": 20
}'
Enter fullscreen mode Exit fullscreen mode

Response

{
  "id": 5,
  "qrcode": "<BASE_64_DATA>"
}
Enter fullscreen mode Exit fullscreen mode

The response returns a Base64-encoded image, making it easy to:

  • Save directly to disk
  • Embed into HTML
  • Attach to emails
  • Push into PDFs or print pipelines

No temporary URLs. No extra hops.


Designed for real-world use cases:

  • Marketing campaigns and print runs
  • Dynamic QR generation from backend systems
  • Branded QR codes with logos
  • High-volume batch generation
  • Automated workflows and CI pipelines

Why I built it

After years of backend and SaaS development, I noticed the same pattern repeating:

Teams keep rebuilding small but critical utilities — QR codes, short URLs, tokens, image handling — over and over again.

Most don’t need custom implementations.

They need reliable, focused, well-designed APIs.

So instead of rebuilding QR logic yet again, I turned it into a service others can use.

Give it a test at myapi.rest


What’s next

The QR Code API is just one part of the platform.

Other APIs include URL shorteners, barcodes, image hosting, tokens, and chat-flow logic — all behind the same REST interface, with more being added regularly. Suggestions are always welcome.

If you’re interested, feedback from other devs is always welcome 👋

Top comments (0)