QRdx
HelpGuidesDevelopersReact librarySelf-hosting

QR code image API

Turn any URL into a QR code image you can embed in Markdown, HTML or emails. No API key needed.

GET https://api.qrdx.dev/v1/qr returns a QR code as an SVG, PNG or WebP image, or as a vector EPS file for print and design tools. Everything is in the query string, so the URL itself is the image: paste it into a README, an <img> tag or an email template. It takes the editor's styles too: gradients, frames (custom frames included), borders, eye and dot colors and logo icons.

![QR code](https://api.qrdx.dev/v1/qr?data=https://github.com/you/repo)

No account or API key is required. The one exception is a logo you uploaded to QRdx (see Logos).

Try it in the playground: style a code there, then copy its image URL.

Examples

<img
  src="https://api.qrdx.dev/v1/qr?data=https://qrdx.dev&size=256&fg=155dfc"
  width="256"
  height="256"
  alt="QR code for qrdx.dev"
/>

Download a PNG with curl (quote the URL so your shell keeps the &):

curl -o qr.png "https://api.qrdx.dev/v1/qr?data=https://qrdx.dev&format=png&size=1024"

Or a WebP: the same pixels as the PNG, lossless and transparency included, in a smaller file:

curl -o qr.webp "https://api.qrdx.dev/v1/qr?data=https://qrdx.dev&format=webp&size=1024"

Get a vector EPS for Illustrator, InDesign or a print shop (size is the width in points, 72 per inch, so 144 is 2 inches):

curl -o qr.eps "https://api.qrdx.dev/v1/qr?data=https://qrdx.dev&format=eps&size=144"

Stylised dots with a frame:

https://api.qrdx.dev/v1/qr?data=https://qrdx.dev&body=rounded&eye=rounded&dot=rounded&template=Arrow

A built-in frame with its label, and a community frame by its id:

https://api.qrdx.dev/v1/qr?data=https://qrdx.dev&frame=banner-bottom&frameText=Scan%20the%20menu
https://api.qrdx.dev/v1/qr?data=https://qrdx.dev&item=frame:wifi-card

The whole design as JSON in style, here a gradient, red eyes and a frame:

const style = {
  fgColor: {
    type: "linear",
    angle: 45,
    stops: [
      { color: "#1d4ed8", offset: 0 },
      { color: "#7c3aed", offset: 100 },
    ],
  },
  eyeColor: "#b91c1c",
  frame: { style: "banner-bottom", text: "Scan the menu" },
};
const src = `https://api.qrdx.dev/v1/qr?data=${encodeURIComponent(link)}&style=${encodeURIComponent(JSON.stringify(style))}`;

Encode the data value when it contains &, #, + or spaces, for example with encodeURIComponent in JavaScript. Otherwise the URL is split at those characters. Encode style the same way.

Parameters

ParameterDefaultDescription
datarequiredText or URL to encode, up to 2048 characters
formatsvgsvg, png, webp (lossless) or eps (vector PostScript; size is then the width in points)
size512Width and height in pixels, 64 to 2048
fg000000Module color as hex (155dfc, fff, or 8 digits with alpha)
bgffffffBackground color as hex. 00000000 gives a transparent background
eyeColorfgColor of the three corner eyes
dotColorfgColor of the dot inside each corner eye
bodysquareShape of the data modules
eyesquareShape of the corner eye frames
dotsquareShape of the dot inside each corner eye
levelQError correction: L (~7%), M (~15%), Q (~25%) or H (~30%)
margin4Quiet zone around the code in modules, 0 to 16
templatenoneDecorative border template
framenoneA built-in call-to-action frame, such as banner-bottom, speech-bubble or circle (any of the 19 styles)
frameTextScan meThe frame's label, up to 24 characters. Also relabels the frame of a style or item
stylenoneThe editor's whole design as JSON; see Styles
itemnoneA community frame or theme by id, such as frame:wifi-card; see Community items
logoIconnoneA quick icon or a brand logo in the center; see Logos
logoFileIdnoneA logo you uploaded, by file id; needs an API key; see Logos

Write colors without the #, or encode it as %23: a bare # starts the URL fragment and is never sent. Enum values (level, format, template, frame) are case-insensitive.

With a frame, size is the width of the code itself and the frame adds to the image, in every format.

Styles

style takes the design as JSON with the same fields as a saved theme, so a theme from GET /v1/themes or the qrdxStyle that the MCP server's design_qr returns can be passed as it is (minus an uploaded logo, see below):

FieldTakes
bgColor, fgColor, eyeColor, dotColorA color (hex such as #155dfc, rgb(), hsl() or a color name), or a gradient: { "type": "linear", "angle": 45, "stops": [...] } or { "type": "radial", "stops": [...] }, with 2 to 8 stops of { "color", "offset" } (offset 0 to 100)
bodyPattern, cornerEyePattern, cornerEyeDotPatternThe pattern values
level, marginAs the parameters above (margin 0 to 16)
templateIdA border template, default for none
frameA built-in frame, { "style": "banner-bottom", "text": "Scan me", "color": "#155dfc", "textColor": "#ffffff" }, or a custom one, { "style": "custom", "spec": { … } }, with a frame spec from the community or a custom frame made in the playground's Frame section. Specs are checked against the engine's frame-spec rules (no markup, links or images; at most 32 KB)
eyeColorsColors per eye, over eyeColor and dotColor: { "topLeft": { "outer": "#b91c1c", "inner": "#1d4ed8" }, "topRight": …, "bottomLeft": … }, each a color or a gradient
moduleScaleSize of each dot, 0.5 to 1 (default 1)
shapesquare (default) or circle: the code in a disc of decorative dots
autoLevelRaise error correction to H when the logo covers more than 7% of the code (always on here when there's a logo)
logoOptionsThe logo's layout: size (0.1 to 0.3 of the code's width; QRdx shrinks it when the code can't spare the modules), padding (0 to 2 modules), x and y (0 to 1), shape (square, rounded or circle crop) and plate (a color behind it)
showLogo, logoIcon, logoFileIdSee Logos

style also takes the style value of a playground link (it starts with 1.), so a design shared from the playground renders as it looks there, without its logo.

Fields you set with the flat parameters (fg, body, frame and the rest) win over style, and style wins over item. Unknown fields, logo addresses (customLogo) and Logo QR or Image QR art (art) are refused with a 400 that says why.

Community items

item renders a published community frame or theme, free under CC0. Find ids with GET /v1/community/items, or open an item page and use its type and slug: /community/frames/wifi-card is frame:wifi-card. A frame item sits on a plain black-on-white code; add style or flat parameters to change the code under it.

Logos

  • Quick icons. logoIcon puts one of the editor's icons on a white tile in the center: wifi, location, phone, email, link, file, calendar, whatsapp or instagram. QRdx draws them itself, and they need no key.
  • Brand logos. logoIcon also takes any of the 3,467 brands from Simple Icons by slug: spotify, paypal, googlemaps, appstore. The mark is drawn bare in its brand color; add :black or :white for those colors (whatsapp:white), and logoOptions.plate in style for a plate behind it. GET /api/brand-logos lists every slug. A slug QRdx doesn't have gets a 400.
  • The QRdx mark that the editor shows by default isn't drawn here: showLogo: true alone adds no logo.
  • Error correction rises for a logo. When a logo covers more than 7% of the code, the code is drawn at level H, whatever level says, so it still scans.

Your own logo. logoFileId draws a PNG or JPEG of up to 1 MB that you uploaded in Dashboard → Files. The id is the last part of the file's link, https://qrdx.dev/api/files/<id>. Send an API key of the workspace that owns the file:

curl -o qr.png -H "Authorization: Bearer $QRDX_API_KEY" \
  "https://api.qrdx.dev/v1/qr?data=https://qrdx.dev&format=png&logoFileId=<id>"

The response is private (Cache-Control: private, no-store) and counts toward the workspace's daily API quota. A file from another workspace gets 404, and a request without a key gets 401. QRdx reads the image from its own storage and checks that it really is a PNG or JPEG; it never fetches a logo from a web address you send.

logoOptions sizes, places, crops and backs any of these logos. Removing an uploaded logo's own background is done in the playground; the image API draws the uploaded file as it is.

Logo QR and Image QR art aren't available here: the playground builds them from your picture in the browser, and the image API doesn't build art from uploads. Design art codes in the playground.

Pattern values

  • body: circle, circle-large, square, diamond, circle-mixed, pacman, rounded, small-square, vertical-line, horizontal-line, liquid, liquid-horizontal, liquid-vertical, classy, classy-rounded, leaf, plus, hexagon, star, heart, random-dots, mosaic, octagon
  • eye: square, rounded, gear, circle, diya, extra-rounded, message, pointy, leaf, drop, octagon, bevel, squircle, cushion, shield, petal, leaf-reverse
  • dot: square, rounded, circle, message, message-reverse, diya, diya-reverse, rounded-triangle, leaf, drop, plus, cross-rounded, hexagon, octagon, flower, heart, squircle, dots, extra-rounded, leaf-reverse, drop-reverse
  • template: default, Arrow, StandardBox, SquareBorder, StrikedBox, Halloween

These are the same styles as the qrdx React library. The MCP server can also list them with short descriptions.

Responses

A successful request returns the image with:

  • Content-Type: image/svg+xml, image/png or application/postscript (EPS is sent as a qr-code.eps download)
  • Cache-Control: public, max-age=31536000, immutable, except for renders with item (5 minutes, 10 at the CDN, since an item can get a new version or be taken down) and with logoFileId (private, no-store)
  • Access-Control-Allow-Origin: *, so you can fetch it from any website

Rendering is deterministic: the same query string always returns the same bytes, which is why responses can be cached for a year. URLs that use only the original parameters render exactly as they always have.

Invalid parameters return 400 with a JSON body that names each problem:

{
  "code": "VALIDATION_ERROR",
  "message": "Invalid query parameters",
  "data": {
    "details": [
      { "param": "size", "message": "Too small: expected number to be >=64" }
    ]
  },
  "status": 400
}

Data that doesn't fit in a QR code at the chosen error correction level also returns 400 with param: "data". Use a lower level or shorter data.

Limits

  • Rate limit: 300 requests per minute per IP address. Over the limit you get 429 with a Retry-After header.
  • No scan check. The image API draws what you ask for. To check and repair a design's scan score first, use design_qr on the MCP server, or the scan score in the playground.
  • style is up to 8,192 characters in the URL, and its JSON up to 40 KB.
  • The data is part of the URL. Like any URL, it can end up in server logs, browser history and caches. Don't put passwords or other secrets in it.

Scanning tips

  • Keep margin at 2 or more when the image sits on a dark or busy background, such as a README in GitHub's dark mode.
  • Keep good contrast between fg and bg. Dark modules on a light background scan most reliably.
  • The defaults (square modules, 4-module margin) scan on every reader. Stylised shapes such as circle dots look softer but some older scanners read them less reliably — check with the scan checker.
  • Test the code with a few phones before printing it.

Self-hosting

The endpoint is part of the QRdx web app, so a self-hosted instance serves it at /api/v1/qr on your own domain (for example https://qr.example.com/api/v1/qr?data=…). The short /v1/qr path only works on api.qrdx.dev. Rate limiting uses Upstash Redis when it is configured and is off otherwise.

Last updated on

On this page