QR Codes

Generate static and dynamic QR codes for URLs, text, WiFi, vCards, and more.

POST/api/v1/qr

Generate a new QR code. Returns the QR code as a base64-encoded image.

Request Body

ParameterTypeRequiredDescription
typestringYesQR code type: url, text, wifi, vcard, email, phone, sms
contentstringYes*The content to encode. For URLs, include the full URL with protocol.
dataobjectYes*Structured data for complex types (wifi, vcard). See examples below.
namestringNoA name for the QR code (for your reference)
isDynamicbooleanNoCreate a dynamic QR code with tracking. Default: false
formatstringNoImage format: png or svg. Default: png
sizenumberNoImage size in pixels (100-2000). Default: 300
designobjectNoCustomization options (colors, patterns). See design options below.

* Either content or data is required depending on the type.

Design Options

ParameterTypeDescription
foregroundColorstringHex color for QR modules. Default: #000000
backgroundColorstringHex color for background. Default: #ffffff
patternstringModule pattern: square, rounded, dots, classy
cornerStylestringCorner square style: square, dot, extra-rounded

Response

Basic response (without saving):

200 OK
{
  "success": true,
  "type": "url",
  "format": "png",
  "dataUrl": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA..."
}

Response with name or isDynamic: true (saves to dashboard):

200 OK
{
  "success": true,
  "type": "url",
  "format": "png",
  "dataUrl": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA...",
  "qrCode": {
    "id": "abc123xyz",
    "name": "My Website QR",
    "shortCode": "aBcD1234",
    "shortUrl": "https://quality-qr.app/q/aBcD1234"
  }
}

Note: When you provide name or set isDynamic: true, the QR code is saved to your dashboard and counts toward your plan limit. The qrCode object is only included in the response when the QR code is saved.

Examples

URL QR Code

Create a QR code that links to a URL.

Request
{
  "type": "url",
  "content": "https://example.com/landing-page",
  "name": "Landing Page QR",
  "isDynamic": true
}

WiFi QR Code

Create a QR code that connects to a WiFi network.

Request
{
  "type": "wifi",
  "data": {
    "ssid": "MyNetwork",
    "password": "secretpassword",
    "encryption": "WPA"
  },
  "name": "Office WiFi"
}

vCard QR Code

Create a QR code that adds a contact.

Request
{
  "type": "vcard",
  "data": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@example.com",
    "phone": "+1234567890",
    "company": "Acme Inc",
    "title": "CEO",
    "website": "https://example.com"
  },
  "name": "John's Contact Card"
}

Custom Design

Create a branded QR code with custom colors and patterns.

Request
{
  "type": "url",
  "content": "https://example.com",
  "name": "Branded QR",
  "size": 500,
  "design": {
    "foregroundColor": "#1a1a2e",
    "backgroundColor": "#eaeaea",
    "pattern": "rounded",
    "cornerStyle": "dot"
  }
}

Full Code Examples

JavaScript / TypeScript

JavaScript
async function generateQRCode() {
  const response = await fetch('https://quality-qr.app/api/v1/qr', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.QUALITY_QR_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      type: 'url',
      content: 'https://example.com',
      name: 'My QR Code',
      isDynamic: true,
      design: {
        foregroundColor: '#000000',
        backgroundColor: '#ffffff',
        pattern: 'rounded',
      },
    }),
  });

  if (!response.ok) {
    throw new Error(`API error: ${response.status}`);
  }

  const data = await response.json();

  // data.dataUrl contains the base64-encoded image
  // data.qrCode.shortUrl is the trackable short URL (if isDynamic: true)

  return data;
}

Python

Python
import os
import requests
import base64

def generate_qr_code():
    response = requests.post(
        'https://quality-qr.app/api/v1/qr',
        headers={
            'Authorization': f'Bearer {os.environ["QUALITY_QR_API_KEY"]}',
            'Content-Type': 'application/json',
        },
        json={
            'type': 'url',
            'content': 'https://example.com',
            'name': 'My QR Code',
            'isDynamic': True,
            'design': {
                'foregroundColor': '#000000',
                'backgroundColor': '#ffffff',
                'pattern': 'rounded',
            },
        }
    )

    response.raise_for_status()
    data = response.json()

    # Save the QR code image
    if data['success']:
        image_data = data['dataUrl'].split(',')[1]
        with open('qrcode.png', 'wb') as f:
            f.write(base64.b64decode(image_data))

    return data

cURL

cURL
curl -X POST https://quality-qr.app/api/v1/qr \
  -H "Authorization: Bearer $QUALITY_QR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "url",
    "content": "https://example.com",
    "name": "My QR Code",
    "isDynamic": true,
    "design": {
      "foregroundColor": "#000000",
      "backgroundColor": "#ffffff",
      "pattern": "rounded"
    }
  }'