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/generate

Parameters

ParameterTypeDefaultDescription
content *string-The data to encode (URL, text, etc.)
size integer512Size in pixels (64-4096)
errorCorrection stringMError correction: L, M, Q, H
foregroundColor string#000000Foreground color (hex)
backgroundColor string#FFFFFFBackground color (hex)
qrStyle stringsquareStyle: square, dots, rounded
format stringpngOutput: png or svg
logoBase64 stringnullLogo as base64 data URL
logoSizeRatio number0.25Logo 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.png
JavaScript (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

Code Examples

Ready-to-use examples in JavaScript, Python, PHP, Go, Ruby, and C#.

View on GitHub

Need Help?

Questions or need assistance? We're here to help.

Contact Us