Generate a QR code as SVG from any text or URL. $0.01 per request.
Send any text or URL, get back a scannable QR code as SVG markup and a ready-to-embed base64 data URI.
| Method | POST |
|---|---|
| Path | /generate |
| Content-Type | application/json |
| field | required | description |
|---|---|---|
data | yes | Text or URL to encode, max 2000 characters |
error_correction | no | L, M, Q, or H (default M) — higher survives more damage but produces a denser code |
curl -X POST https://qr-generator.pdfextractapi.workers.dev/generate \
-H "Content-Type: application/json" \
-d '{"data": "https://example.com"}'
{
"data": "https://example.com",
"svg": "<svg version=\"1.1\" ...>...</svg>",
"data_uri": "data:image/svg+xml;base64,..."
}
Errors return a non-200 status with { "error": { "code": "...", "message": "..." } }. Common codes: missing_data, data_too_large, invalid_error_correction.
This endpoint is paid per-request via the x402 protocol (HTTP 402 + USDC). Unpaid requests receive a 402 response with payment instructions.