Generate QR Codes Programmatically: A Complete Guide
QR codes are everywhere โ restaurant menus, product packaging, event tickets, business cards. In this guide, you'll learn how to generate custom QR codes programmatically using a simple API.
Why Generate QR Codes via API?
Client-side QR code libraries work fine for simple cases, but an API is better when:
- You need server-side generation (e.g., PDF invoices with embedded QR codes)
- You want consistent output across platforms
- You need SVG format for print-quality output
- You're generating thousands of codes in batch
Quick Start
Get a free API key and start generating:
curl "https://tools.f5rvoice.com/api/v1/qr?data=https://example.com&apikey=YOUR_KEY" -o qr.png
That's it! One line, one QR code.
Customization Options
| Parameter | Default | Description |
|---|---|---|
data |
required | The content to encode (max 2000 chars) |
size |
300 | Image size in pixels (50โ2000) |
format |
png | png or svg |
dark |
000000 | Dark module color (hex) |
light |
ffffff | Light/background color (hex) |
Custom Branded QR Code
curl "https://tools.f5rvoice.com/api/v1/qr?data=https://mystore.com&size=500&dark=8b5cf6&light=0a0a0f&format=svg&apikey=YOUR_KEY" -o branded.svg
Python โ Generate QR for WiFi
import requests
wifi_data = "WIFI:T:WPA;S:MyNetwork;P:MyPassword;;"
response = requests.get("https://tools.f5rvoice.com/api/v1/qr", params={
"data": wifi_data,
"size": 400,
"apikey": "YOUR_KEY"
})
with open("wifi_qr.png", "wb") as f:
f.write(response.content)
Node.js โ Generate QR for vCard
const vcard = `BEGIN:VCARD
VERSION:3.0
FN:John Doe
TEL:+1234567890
EMAIL:[email protected]
END:VCARD`;
const response = await fetch(
`https://tools.f5rvoice.com/api/v1/qr?data=${encodeURIComponent(vcard)}&size=500&apikey=YOUR_KEY`
);
Real-World Use Cases
- E-commerce โ QR codes on invoices linking to order tracking
- Event tickets โ Unique QR per attendee for check-in scanning
- Restaurant menus โ Dynamic QR codes linking to your latest menu
- Business cards โ vCard QR codes for instant contact sharing
- Product packaging โ Link to manuals, warranty registration, or reviews
- Marketing โ Track campaign performance with unique QR URLs
SVG vs PNG
- Use PNG for digital displays, emails, and web pages
- Use SVG for print materials โ infinitely scalable, no pixelation
Conclusion
Our QR Code API makes it trivial to generate custom-branded, high-quality QR codes in any language. Whether you're building a ticketing system or a restaurant menu app, one API call is all you need.
Ready to try WebTools API?
Get 100 free requests per month. No credit card required.
Get Free API Key โ