Skip to main content

QR codes

Every short link has a QR image served publicly by the redirect host at GET /:shortCode/qr — no authentication required. Because it's a plain image URL, you can build it yourself; the planned TypeScript SDK (not published yet) builds it for you instead of making an API call.

Build a QR URL​

const qrUrl = leonai.qr.buildUrl('spring-sale', {
size: 512,
format: 'svg', // png | svg | dataurl
color: '#111111',
backgroundColor: '#FFFFFF',
errorCorrectionLevel: 'H', // L | M | Q | H
margin: 4,
});
// -> https://short.leonai.io/spring-sale/qr?size=512&format=svg&...

Options​

OptionValuesNotes
sizepixelsWidth/height of the square image
formatpng, svg, dataurldataurl returns an inline data: URI
colorhexForeground (module) color
backgroundColorhexBackground color
errorCorrectionLevelL, M, Q, HHigher levels tolerate more damage/logo overlay
marginintegerQuiet-zone modules around the code

Use it directly​

Since the URL is public, drop it straight into an <img> tag, a print asset, or a PDF:

<img
src="https://short.leonai.io/spring-sale/qr?size=512&format=png"
alt="Scan for the Spring Sale"
width="256"
height="256"
/>

Dynamic QR codes point at the short link, so you can change the destination later (via link update) without reprinting the code.