HomeGuides › QR Code Generator API: One GET Request, Three Formats

QR Code Generator API: One GET Request, Three Formats

Generating QR codes server-side normally means bundling an image library into your app.

One GET request returns the code in your choice of three formats: binary PNG, scalable SVG markup, or a data URI ready for an img tag.

Quick start

format is png, svg, or dataURI. PNG returns image bytes you can serve directly; SVG returns markup that scales losslessly at any size.

curl (SVG)
curl "https://qr-code-generator216.p.rapidapi.com/generate?data=https://example.com&format=svg" \
  -H "X-RapidAPI-Key: YOUR_KEY" \
  -H "X-RapidAPI-Host: qr-code-generator216.p.rapidapi.com"

Embed without a download

JavaScript (data URI)
const res = await fetch(
  "https://qr-code-generator216.p.rapidapi.com/generate?data=https://example.com&format=dataURI",
  { headers: {
      "X-RapidAPI-Key": "YOUR_KEY",
      "X-RapidAPI-Host": "qr-code-generator216.p.rapidapi.com",
  } }
);
const { dataURI } = await res.json();
document.querySelector("#qr").src = dataURI; // <img id="qr">

POST for long payloads

POST /generate with a JSON body handles URLs or text too long for a query string.

Sizing, colors, and error correction

size sets the pixel width, margin sets the quiet zone, dark and light take hex colors, and errorCorrectionLevel (L, M, Q, H) controls resilience; higher levels survive logos and partial damage.

Run it in production

QR Code Generator has a permanent free tier — 1,000 requests a month, no credit card. Paid plans start at $5/month for 100,000 requests.

Get a free API key on RapidAPI ↗

Full endpoint reference →

FAQ

What is the maximum data length for a QR code?

The QR specification sets the limit; the service picks the appropriate QR version automatically based on your payload.

Can I customize the colors?

Yes. The dark and light parameters take hex colors for the foreground and background.

Are generated QR codes free to use commercially?

Yes. QR codes carry no licensing restrictions.