API Docs
Generate QR codes programmatically
1
Get API Key
Create a key in your settings
2
Make Request
POST to /api/v1/qr/generate
3
Get QR Code
Receive PNG or SVG image directly
Authentication
Include your API key in the request header:
Authorization: Bearer YOUR_API_KEY Endpoint
POST
/api/v1/qr/generateParameters
| Parameter | Type | Default | Description |
|---|---|---|---|
content * | string | - | The data to encode (URL, text, etc.) |
size | integer | 512 | Size in pixels (64-4096) |
errorCorrection | string | M | Error correction: L, M, Q, H |
foregroundColor | string | #000000 | Foreground color (hex) |
backgroundColor | string | #FFFFFF | Background color (hex) |
qrStyle | string | square | Style: square, dots, rounded |
format | string | png | Output: png or svg |
logoBase64 | string | null | Logo as base64 data URL |
logoSizeRatio | number | 0.25 | Logo size ratio (0.1-0.4) |
Examples
cURL
curl -X POST https://linkscan.org/api/v1/qr/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "https://example.com",
"size": 512,
"foregroundColor": "#000000",
"backgroundColor": "#FFFFFF",
"format": "png"
}' \
--output qr-code.pngJavaScript (Browser)
const response = await fetch('https://linkscan.org/api/v1/qr/generate', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: 'https://example.com',
size: 512,
foregroundColor: '#000000',
backgroundColor: '#FFFFFF',
format: 'png'
})
});
// Get the QR code as a blob
const blob = await response.blob();
// Create a URL for the image
const imageUrl = URL.createObjectURL(blob);
// Use it in an <img> tag or download it
document.getElementById('qr-image').src = imageUrl;Node.js
import fs from 'fs';
const response = await fetch('https://linkscan.org/api/v1/qr/generate', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: 'https://example.com',
size: 512,
format: 'png'
})
});
// Save to file
const buffer = Buffer.from(await response.arrayBuffer());
fs.writeFileSync('qr-code.png', buffer);
console.log('QR code saved to qr-code.png');Response
Success (200)
Returns the QR code image with content type image/png or image/svg+xml
Error (4xx/5xx)
Returns JSON: {"error": "message"}
Rate Limits
Requests per minute 60
Rate limit headers are included in all responses: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset