Skip to content

Get QR Code Image

Render and download a QR code as an SVG image.

GET /api/v1/qrcodes/:id/image

Path Parameters

ParameterTypeDescription
idstringUUID of the QR code

Query Parameters

ParameterTypeDefaultDescription
sizeinteger300Image width/height in pixels (100–2000)
formatstring"svg"Image format (currently svg only)

Example Request

bash
# Download as SVG file
curl "https://api.qbar-scanner.com/api/v1/qrcodes/550e8400-.../image?size=500" \
  -H "X-API-Key: qbar_your_key_here" \
  -o qrcode.svg

Response

Returns the SVG image directly with:

HeaderValue
Content-Typeimage/svg+xml
Cache-Controlpublic, max-age=3600

How It Works

  1. Dynamic QR codes: The image encodes the short redirect URL (e.g., https://qbar-scanner.com/r/aB3cD4eF), not the target content directly. This ensures the QR stays scannable even when the target is updated.

  2. Static QR codes: The image encodes the content string directly.

  3. Caching: Generated SVGs are cached on our CDN. After updating content or style, the cache is automatically invalidated.

  4. Styling: The image respects all styling options set on the QR code (dot patterns, gradients, corners, logo).

Using in HTML

html
<!-- Direct image embed (requires API key as query param is NOT supported) -->
<!-- Instead, fetch the image server-side and serve it from your own domain -->
javascript
// Fetch and display in browser
const res = await fetch(
  `https://api.qbar-scanner.com/api/v1/qrcodes/${id}/image?size=400`,
  { headers: { 'X-API-Key': 'qbar_your_key_here' } }
)
const svgText = await res.text()
document.getElementById('qr-container').innerHTML = svgText

Error Responses

StatusWhen
400Invalid format (only svg supported currently)
401Invalid API key
404QR code not found

QBar Scanner Developer API