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
| Option | Values | Notes |
|---|---|---|
size | pixels | Width/height of the square image |
format | png, svg, dataurl | dataurl returns an inline data: URI |
color | hex | Foreground (module) color |
backgroundColor | hex | Background color |
errorCorrectionLevel | L, M, Q, H | Higher levels tolerate more damage/logo overlay |
margin | integer | Quiet-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.