POST /api/qr/generate
Generate a QR code from an explicit configuration. This is the main rendering endpoint — both the builder UI and the AI endpoint funnel into this.
Request
Content-Type: application/json or multipart/form-data (for binary logo / background uploads).
Body shape: a QrConfig object.
Minimal example:
Multipart upload (file logo)
curl -X POST https://api.qr-branding.com/api/qr/generate \
-H "X-RapidAPI-Proxy-Secret: <secret>" \
-F 'config={"content":"https://yourbrand.com","logoSizePercent":18,"eccLevel":"H"}' \
-F "logoFile=@./brand-mark.png"
The config field is a JSON-encoded string. logoFile and backgroundFile are binary parts (PNG / JPG / GIF / BMP / WebP up to 10 MB).
Response (base64 mode — default)
{
"success": true,
"qrBase64": "iVBORw0KGgoAAAANSUhEUgAA…",
"format": "png",
"contentType": "image/png",
"sizeBytes": 38291
}
Response (binary mode)
{ "responseType": "binary" }
Returns the raw file bytes with the appropriate Content-Type and Content-Disposition: attachment; filename="qrcode.png".
Validation
The engine runs the full scan guarantee pipeline. Common rejection reasons:
| Code | Meaning | Fix |
|---|---|---|
CONTENT_TOO_LONG | Encoded string > 4296 chars | Shorten / use a URL shortener |
LOW_CONTRAST | foreground vs background < 4:1 | Pick a darker fg or lighter bg |
LOGO_TOO_LARGE | logoSizePercent > 25 with ECC < H | Raise to H or shrink the logo |
INVALID_HEX | Color string not #RGB, #RRGGBB, #RRGGBBAA | Fix the color |
INVALID_LLM_MODEL | Only on AI endpoint | See AI mode |
See also
- QrConfig reference — every accepted parameter
- POST /api/qr/ai/generate — same engine, AI-driven config