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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
content | string | Yes | — | The URL or text to encode in the QR code. |
format | string | No | svg | Output format: svg or png. |
size | integer | No | 10 | Module size multiplier (1–50). |
design | object | No | — | Design customization options (see below). |
Design object
| Parameter | Type | Default | Description |
|---|---|---|---|
foreground_color | string | #000000 | Foreground (dot) color as hex. |
background_color | string | #FFFFFF | Background color as hex. |
error_correction | string | M | Error correction level: L, M, Q, or H. |
dot_style | string | square | Dot shape style (e.g. square, rounded, dots, classy). |
corner_style | string | square | Corner square style (e.g. square, rounded, dot). |
logo_url | string | — | URL of a logo image to overlay at center. |
logo_size | number | 0.2 | Logo size as a fraction of the QR code (0.1–0.4). |
quiet_zone | integer | 1 | Number of module-width quiet zone around the code. |
Request examples
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.pngconst res = await fetch("https://xqr.co/api/v1/qr/generate", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ 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, }, }),});
const blob = await res.blob();import httpx
res = httpx.post( "https://xqr.co/api/v1/qr/generate", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "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, }, },)
with open("qr.png", "wb") as f: f.write(res.content)Response
200 OK
The response body is the raw image binary with the appropriate content type header.
| Format | Content-Type |
|---|---|
svg | image/svg+xml |
png | image/png |
Was this page helpful?
Thanks for your feedback!