Skip to content

Generate QR Code

Generates a QR code image on the fly from the provided content string. You can customize colors, dot styles, logo overlay, error correction level, and output format. The response is the raw image binary — not the standard JSON envelope.

POST /v1/qr/generate
qr:render

Parameters

Request body

ParameterTypeRequiredDefaultDescription
contentstringYesThe URL or text to encode in the QR code.
formatstringNosvgOutput format: svg or png.
sizeintegerNo10Module size multiplier (1–50).
designobjectNoDesign customization options (see below).

Design object

ParameterTypeDefaultDescription
foreground_colorstring#000000Foreground (dot) color as hex.
background_colorstring#FFFFFFBackground color as hex.
error_correctionstringMError correction level: L, M, Q, or H.
dot_stylestringsquareDot shape style (e.g. square, rounded, dots, classy).
corner_stylestringsquareCorner square style (e.g. square, rounded, dot).
logo_urlstringURL of a logo image to overlay at center.
logo_sizenumber0.2Logo size as a fraction of the QR code (0.1–0.4).
quiet_zoneinteger1Number of module-width quiet zone around the code.

Request examples

Terminal window
curl -X POST https://xqr.co/api/v1/qr/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "https://example.com",
"format": "png",
"size": 20,
"design": {
"foreground_color": "#8B5CF6",
"background_color": "#FFFFFF",
"error_correction": "H",
"dot_style": "rounded",
"corner_style": "rounded",
"logo_url": "https://cdn.example.com/logo.png",
"logo_size": 0.25,
"quiet_zone": 2
}
}' \
--output qr.png

Response

200 OK

The response body is the raw image binary with the appropriate content type header.

FormatContent-Type
svgimage/svg+xml
pngimage/png

Was this page helpful?