QR Code API
Generate QR codes via a simple GET request. All parameters are passed as URL query strings.
Endpoint
GET /api/qr?data=<content>Parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
data | Yes | — | The content to encode in the QR code (URL, text, etc.) |
version | No | auto | QR version (1–40). Controls symbol size. 'auto' picks the smallest version that fits the data. |
ec | No | auto | Error correction level: 'L' (7%), 'M' (15%), 'Q' (25%), 'H' (30%). 'auto' defaults to 'M'. |
mask | No | auto | Data mask pattern (0–7). 'auto' lets the encoder choose the optimal mask. |
dark | No | #000000 | Hex color for dark modules (use %23 for # in URLs, e.g. %23000000). |
light | No | #ffffff | Hex color for light modules (use %23 for # in URLs, e.g. %23ffffff). |
margin | No | 2 | Quiet zone size in modules (0–32). |
scale | No | 8 | Pixels per module (1–128). Determines output resolution. |
format | No | png | Output image format: 'png', 'svg', 'jpeg', or 'webp'. |
download | No | false | Set to 'true' to trigger a file download. When 'false' the image is displayed inline in the browser. |
invert | No | false | Set to 'true' to swap the dark and light colors, creating a light-on-dark QR code. |
Examples
Basic — preview in browser
/api/qr?data=https://example.comDownload as PNG
/api/qr?data=https://example.com&download=trueSVG output
/api/qr?data=Hello%20World&format=svgCustom colors & high error correction
/api/qr?data=https://example.com&dark=%231e3a5f&light=%23f0f4f8&ec=HSpecific version & scale
/api/qr?data=Test&version=5&scale=16&margin=4WiFi QR (pre-encoded data string)
/api/qr?data=WIFI:T:WPA;S:MyNetwork;P:secret123;;Notes
- Colors use hex format. In URLs, encode
#as%23(e.g.dark=%23ff0000). - When
download=false(the default), the image is served inline so browsers display it directly. - When
download=true, theContent-Dispositionheader triggers a file download. - Responses include
Cache-Control: public, max-age=86400for efficient caching.