QR Code Generator

QR Code Generator API

Marketing

Create custom QR codes instantly from URLs, text, or contact info. Download as PNG with full customization of size and colors.

Authentication

All API requests require a valid API key passed in the Authorization header as a Bearer token.

Rate Limit

60 requests per minute

Endpoints

2 endpoints available

Overview

The QR Code Generator API creates customizable QR codes programmatically. Generate QR codes for URLs, plain text, contact information, WiFi credentials, and more with full control over size, colors, and format.

Supported Data Types

  • URL - Website links that open in the browser
  • Text - Plain text messages
  • vCard - Contact information cards
  • WiFi - WiFi network credentials for easy connection
  • Email - Pre-filled email composition
  • SMS - Pre-filled text messages
  • Phone - Phone numbers for quick dialing

Output Formats

The API can return QR codes in multiple formats:

  • png - PNG image (default)
  • svg - Scalable vector graphics
  • base64 - Base64-encoded image data

Use Cases

  • Generate QR codes for product packaging and labels
  • Create dynamic QR codes for marketing campaigns
  • Automate business card QR code generation
  • Build QR code functionality into your own applications

Endpoints

POST
/v1/tools/qr-code-generator
Generate a QR code with custom settings

Request Body

Content-Type: application/json

ParameterTypeRequiredDescription
data
string
Required
The data to encode in the QR code (URL, text, etc.)
type
string
Enum: url, text, vcard, wifi, email, sms, phone
OptionalThe type of data being encodedDefault: url
size
number
OptionalSize of the QR code in pixels (width and height)Default: 256
foregroundColor
string
OptionalForeground color in hex formatDefault: #000000
backgroundColor
string
OptionalBackground color in hex formatDefault: #FFFFFF
format
string
Enum: png, svg, base64
OptionalOutput format for the QR codeDefault: png
errorCorrection
string
Enum: L, M, Q, H
OptionalError correction levelDefault: M
margin
number
OptionalQuiet zone margin around the QR code (in modules)Default: 4

Response Example

{
  "success": true,
  "qrCode": {
    "data": "https://example.com",
    "format": "base64",
    "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
    "size": 256,
    "type": "url"
  }
}

Error Codes

400
Invalid request body, missing data, or invalid parameters
401
Missing or invalid API key
413
Data too large to encode in QR code
429
Rate limit exceeded
500
Internal server error
POST
/v1/tools/qr-code-generator/wifi
Generate a WiFi QR code with structured parameters

Request Body

Content-Type: application/json

ParameterTypeRequiredDescription
ssid
string
Required
WiFi network name
password
string
OptionalWiFi password (omit for open networks)
encryption
string
Enum: WPA, WEP, nopass
OptionalEncryption typeDefault: WPA
hidden
boolean
OptionalWhether the network is hiddenDefault: false
size
number
OptionalSize of the QR code in pixelsDefault: 256

Response Example

{
  "success": true,
  "qrCode": {
    "data": "WIFI:T:WPA;S:MyNetwork;P:MyPassword;;",
    "format": "base64",
    "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
    "size": 256,
    "type": "wifi"
  }
}

Error Codes

400
Invalid request body or missing SSID
401
Missing or invalid API key
429
Rate limit exceeded

Code Examples

# Generate a basic URL QR code
curl -X POST https://api.opentools.ca/v1/tools/qr-code-generator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "data": "https://example.com",
    "size": 512,
    "foregroundColor": "#1a1a1a",
    "format": "base64"
  }'

# Generate a WiFi QR code
curl -X POST https://api.opentools.ca/v1/tools/qr-code-generator/wifi \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "ssid": "MyNetwork",
    "password": "MyPassword",
    "encryption": "WPA"
  }'

Ready to get started?

Create an API key to start using the QR Code Generator API.