xtract.bot
POST /api/qr-encode

Generate a QR code as PNG or SVG. Configurable error-correction level, size, and quiet-zone margin.

Generates a QR code from arbitrary text. Output is PNG or SVG. Options: - `text`: what to encode. Often a URL, but anything works. - `errorCorrection`: `L` (7%), `M` (15%, default), `Q` (25%), or `H` (30%). Higher correction takes more space but survives more damage / occlusion. - `size` (default 256): pixel side length for PNG. - `margin` (default 4): the quiet-zone padding (in modules) around the code. Required for reliable scanning.

Inputs

NameTypeDefaultDescription
text*stringText payload to encode (e.g. URL, message).
errorCorrectionenum (L | M | Q | H)"M"Error-correction level. L=~7%, M=~15%, Q=~25%, H=~30% recovery.
sizePxnumber (0…4096)256Minimum SVG dimension in user units. 0 = auto (per-module = 1).

Response

Modes: binary, text, json. Cache: yes (24h TTL).

Code samples

Built from the url example.


curl -X POST https://api.xtract.bot/api/qr-encode \
  -H "Content-Type: application/json" \
  -H "Accept: application/octet-stream" \
  -H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
  -H "X-Api-Key: $XTRACT_API_KEY" \
  -d '{
  "text": "https://xtract.bot",
  "errorCorrection": "M",
  "sizePx": 256
}'