QR Code Generation
The /qrcode endpoint generates a QR Code from a URL provided as a parameter. This endpoint is useful for quickly generating an image in PNG format.
curl -X GET \ "https://api.moxon.dev/v6/qrcode"Send the request to see the response here.
urlstringrequiredThe URL to encode in the QR Code. Must contain the full address
format"png" | "base64"optionalResponse format:
png(default, direct image) orbase64(JSON data URL)sizenumberoptionalImage size in pixels (50-2000, default 200)
marginnumberoptionalQuiet zone in modules (0-10, default 4)
correctionstringoptionalError correction level:
L,M,QorH(defaultM)- L
- M
- Q
- H
darkstringoptionalModule color in hexadecimal (e.g.
000000)lightstringoptionalBackground color in hexadecimal (e.g.
ffffff)iconstringoptionalHTTPS URL of an image to overlay at the center of the QR Code
iconSizenumberoptionalIcon size in pixels (default 20% of
size, max 40% ofsize)iconPaddingnumberoptionalWhite padding around the icon in pixels (default 5, 0-50)
iconRadiusnumberoptionalBorder radius of the icon background in pixels (default 0, max = perfect circle)
Good to know
When an icon is provided, the error correction level is automatically set to H to ensure readability. The icon URL must use HTTPS, with a 5s timeout and a 2MB size limit.
Keep the icon small
A large iconSize combined with generous iconPadding covers more QR Code modules, making it harder to scan. Keep the icon + padding area well below 40% of the total size for reliable results.
By default (format=png), the endpoint returns a direct PNG image (Content-Type: image/png), usable in an <img> tag:
<img src="https://api.moxon.dev/v6/qrcode?url=https://moxon.dev" alt="QR Code" />With format=base64, the response is a JSON object:
resultstringBase64 PNG data URI of the QR Code
If parameters are missing or invalid, the API will return an error:
- 400
Please provide a valid URLTheurlparameter is missing or invalid - 400
format must be one of: png, base64Invalidformatvalue - 400
size must be a numberThesizeparameter is not a number - 400
size must be between 50 and 2000Thesizeis out of range - 400
margin must be a numberThemarginparameter is not a number - 400
margin must be between 0 and 10Themarginis out of range - 400
correction must be one of: L, M, Q, HInvalid error correction level - 400
Invalid color (use hex like ff6600)Adarkorlightcolor is malformed - 400
Icon URL must use HTTPSTheiconURL does not use HTTPS - 400
Failed to fetch icon: HTTP {status}The icon URL returned a non-OK response - 400
Icon URL must point to an imageThe icon content-type is not an image - 400
Icon must be under 2MBThe icon exceeds the 2MB size limit - 400
iconSize must be a numberTheiconSizeparameter is not a number - 400
iconSize must be between 10 and {max}TheiconSizeis out of range (max = 40% of size) - 400
iconPadding must be a numberTheiconPaddingparameter is not a number - 400
iconPadding must be between 0 and 50TheiconPaddingis out of range - 400
iconRadius must be a numberTheiconRadiusparameter is not a number - 400
iconRadius must be between 0 and {max}TheiconRadiusis out of range
Last updated on September 12, 2026