Home / API docs / Qr API
More

Qr API

GET /api/qr $0.002 per call USDC on Base · x402

QR code generator: GET ?data=<text|url> and receive a scannable QR as SVG plus PNG (base64) and a data: URI. Options: size (px, default 512), margin (quiet-zone modules, default 2), ecc (L|M|Q|H, default M), dark/light hex colors. Deterministic, no network, no tracking — encode URLs, wifi, vCards, or payment URIs up to 2,000 chars.

Parameters

NameInDescription
dataqueryrequiredText or URL to encode (required, up to 2,000 chars)
sizequeryPNG width in px (64–2048, default 512)
marginqueryQuiet-zone width in modules (0–20, default 2)
eccqueryError correction: L, M (default), Q, or H — higher survives more damage but holds less data
darkqueryHex color of the modules (default #000000)
lightqueryHex background color (default #ffffff)

Example request

curl "https://api.webbersites.com/api/qr?data=https%3A%2F%2Fx402.webbersites.com"
# first call returns 402 + payment requirements; an x402 client pays and retries automatically

Example response

{
    "data": "https://x402.webbersites.com",
    "version": 3,
    "ecc": "M",
    "width": 512,
    "svg": "<svg …>",
    "png_base64": "iVBORw0…",
    "data_uri": "data:image/png;base64,…"
}
MCP tool: get_qr — via npx -y webbersites-x402-mcp (local, key stays on your machine) or the remote endpoint https://api.webbersites.com/mcp.

How payment works

There is no signup and no API key. Call the endpoint; it replies 402 Payment Required with machine-readable payment requirements. Your client signs a USDC transfer authorization (EIP-3009, gasless) and retries with the X-PAYMENT header — @x402/fetch does this automatically. See the overview for a working snippet.