Generate and verify a QR code asset

Generate one SVG, PNG, JPG, or WebP asset, perform a structural payload review, assess quiet-zone, contrast, and error-correction settings, decode the final generated file with jsQR, compare payload SHA-256 hashes, and return a bounded evidence-linked receipt. Asset bytes are returned only when final-file decoding matches the requested payload. A decode failure returns HTTP 422 with the full receipt and no asset bytes. The receipt does not include the decoded payload. This is not print, device, ISO, accessibility, malware, or security certification.

post/.netlify/functions/generate-verified-qr

Request body

valuestring required

Data encoded in the QR code

format'svg' | 'png' | 'jpg' | 'webp'

Final output format. PDF and EPS are excluded because this workflow decodes the final generated 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 asset whose final-file decode matched the requested payload, plus a bounded verification receipt

successboolean required
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

assetSha256string required

SHA-256 hash of the final generated asset bytes.

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"
  }
}