How to generate a QR code via API

Updated 2026-10-12

Use when an agent must hand a person text or a URL as a scannable QR code image. Add output=url for a 24 h link.

From an MCP client, add https://tanod.dev/mcp and call make_qr_code; its free daily calls are applied automatically, no key or signup.

POST the text or URL to /v1/qr. It returns the QR code as SVG text (default) or as a base64-encoded PNG.

Request

data is up to 2,000 characters (2,953 UTF-8 bytes). Optional: scale 1 to 20 pixels per module, error correction L, M, Q or H, border 0 to 10 modules.

curl, using the free tier
curl -s -X POST https://tanod.dev/v1/qr \
  -H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
  -d '{"data":"https://tanod.dev","format":"svg","scale":2,"border":1}'

Response

Response (a real call, path data shortened)
{
  "format": "svg",
  "content_type": "image/svg+xml",
  "version": 2,
  "error": "M",
  "modules": 25,
  "border": 1,
  "scale": 2,
  "width_px": 54,
  "height_px": 54,
  "bytes": 1204,
  "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"54\" height=\"54\" ...>...</svg>"
}

Limits and caveats

Using the output. For SVG, write the svg string to a file or inline it. With "format":"png" the response has data_base64 instead; decode it to get the PNG bytes.

Leave the border. The quiet zone helps scanners; the default border is 4 modules. Higher error correction (Q or H) makes a denser code that survives more damage.

Test a printed code with a real scanner before you ship it. Input longer than the limit is rejected and not charged.

Download link. Add "output": "url" to the request and the file is stored for 24 hours and returned as a link (url, expires_at, sha256) instead of base64, which keeps it out of your context window. The price is the same. How the links work.

Price and free allowance

USD 0.001 per call, paid in USDC on Base, Polygon, Solana, BNB Chain or Arbitrum with x402. 10 free calls per IP per UTC day with the header X-Tanod-Free: 1. The pool is shared with FX rates, geocode and holidays. MCP tool: make_qr_code at https://tanod.dev/mcp, where the free tier is automatic.

All endpoints →

Use it from Claude without writing code: in claude.ai or Claude Desktop, add https://tanod.dev/mcp/util?via=qr-code-api as a custom connector (steps), then ask in plain words, for example "Make a QR code for https://example.com." The free daily allowance is applied automatically over MCP. Beyond it a call needs an x402 payment, which these clients can make.

Related guides: What QR code and barcode APIs cost (price data), How to get a page's Open Graph and meta tags, Currency exchange rates API (ECB reference rates), Public holidays API. Back to tanod.dev or the guide index. Results are automated and heuristic.