Generate QR codes via REST API. Support for PNG, SVG, base64 output. Custom colors, sizes, and styles. Free tier available.
QR codes are everywhere in 2026 — from restaurant menus and product packaging to event tickets and digital payments. If you need to generate QR codes programmatically, doing it through a REST API is by far the most scalable and reliable approach. This complete guide shows you how to use the DevProToolkit QR Code API to generate customizable QR codes in PNG, SVG, or base64 format with a single HTTP request.
Whether you are building a SaaS product, an e-commerce platform, or an internal tool, this free QR code generator API handles everything from basic URLs to complex data payloads, with six unique visual styles and full color control.
Generate a QR code instantly — no API key needed for the playground.
Open QR Code PlaygroundA QR code API is a web service that accepts data (text, URLs, contact information, Wi-Fi credentials, etc.) and returns a rendered QR code image. Instead of using client-side libraries or desktop software, you make a simple HTTP GET request and receive the finished image in your chosen format.
The DevProToolkit QR Code API stands out because it offers:
You might wonder why you should use an API when libraries like qrcode (Python) or qrcode-terminal (Node.js) exist. Here are the key advantages of the API approach:
format=svg.Generating your first QR code takes three steps:
Here is the simplest possible request:
curl "https://api.commandsector.in/api/qr/generate?data=https://example.com" \
-H "X-API-Key: YOUR_API_KEY" \
-o qr_code.png
That is it. You now have a 300x300 pixel PNG QR code saved to qr_code.png. Every parameter beyond data is optional and has sensible defaults.
GET /api/qr/generate
Pass your API key via the X-API-Key header or as a ?api_key= query parameter.
| Parameter | Type | Default | Description |
|---|---|---|---|
data | string | required | The text, URL, or payload to encode into the QR code |
size | integer | 300 | Width and height in pixels (100–2000) |
format | string | png | Output format: png, svg, or base64 |
style | string | standard | Visual style: standard, rounded, dots, diamond, star, heart |
fg_color | string | 000000 | Foreground color as 6-digit hex (no # prefix) |
bg_color | string | ffffff | Background color as 6-digit hex (no # prefix) |
image/png binary dataimage/svg+xml textdata field containing the base64-encoded image stringThe style parameter lets you change the visual appearance of the QR code modules (the small squares that make up the pattern). Here is what each style looks like and when to use it:
The classic QR code appearance with sharp, square modules. Best for maximum scan reliability and professional/technical contexts. This is the default style.
curl "https://api.commandsector.in/api/qr/generate?data=https://example.com&style=standard" \
-H "X-API-Key: YOUR_API_KEY" -o standard.png
Modules have softly rounded corners, giving a modern and friendly look. Popular for consumer-facing applications like restaurant menus, retail, and marketing materials.
curl "https://api.commandsector.in/api/qr/generate?data=https://example.com&style=rounded" \
-H "X-API-Key: YOUR_API_KEY" -o rounded.png
Each module is rendered as a circle. Creates a distinctive, artistic appearance that works well for creative brands and design-forward products.
curl "https://api.commandsector.in/api/qr/generate?data=https://example.com&style=dots" \
-H "X-API-Key: YOUR_API_KEY" -o dots.png
Modules are rotated 45 degrees into diamond shapes. A unique look that stands out on packaging, posters, and event materials.
curl "https://api.commandsector.in/api/qr/generate?data=https://example.com&style=diamond" \
-H "X-API-Key: YOUR_API_KEY" -o diamond.png
Star-shaped modules add a playful, eye-catching quality. Great for entertainment, kids' products, loyalty programs, and seasonal promotions.
curl "https://api.commandsector.in/api/qr/generate?data=https://example.com&style=star" \
-H "X-API-Key: YOUR_API_KEY" -o star.png
Heart-shaped modules are perfect for wedding invitations, Valentine's promotions, charity campaigns, or any context where you want to convey warmth and emotion.
curl "https://api.commandsector.in/api/qr/generate?data=https://example.com&style=heart" \
-H "X-API-Key: YOUR_API_KEY" -o heart.png
PNG is the default format and works everywhere — web browsers, email, documents, and print. It is a lossless raster format, so the QR code will be sharp at its generated size. For print, generate at a higher size value (e.g., 1000 or 2000).
curl "https://api.commandsector.in/api/qr/generate?data=https://example.com&format=png&size=1000" \
-H "X-API-Key: YOUR_API_KEY" -o print_quality.png
SVG is ideal for web and print because it scales to any size without losing quality. Use SVG when you need the QR code on a billboard, in a PDF, or as part of a responsive web design.
curl "https://api.commandsector.in/api/qr/generate?data=https://example.com&format=svg" \
-H "X-API-Key: YOUR_API_KEY" -o qr_code.svg
Base64 format returns the image encoded as a string, which you can embed directly in HTML <img> tags, CSS, or JSON APIs without serving a separate file. This is particularly useful for email templates and single-page applications.
curl "https://api.commandsector.in/api/qr/generate?data=https://example.com&format=base64" \
-H "X-API-Key: YOUR_API_KEY"
The JSON response looks like:
{
"format": "base64",
"data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEU..."
}
Embed it in HTML:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEU..." alt="QR Code" />
curl "https://api.commandsector.in/api/qr/generate?data=https://mywebsite.com&size=400" \
-H "X-API-Key: YOUR_API_KEY" -o website_qr.png
curl "https://api.commandsector.in/api/qr/generate?data=WIFI:T:WPA;S:MyNetwork;P:MyPassword;;&size=400&style=rounded" \
-H "X-API-Key: YOUR_API_KEY" -o wifi_qr.png
curl "https://api.commandsector.in/api/qr/generate?data=BEGIN:VCARD%0AVERSION:3.0%0AFN:John%20Doe%0ATEL:+1234567890%0AEMAIL:john@example.com%0AEND:VCARD&style=dots&fg_color=1a1a8a" \
-H "X-API-Key: YOUR_API_KEY" -o vcard_qr.png
curl "https://api.commandsector.in/api/qr/generate?data=https://mybrand.com&style=rounded&fg_color=7b2ff7&bg_color=f5f0ff&size=500" \
-H "X-API-Key: YOUR_API_KEY" -o branded_qr.png
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.commandsector.in"
response = requests.get(f"{BASE_URL}/api/qr/generate", params={
"data": "https://example.com",
"size": 400,
"format": "png",
"style": "rounded",
"fg_color": "1a1a8a",
"bg_color": "ffffff"
}, headers={"X-API-Key": API_KEY})
if response.status_code == 200:
with open("qr_code.png", "wb") as f:
f.write(response.content)
print("QR code saved to qr_code.png")
else:
print(f"Error: {response.status_code} - {response.text}")
from flask import Flask, render_template_string
import requests
app = Flask(__name__)
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.commandsector.in"
@app.route("/ticket/<ticket_id>")
def show_ticket(ticket_id):
# Generate QR code as base64 for inline embedding
resp = requests.get(f"{BASE_URL}/api/qr/generate", params={
"data": f"https://myapp.com/verify/{ticket_id}",
"format": "base64",
"style": "rounded",
"size": 300
}, headers={"X-API-Key": API_KEY})
qr_data = resp.json()["data"]
return render_template_string("""
<h1>Your Ticket</h1>
<p>Ticket ID: {{ ticket_id }}</p>
<img src="{{ qr_data }}" alt="Ticket QR Code" />
<p>Scan this QR code at the entrance.</p>
""", ticket_id=ticket_id, qr_data=qr_data)
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.commandsector.in"
# Get SVG QR code for high-quality PDF embedding
response = requests.get(f"{BASE_URL}/api/qr/generate", params={
"data": "INV-2026-00142",
"format": "svg",
"style": "standard",
"size": 200
}, headers={"X-API-Key": API_KEY})
with open("invoice_qr.svg", "w") as f:
f.write(response.text)
print("SVG QR code saved - embed in your PDF generator")
const fs = require('fs');
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.commandsector.in';
async function generateQR(data, filename, options = {}) {
const params = new URLSearchParams({
data,
size: options.size || 300,
format: options.format || 'png',
style: options.style || 'standard',
fg_color: options.fgColor || '000000',
bg_color: options.bgColor || 'ffffff',
});
const response = await fetch(`${BASE_URL}/api/qr/generate?${params}`, {
headers: { 'X-API-Key': API_KEY }
});
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
const buffer = Buffer.from(await response.arrayBuffer());
fs.writeFileSync(filename, buffer);
console.log(`QR code saved to ${filename}`);
}
// Generate a branded QR code
generateQR('https://myshop.com/product/42', 'product_qr.png', {
style: 'rounded',
fgColor: '7b2ff7',
size: 500
});
async function showQRCode(text, imgElementId) {
const params = new URLSearchParams({
data: text,
format: 'base64',
style: 'rounded',
size: 300
});
const response = await fetch(
`https://api.commandsector.in/api/qr/generate?${params}`,
{ headers: { 'X-API-Key': 'YOUR_API_KEY' } }
);
const result = await response.json();
document.getElementById(imgElementId).src = result.data;
}
// Usage
showQRCode('https://example.com', 'qr-image');
import { useState, useEffect } from 'react';
function QRCode({ data, style = 'rounded', size = 250, fgColor = '000000' }) {
const [src, setSrc] = useState('');
useEffect(() => {
const params = new URLSearchParams({
data,
format: 'base64',
style,
size: String(size),
fg_color: fgColor,
});
fetch(`https://api.commandsector.in/api/qr/generate?${params}`, {
headers: { 'X-API-Key': process.env.REACT_APP_API_KEY }
})
.then(res => res.json())
.then(json => setSrc(json.data))
.catch(console.error);
}, [data, style, size, fgColor]);
if (!src) return <div>Loading QR code...</div>;
return <img src={src} alt="QR Code" width={size} height={size} />;
}
// Usage: <QRCode data="https://example.com" style="dots" fgColor="7b2ff7" />
Need to generate hundreds of QR codes at once? You can easily script batch generation. Here is a Python example that generates QR codes for a list of URLs:
import requests
import time
import os
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.commandsector.in"
urls = [
"https://example.com/product/1",
"https://example.com/product/2",
"https://example.com/product/3",
"https://example.com/product/4",
"https://example.com/product/5",
]
os.makedirs("qr_codes", exist_ok=True)
for i, url in enumerate(urls):
response = requests.get(f"{BASE_URL}/api/qr/generate", params={
"data": url,
"size": 400,
"style": "rounded",
"format": "png"
}, headers={"X-API-Key": API_KEY})
if response.status_code == 200:
filename = f"qr_codes/product_{i+1}.png"
with open(filename, "wb") as f:
f.write(response.content)
print(f"Generated: {filename}")
else:
print(f"Failed for {url}: {response.status_code}")
# Respect rate limits (free tier: 10 requests/minute)
time.sleep(6)
print(f"Done! Generated {len(urls)} QR codes.")
For large batches on the Pro tier (100 requests/minute), you can use asyncio with aiohttp for concurrent generation:
import asyncio
import aiohttp
import os
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.commandsector.in"
CONCURRENCY = 10 # parallel requests
async def generate_qr(session, semaphore, data, filename):
async with semaphore:
params = {
"data": data,
"size": 400,
"style": "rounded",
"format": "png"
}
async with session.get(
f"{BASE_URL}/api/qr/generate",
params=params,
headers={"X-API-Key": API_KEY}
) as resp:
if resp.status == 200:
content = await resp.read()
with open(filename, "wb") as f:
f.write(content)
print(f"Generated: {filename}")
async def main():
urls = [f"https://example.com/item/{i}" for i in range(1, 101)]
os.makedirs("qr_batch", exist_ok=True)
semaphore = asyncio.Semaphore(CONCURRENCY)
async with aiohttp.ClientSession() as session:
tasks = [
generate_qr(session, semaphore, url, f"qr_batch/item_{i+1}.png")
for i, url in enumerate(urls)
]
await asyncio.gather(*tasks)
asyncio.run(main())
The fg_color and bg_color parameters accept any valid 6-digit hex color code (without the # prefix). Here are some popular combinations:
| Use Case | fg_color | bg_color | Description |
|---|---|---|---|
| Classic | 000000 | ffffff | Black on white (highest contrast) |
| Brand Purple | 7b2ff7 | f5f0ff | Purple on light lavender |
| Dark Mode | ffffff | 1a1a2e | White on dark blue |
| Corporate Blue | 0052cc | e6f0ff | Blue on light blue |
| Success Green | 006644 | e6fff2 | Green on light mint |
| Warm Red | cc0000 | fff0f0 | Red on blush |
Tip: Always maintain strong contrast between foreground and background colors. Low-contrast QR codes may fail to scan reliably. The classic black-on-white combination offers the best scan rates across all devices and lighting conditions.
Generate unique QR codes for every product page, linking customers to reviews, specifications, or reorder pages. Use the rounded style with brand colors for a polished look on packaging.
Create scannable tickets with unique QR codes per attendee. The base64 format is ideal for embedding QR codes directly in confirmation emails without hosting image files.
Replace physical menus with QR codes that link to your digital menu. The dots or rounded style adds a modern aesthetic to table cards.
Encode tracking numbers, warehouse locations, or product serial numbers. The standard style provides maximum scan reliability for industrial scanners.
Generate QR codes for payment links (PayPal, Stripe, UPI) with the payment URL as the data payload. Dynamically create QR codes for each transaction amount.
Encode vCard data so contacts can save your information with a single scan. The diamond style makes your card stand out.
| Plan | Requests / Day | Rate Limit | Price |
|---|---|---|---|
| Free | 100 | 10 / minute | $0 / month |
| Pro | 10,000 | 100 / minute | $9.99 / month |
| Enterprise | Unlimited | Custom | Contact us |
The free tier is generous enough for personal projects, prototyping, and low-traffic applications. No credit card is required to sign up. Get your free API key here.
You can encode any text string up to approximately 2,500 characters. Common payloads include URLs, email addresses, phone numbers, Wi-Fi credentials (using the WIFI: format), vCard contact information, plain text messages, and geographic coordinates.
The API supports sizes from 100 to 2,000 pixels. For print applications, we recommend 1,000 pixels or higher. For web use, 200–400 pixels is typically sufficient. For unlimited resolution, use the SVG format.
Yes. The free tier provides 100 QR code generations per day with no credit card required. Sign up at /signup and start generating immediately.
The standard style offers the highest scan reliability across all devices and scanner apps. The rounded style is a close second. More decorative styles like star and heart may require slightly better lighting or camera focus, but modern smartphone cameras handle all styles well.
You can test the API in our QR Code Playground without any API key (limited to 5 requests per minute). For production use, you will need a free API key.
For batch generation, make multiple requests to the standard endpoint. On the Pro tier, you can make up to 100 requests per minute, allowing you to generate thousands of QR codes efficiently with concurrent requests. See the batch generation section above for code examples.
No. The QR codes themselves are static images — they encode data directly and do not depend on our servers to function. Once generated, the QR code works forever. The data encoded (such as a URL) may change, but that is independent of the QR code image.
Yes. QR codes generated through our API can be used for any commercial purpose — on products, marketing materials, invoices, tickets, and more. There are no licensing restrictions on the output images.
curl "https://api.commandsector.in/api/qr/generate?data=https://example.com&size=300" \
-H "X-API-Key: YOUR_API_KEY" -o qr.png
import requests
response = requests.get("https://api.commandsector.in/api/qr/generate", params={
"data": "https://example.com",
"size": 300,
"format": "png"
}, headers={"X-API-Key": "YOUR_API_KEY"})
with open("qr.png", "wb") as f:
f.write(response.content)
const response = await fetch(
`https://api.commandsector.in/api/qr/generate?data=https://example.com&size=300`,
{ headers: { 'X-API-Key': 'YOUR_API_KEY' } }
);
const blob = await response.blob();
Get a free API key with 100 requests/day. No credit card required.
Get Free API Key