Free QR Code API - Generate QR Codes Programmatically in 2026

Published Feb 20, 2026 · API Guide · 5 min read

Generate QR codes via REST API. Support for PNG, SVG, base64 output. Custom colors, sizes, and styles. Free tier available.

Try it Now - No API Key Required

Test this API instantly in your browser

Open API Playground

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.

Try It Right Now

Generate a QR code instantly — no API key needed for the playground.

Open QR Code Playground

What Is a QR Code API?

A 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:

Why Generate QR Codes via API Instead of a Library?

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:

Getting Started in 60 Seconds

Generating your first QR code takes three steps:

  1. Get a free API key — Sign up at /signup (instant, no credit card)
  2. Make a GET request to the endpoint with your data
  3. Receive the QR code image in your chosen format

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.

API Reference & Parameters

Endpoint

GET /api/qr/generate

Authentication

Pass your API key via the X-API-Key header or as a ?api_key= query parameter.

Parameters

ParameterTypeDefaultDescription
datastringrequiredThe text, URL, or payload to encode into the QR code
sizeinteger300Width and height in pixels (100–2000)
formatstringpngOutput format: png, svg, or base64
stylestringstandardVisual style: standard, rounded, dots, diamond, star, heart
fg_colorstring000000Foreground color as 6-digit hex (no # prefix)
bg_colorstringffffffBackground color as 6-digit hex (no # prefix)

Response

All 6 QR Code Styles Explained

The 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:

1. Standard

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

2. Rounded

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

3. Dots

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

4. Diamond

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

5. Star

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

6. Heart

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

Output Formats: PNG, SVG, and Base64

PNG (Raster Image)

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 (Vector Image)

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 (Inline Embedding)

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 Examples for Common Scenarios

Generate a URL 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

Generate a Wi-Fi QR Code

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

Generate a vCard QR Code

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

Custom Branded QR Code

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

Python Integration

Basic QR Code Generation

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}")

Generate and Embed as Base64 in a Web App (Flask)

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)

Generate SVG for PDF Reports (with ReportLab)

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")

JavaScript / Node.js Integration

Node.js — Save QR Code to File

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
});

Browser — Display QR Code on a Web Page

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');

React Component

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" />

Batch QR Code Generation

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())

Advanced Customization & Colors

The fg_color and bg_color parameters accept any valid 6-digit hex color code (without the # prefix). Here are some popular combinations:

Use Casefg_colorbg_colorDescription
Classic000000ffffffBlack on white (highest contrast)
Brand Purple7b2ff7f5f0ffPurple on light lavender
Dark Modeffffff1a1a2eWhite on dark blue
Corporate Blue0052cce6f0ffBlue on light blue
Success Green006644e6fff2Green on light mint
Warm Redcc0000fff0f0Red 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.

Real-World Use Cases

E-Commerce & Retail

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.

Event Management

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.

Restaurant & Hospitality

Replace physical menus with QR codes that link to your digital menu. The dots or rounded style adds a modern aesthetic to table cards.

Logistics & Inventory

Encode tracking numbers, warehouse locations, or product serial numbers. The standard style provides maximum scan reliability for industrial scanners.

Digital Payments

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.

Business Cards

Encode vCard data so contacts can save your information with a single scan. The diamond style makes your card stand out.

Pricing & Rate Limits

PlanRequests / DayRate LimitPrice
Free10010 / minute$0 / month
Pro10,000100 / minute$9.99 / month
EnterpriseUnlimitedCustomContact 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.

Frequently Asked Questions

What data can I encode in a QR code?

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.

What is the maximum QR code size?

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.

Can I use this API for free?

Yes. The free tier provides 100 QR code generations per day with no credit card required. Sign up at /signup and start generating immediately.

Which QR code style has the best scan reliability?

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.

Can I generate QR codes without an API key?

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.

Is there a batch generation endpoint?

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.

Do the QR codes expire?

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.

Can I use generated QR codes commercially?

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.

Quick Start - Code Examples

cURL

curl "https://api.commandsector.in/api/qr/generate?data=https://example.com&size=300" \
  -H "X-API-Key: YOUR_API_KEY" -o qr.png

Python

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)

JavaScript (Node.js)

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();

Start Using This API Today

Get a free API key with 100 requests/day. No credit card required.

Get Free API Key