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.

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');
Python
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

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

Error Codes

CodeMeaning
400Invalid request body or validation failed (missing content, invalid size, etc.)
401Missing or invalid API key
403API key lacks the required scope (needs qr:generate)
429Rate limit exceeded (60 requests per minute). Check the Retry-After header.
500QR 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.

Need Help?

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

Contact Us