QR Codes
Generate static and dynamic QR codes for URLs, text, WiFi, vCards, and more.
POST
/api/v1/qrGenerate a new QR code. Returns the QR code as a base64-encoded image.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | Yes | QR code type: url, text, wifi, vcard, email, phone, sms |
| content | string | Yes* | The content to encode. For URLs, include the full URL with protocol. |
| data | object | Yes* | Structured data for complex types (wifi, vcard). See examples below. |
| name | string | No | A name for the QR code (for your reference) |
| isDynamic | boolean | No | Create a dynamic QR code with tracking. Default: false |
| format | string | No | Image format: png or svg. Default: png |
| size | number | No | Image size in pixels (100-2000). Default: 300 |
| design | object | No | Customization options (colors, patterns). See design options below. |
* Either content or data is required depending on the type.
Design Options
| Parameter | Type | Description |
|---|---|---|
| foregroundColor | string | Hex color for QR modules. Default: #000000 |
| backgroundColor | string | Hex color for background. Default: #ffffff |
| pattern | string | Module pattern: square, rounded, dots, classy |
| cornerStyle | string | Corner square style: square, dot, extra-rounded |
Response
200 OK
{
"success": true,
"type": "url",
"format": "png",
"dataUrl": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA...",
"qrCode": {
"id": "qr_abc123xyz",
"name": "My Website QR",
"shortCode": "aBcD1234",
"shortUrl": "https://quality-qr.app/q/aBcD1234",
"isDynamic": true
}
}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 datacURL
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"
}
}'