v1

latestOpenAPI 3.0.12026-08-041826100.3 KB

Generate a QR code asset via Netlify Function

post/.netlify/functions/generate-qr

Request body

valuestring required

Data encoded in the QR code

format'svg' | 'png' | 'jpg' | 'webp' | 'pdf' | 'eps'

Output format for the QR code asset

sizeinteger

Pixel width/height of the generated asset

margininteger

Quiet-zone margin around the QR code modules

fgColorstring

Hex foreground color, for example #000000

bgColorstring

Hex background color, for example #FFFFFF

errorCorrectionLevel'L' | 'M' | 'Q' | 'H'

QR error correction level

logostring nullable

Optional base64 data URL for a logo (PNG, JPG, or WEBP) to composite at the center. Files larger than 1MB are rejected.

Response

Generated QR code asset encoded as base64

successboolean
datastring

Base64 encoded asset bytes

dataUrlstring

Ready-to-embed data URL built from contentType and base64 data

downloadUrlstring

Relative GET URL for retrieving the generated asset without embedding base64 bytes. Emitted only for no-logo public HTTP(S) URL payloads that do not include obvious credential-style query parameters.

contentTypestring
extensionstring
suggestedFilenamestring
byteLengthinteger

Exact number of decoded bytes in the base64 data field

Example response

{
  "success": true,
  "dataUrl": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
  "downloadUrl": "/.netlify/functions/generate-qr?value=https%3A%2F%2Fexample.com&format=svg&size=1024",
  "contentType": "image/png",
  "extension": "png",
  "suggestedFilename": "qrcode-example",
  "byteLength": 5342,
  "dimensions": {
    "width": 1024,
    "height": 1024,
    "unit": "px"
  },
  "qrOptions": {
    "size": 1024,
    "margin": 4,
    "errorCorrectionLevel": "H"
  }
}