โ† Back to Blog

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:

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

  1. E-commerce โ€” QR codes on invoices linking to order tracking
  2. Event tickets โ€” Unique QR per attendee for check-in scanning
  3. Restaurant menus โ€” Dynamic QR codes linking to your latest menu
  4. Business cards โ€” vCard QR codes for instant contact sharing
  5. Product packaging โ€” Link to manuals, warranty registration, or reviews
  6. Marketing โ€” Track campaign performance with unique QR URLs

SVG vs PNG

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.

Get started free โ†’

Ready to try WebTools API?

Get 100 free requests per month. No credit card required.

Get Free API Key โ†’