Skip to content
GET/qr

Generate a QR code

Returns a scannable QR code as SVG.

scale sets the pixel size of each module (1-40) and margin the quiet zone in modules (0-20; keep it at 4 or more for reliable scanning). dark and light take hex colours. Set format=json to receive the raw module matrix instead of an image.

$0.0005 per call300 req/minFree allowance applies

Request

curl -X GET "https://www.twotic.dev/v1/qr/qr" \
  -H "Authorization: Bearer $TWOTIC_KEY"

Parameters

query parameters

NameTypeRequiredDescription
datastringrequiredThe content to encode. Up to 800 characters submitted, ~213 bytes encoded.e.g. https://twotic.dev
formatstringoptionalsvg (default) returns an image; json returns the module matrix.one of: svg · json
scaleintegeroptionalPixels per module, 1-40. Defaults to 8.e.g. 8
marginintegeroptionalQuiet zone in modules, 0-20. Defaults to 4. Below 4 harms scanning.e.g. 4
darkstringoptionalHex colour for the dark modules. Defaults to #000000.e.g. #0a0a0a
lightstringoptionalHex colour for the background. Defaults to #ffffff.e.g. #ffffff

Response

200The QR code as an SVG image, or the module matrix as JSON.
400The content is too long or a parameter is invalid.
{
  "error": "content_too_long",
  "message": "That content is too long for a QR code at this error-correction level. The limit is about 213 bytes."
}

As an agent tool

Connect https://www.twotic.dev/api/mcp/qr and this endpoint is exposed as the tool qr_generate.

Generate a scannable QR code encoding any text or URL, returned as SVG. Choose this whenever you need a machine-readable code for print or display — a link, a ticket reference, a payment string. Requires `data`; optional scale, margin, dark and light colours. Content limit is roughly 213 bytes. Use the wifi tool instead for network join codes.