Documentation
Everything you need to integrate QR API into your application
Quick Start
Get Your API Key
Your First Request
Generate a QR code in 30 seconds
curl -X POST https://api.qrapi.com/v1/qr/generate \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data": "https://example.com",
"enableAnalytics": true
}'Request Parameters
Complete Parameter Reference
All available parameters for generating QR codes with their types, constraints, and default values.
Required Parameters
datarequiredstringThe content to encode in the QR code (URL, text, WiFi credentials, etc.)
Constraints: 1-2000 characters
"data": "https://example.com"stylerequiredobjectQR code visual styling configuration
shape: "square" | "dots" | "rounded" | "extra-rounded"
eyeStyle: "square" | "dot" | "rounded"
backgroundColor: string (hex color, e.g., "#ffffff")
foregroundColor: string (hex color, e.g., "#000000")
gradientType: "linear" | "radial" (optional)
gradientColors: string[] (2-5 hex colors, optional)
Optional Parameters
sizeoptionalnumberQR code size in pixels (width and height)
Default: 512 | Range: 200-2000
formatoptionalstringOutput file format
Values: "PNG" (default) | "SVG" | "PDF"
errorCorrectionoptionalstringError correction level (higher = more damage tolerance, larger size)
Values: "L" (7%) | "M" (15%) | "Q" (25%) | "H" (30%, default)
logooptionalobjectLogo to overlay in the center of the QR code
url: string (public URL to logo image)
size: number (10-30, percentage of QR size, default: 20)
removeBackground: boolean (optional, removes transparent background)
enableAnalyticsoptionalbooleanEnable scan tracking and analytics (requires PRO plan for full features)
Default: false
nameoptionalstringCustom name for the QR code (for organization in dashboard)
Max length: 100 characters
tagsoptionalstring[]Tags for categorizing and filtering QR codes
"tags": ["campaign", "2024", "promo"]expiresAtoptionalstringISO 8601 datetime when the QR code should expire
"expiresAt": "2025-12-31T23:59:59Z"Complete Example Request
Example with all available parameters
{
"data": "https://example.com",
"size": 512,
"format": "PNG",
"style": {
"shape": "rounded",
"eyeStyle": "rounded",
"backgroundColor": "#ffffff",
"foregroundColor": "#000000",
"gradientType": "linear",
"gradientColors": ["#667eea", "#764ba2"]
},
"logo": {
"url": "https://example.com/logo.png",
"size": 20,
"removeBackground": true
},
"errorCorrection": "H",
"enableAnalytics": true,
"name": "My Campaign QR",
"tags": ["campaign", "2024"],
"expiresAt": "2025-12-31T23:59:59Z"
}Authentication
All API requests require authentication using an API key passed in the X-API-Key header.
X-API-Key: qr_live_your_api_key_hereAPI keys have the format qr_live_* for production and qr_test_* for development.
Rate Limits
Limits by Plan
- Free: 100 requests/hour
- Starter: 1,000 requests/hour
- Pro: 10,000 requests/hour
- Enterprise: Unlimited
Response Headers
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 87
X-RateLimit-Reset: 1697454000429 Error
When rate limit is exceeded, you'll receive a 429 status code with a Retry-After header indicating when you can retry.
Generate QR Code
/v1/qr/generateGenerate a static QR code
For complete API documentation with all endpoints and parameters, visit our Swagger API Reference or explore it directly here.
Dynamic QR Codes
What are Dynamic QR Codes?
Dynamic QR codes allow you to change the destination URL without regenerating the QR code image.
Use Cases
- Marketing campaigns with changing URLs
- Event tickets with dynamic content
- Product launches with multiple landing pages
- Time-sensitive promotions
/v1/qr/dynamicCreate a dynamic QR code
curl -X POST https://api.qrapi.com/v1/qr/dynamic \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data": "Campaign QR",
"destinationUrl": "https://example.com/promo",
"enableAnalytics": true
}'/v1/qr/{id}Update destination URL
curl -X PATCH https://api.qrapi.com/v1/qr/QR_CODE_ID \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"destinationUrl": "https://example.com/new-promo"
}'Analytics
Track QR Code Scans
Get detailed analytics about who scanned your QR codes, when, and from where.
Available Metrics
- Total scans and unique scans
- Scans by country and city
- Scans by device (mobile, tablet, desktop)
- Scans by operating system
- Timeline of scans
/v1/qr/{qrCodeId}/analytics?days=30Get analytics for a QR code
curl -X GET \
"https://api.qrapi.com/v1/qr/QR_CODE_ID/analytics?days=30" \
-H "X-API-Key: YOUR_API_KEY"Templates
Pre-built QR Code Templates
Use our pre-designed templates for common use cases to get started quickly.
Available Categories
- BUSINESS - Professional business cards
- RESTAURANT - Menu QR codes
- EVENT - Event tickets and invitations
- SOCIAL - Social media links
- PAYMENT - Payment and donation QR codes
- WIFI - WiFi access sharing
/v1/templates?category=BUSINESSList available templates
curl -X GET \
"https://api.qrapi.com/v1/templates?category=BUSINESS" \
-H "X-API-Key: YOUR_API_KEY"Browse all templates in our interactive template gallery.
Code Examples
Node.js / TypeScript
import fetch from 'node-fetch';
const API_KEY = 'qr_live_your_api_key';
const BASE_URL = 'https://api.qrapi.com/v1';
async function generateQR(data) {
try {
const response = await fetch(`${BASE_URL}/qr/generate`, {
method: 'POST',
headers: {
'X-API-Key': API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
data,
style: {
shape: 'rounded',
gradientType: 'linear',
gradientColors: ['#667eea', '#764ba2']
},
enableAnalytics: true
})
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const qr = await response.json();
console.log('QR Code URL:', qr.imageUrl);
return qr;
} catch (error) {
console.error('Error:', error);
throw error;
}
}
// Usage
generateQR('https://example.com');Python
import requests
import json
API_KEY = 'qr_live_your_api_key'
BASE_URL = 'https://api.qrapi.com/v1'
def generate_qr(data):
try:
response = requests.post(
f'{BASE_URL}/qr/generate',
headers={
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
},
json={
'data': data,
'style': {
'shape': 'rounded',
'gradientType': 'linear',
'gradientColors': ['#667eea', '#764ba2']
},
'enableAnalytics': True
}
)
response.raise_for_status()
qr = response.json()
print(f"QR Code URL: {qr['imageUrl']}")
return qr
except requests.exceptions.RequestException as e:
print(f'Error: {e}')
raise
# Usage
generate_qr('https://example.com')PHP
<?php
define('API_KEY', 'qr_live_your_api_key');
define('BASE_URL', 'https://api.qrapi.com/v1');
function generateQR($data) {
$ch = curl_init(BASE_URL . '/qr/generate');
$payload = json_encode([
'data' => $data,
'style' => [
'shape' => 'rounded',
'gradientType' => 'linear',
'gradientColors' => ['#667eea', '#764ba2']
],
'enableAnalytics' => true
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-Key: ' . API_KEY,
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode !== 201) {
throw new Exception("HTTP Error: $httpCode");
}
$qr = json_decode($response, true);
echo "QR Code URL: " . $qr['imageUrl'] . "\n";
return $qr;
}
// Usage
generateQR('https://example.com');
?>