
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 graphicsbase64- 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-generatorGenerate a QR code with custom settings
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| data | string | Required | The data to encode in the QR code (URL, text, etc.) |
| type | string Enum: url, text, vcard, wifi, email, sms, phone | Optional | The type of data being encodedDefault: url |
| size | number | Optional | Size of the QR code in pixels (width and height)Default: 256 |
| foregroundColor | string | Optional | Foreground color in hex formatDefault: #000000 |
| backgroundColor | string | Optional | Background color in hex formatDefault: #FFFFFF |
| format | string Enum: png, svg, base64 | Optional | Output format for the QR codeDefault: png |
| errorCorrection | string Enum: L, M, Q, H | Optional | Error correction levelDefault: M |
| margin | number | Optional | Quiet 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 parameters401
Missing or invalid API key413
Data too large to encode in QR code429
Rate limit exceeded500
Internal server errorPOST
/v1/tools/qr-code-generator/wifiGenerate a WiFi QR code with structured parameters
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| ssid | string | Required | WiFi network name |
| password | string | Optional | WiFi password (omit for open networks) |
| encryption | string Enum: WPA, WEP, nopass | Optional | Encryption typeDefault: WPA |
| hidden | boolean | Optional | Whether the network is hiddenDefault: false |
| size | number | Optional | Size 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 SSID401
Missing or invalid API key429
Rate limit exceededCode 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"
}'