Skip to content

Generate a QR Code Image ​

Send a GET request to https://api.2dcode.biz/v1/create-qr-code. The response contains the image. URL-encode the value of data, particularly when the encoded link has its own query parameters.

bash
curl --get 'https://api.2dcode.biz/v1/create-qr-code' \
  --data-urlencode 'data=https://example.com/?a=1&b=2' \
  --data 'size=256x256' -o qrcode.png
ParameterAccepted values and behavior
dataRequired. At least one character. Capacity depends on error correction and the encoded content. Keeping the input under 900 characters is recommended.
sizeBitmap dimensions in pixels, such as 128x128 or 128 for a square. Defaults to 256x256. Very small requests are enlarged to fit the QR matrix.
formatpng (default) or svg.
error_correctionL (7%), M (15%, default), Q (25%) or H (30%). Higher levels allow more damage but reduce content capacity.
borderBorder width in QR modules. Defaults to 2. Use 0 for no border.

Embed the image in HTML ​

html
<img src="https://api.2dcode.biz/v1/create-qr-code?data=Example&amp;size=128x128" alt="QR code containing Example">

To read back the encoded content, see Decode a QR Code Image.