QR Encoder

API key v1

Generate a QR code as PNG, JPG, SVG or text.

Generates a QR code from any text or URL and returns a hosted image, inline SVG markup, or the raw matrix as text. Images are kept at the returned URL, so you can hot-link them directly.

GET https://api.zactonz.com/qr/enc/

Parameters

NameTypeDescription
contentrequired string

The text or URL to encode. URL-encode it when it contains & or #.

format enum

Output format. svg and text return the markup inline instead of a hosted file.

pngjpgsvgtext
size integer

Pixels per QR module, from 1 to 20.

Default 4
accuracy enum

Error-correction level. Higher levels survive more damage but produce denser codes.

lownormalgoodhigh
padding integer

Quiet-zone margin around the code, in modules.

Default 2
color hex

Foreground colour as a hex value, e.g. 171717.

Default 000000
bgcolor hex

Background colour as a hex value.

Default FFFFFF
resp enum

json returns metadata and the image URL. image streams the image bytes directly with the right Content-Type.

jsonimage

Send parameters in the query string.

Response

A successful reply wraps the result in `data`.

FieldTypeDescription
status integer

200 on success. See status codes below.

data object
data.qr string

Absolute URL of the generated image (png and jpg formats).

data.text string

Inline SVG markup or the text matrix (svg and text formats only).

data.size integer

Module size that was applied.

data.accuracy string

Error-correction level as a single letter: L, M, Q or H.

data.format string

Output format that was applied.

Status codes

The outcome is reported in the JSON status field. See Errors & status codes for the general rules.

200 OK

The code was generated.

400 Missing content

content was empty or absent. data carries the message.

500 Encoding failed

The encoder could not build the matrix. Shorten the content or lower accuracy.

Notes

The endpoint sends Access-Control-Allow-Origin: *. Call it from your backend all the same, so your API key never reaches the browser.

With format=svg or format=text the markup is returned inline in data.text instead of a hosted file. With resp=image the image bytes are streamed directly, which makes the URL usable as an <img src>.