Generate QR Codes with a Free API (PNG & SVG)
Need QR codes in your app? The QR Code Generator API creates customizable QR codes from any text or URL. Supports PNG and SVG, custom colors, and sizes up to 2000px.
Quick Start
POST (JSON body)
curl -X POST https://qrcode-api-eight.vercel.app/api/generate \
-H "Content-Type: application/json" \
-d '{"data": "https://example.com", "size": 400}' \
--output qrcode.png
GET (query params — perfect for img tags!)
<img src="https://qrcode-api-eight.vercel.app/api/generate?data=https://example.com&size=200" />
Yes, you can use it directly in <img> tags. No JavaScript needed.
Options
| Parameter | Type | Default | Description |
|---|---|---|---|
data |
string | required | Text or URL to encode |
size |
number | 300 | Image size in pixels (100-2000) |
format |
string | "png" | png or svg |
errorCorrectionLevel |
string | "M" | L, M, Q, or H |
margin |
number | 4 | Quiet zone (0-10) |
darkColor |
string | "#000000" | Hex color for dark modules |
lightColor |
string | "#ffffff" | Hex color for light modules |
Custom Colors Example
curl -X POST https://qrcode-api-eight.vercel.app/api/generate \
-H "Content-Type: application/json" \
-d '{"data": "Hello!", "darkColor": "#1a56db", "lightColor": "#f0f4ff", "size": 500}' \
--output blue-qr.png
Python Example
import requests
response = requests.post(
"https://qrcode-api-eight.vercel.app/api/generate",
json={"data": "https://mysite.com", "format": "svg"},
)
with open("qrcode.svg", "w") as f:
f.write(response.text)
Use Cases
- Product packaging: Generate QR codes for product URLs
- Event tickets: Encode ticket IDs in scannable QR codes
- Business cards: Link to your portfolio or LinkedIn
- Restaurant menus: Link to digital menus
- Marketing: Track campaign URLs with QR codes
Try It
Available on RapidAPI with a generous free tier (200 requests/month).
Built by @ShotaTanikawa
Top comments (0)