Get QR Code Image
Render and download a QR code as an SVG image.
GET /api/v1/qrcodes/:id/imagePath Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | UUID of the QR code |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
size | integer | 300 | Image width/height in pixels (100–2000) |
format | string | "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.svgResponse
Returns the SVG image directly with:
| Header | Value |
|---|---|
Content-Type | image/svg+xml |
Cache-Control | public, max-age=3600 |
How It Works
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.Static QR codes: The image encodes the content string directly.
Caching: Generated SVGs are cached on our CDN. After updating content or style, the cache is automatically invalidated.
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 = svgTextError Responses
| Status | When |
|---|---|
400 | Invalid format (only svg supported currently) |
401 | Invalid API key |
404 | QR code not found |