QR Code Generator

Generate a QR code as SVG from any text or URL. $0.01 per request.

What it does

Send any text or URL, get back a scannable QR code as SVG markup and a ready-to-embed base64 data URI.

Endpoint

MethodPOST
Path/generate
Content-Typeapplication/json

Fields

fieldrequireddescription
datayesText or URL to encode, max 2000 characters
error_correctionnoL, M, Q, or H (default M) — higher survives more damage but produces a denser code

Example

curl -X POST https://qr-generator.pdfextractapi.workers.dev/generate \
  -H "Content-Type: application/json" \
  -d '{"data": "https://example.com"}'

Example response

{
  "data": "https://example.com",
  "svg": "<svg version=\"1.1\" ...>...</svg>",
  "data_uri": "data:image/svg+xml;base64,..."
}

Errors

Errors return a non-200 status with { "error": { "code": "...", "message": "..." } }. Common codes: missing_data, data_too_large, invalid_error_correction.

Payment

This endpoint is paid per-request via the x402 protocol (HTTP 402 + USDC). Unpaid requests receive a 402 response with payment instructions.

Try it in your browser