API Docs
Generate QR codes programmatically
The LinkScan QR Code API lets you generate custom QR codes from any application. Send a POST request with your content and styling options, and receive a PNG or SVG image in response. No watermarks, no branding, no expiration.
The API is free for all registered users with a rate limit of 60 requests per minute. Supports custom colours, dot styles, corner styles, logos, and error correction levels. Use it to generate QR codes in bulk, integrate into your workflow, or build QR features into your own product.
Get API Key
Create a key in your settings
Make Request
POST to /api/v1/qr/generate
Get QR Code
Receive PNG or SVG image directly
Authentication
Include your API key in the request header:
Authorization: Bearer YOUR_API_KEY Endpoint
/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 -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.pngconst 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;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');import requests
response = requests.post(
'https://linkscan.org/api/v1/qr/generate',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'content': 'https://example.com',
'size': 512,
'foregroundColor': '#000000',
'backgroundColor': '#FFFFFF',
'format': 'png'
}
)
# Save the QR code image
with open('qr-code.png', 'wb') as f:
f.write(response.content)
print('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
Rate limit headers are included in all responses: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
Error Codes
| Code | Meaning |
|---|---|
400 | Invalid request body or validation failed (missing content, invalid size, etc.) |
401 | Missing or invalid API key |
403 | API key lacks the required scope (needs qr:generate) |
429 | Rate limit exceeded (60 requests per minute). Check the Retry-After header. |
500 | QR code generation failed. Check the error field in the response for details. |
Frequently Asked Questions
Is the LinkScan QR Code API free?
Yes. The QR code generation API is free for all registered users. Create an account, generate an API key in your settings, and start making requests. The rate limit is 60 requests per minute.
How do I get an API key?
Sign in to your LinkScan account, go to Settings, and create a new API key. The key is shown once on creation. Store it securely. You can create up to 10 keys per account.
What formats does the API return?
The API returns QR code images directly as binary data. Supported formats are PNG (default) and SVG. Set the 'format' parameter to 'png' or 'svg' in your request body.
Can I add a logo to QR codes via the API?
Yes. Pass a base64-encoded image in the 'logoBase64' parameter. The API automatically adjusts error correction to ensure the code remains scannable. Control the logo size with the 'logoSizeRatio' parameter (0.1 to 0.4).
What is the rate limit?
60 requests per minute per API key. Rate limit headers (X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset) are included in every response so you can track your usage.
What programming languages are supported?
Any language that can make HTTP requests. The API is a standard REST endpoint that accepts JSON and returns binary image data. Examples are provided for cURL, JavaScript (browser and Node.js), and Python.
What is the maximum QR code size?
4096 pixels. The minimum is 64 pixels. The default is 512 pixels. Larger sizes are better for print use cases like posters and banners.
Do the generated QR codes expire?
No. QR codes generated via the API are static codes. They encode the content directly into the pattern and work forever, with no dependency on LinkScan servers.