QR Codes
v1.0.0Generate scannable QR codes as SVG — any content, custom colours and size, plus a ready-made WiFi join code.
- Price per call
- $0.0005
- Free each month
- 1K calls
- Rate limit
- 300/min
- MCP server
- Included
Overview
QR Codes generates scannable codes as SVG, in one request.
Output is vector, which matters more than it sounds: a QR code is most often printed — on a receipt, a poster, a table card — and a raster image at the wrong size is the most common reason a code will not scan. SVG stays sharp at any dimension and is small enough to inline directly into a document.
Colours, module scale and quiet-zone margin are all controllable. The quiet zone in particular is not decoration: scanners rely on it to locate the code, and a margin below four modules causes failures that are very difficult to diagnose after printing.
Codes carry enough error correction to survive roughly 15% damage — the right balance for print, where smudging and folding are the realistic failure modes.
The WiFi endpoint builds the join payload correctly, including escaping the characters that would otherwise silently produce a code that joins the wrong network.
Make your first call
Every request goes through the Twotic gateway, which authenticates your key, applies the rate limit, meters the call and forwards it. The exact amount charged comes back on the X-Twotic-Cost header.
curl -X GET "https://www.twotic.dev/v1/qr/qr" \
-H "Authorization: Bearer $TWOTIC_KEY"const res = await fetch("https://www.twotic.dev/v1/qr/qr", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.TWOTIC_KEY}`,
},
})
if (!res.ok) throw new Error(await res.text())
const data = await res.json()
console.log(res.headers.get("X-Twotic-Cost"))import os, requests
res = requests.get(
"https://www.twotic.dev/v1/qr/qr",
headers={"Authorization": f"Bearer {os.environ['TWOTIC_KEY']}"},
)
res.raise_for_status()
data = res.json()
print(res.headers["X-Twotic-Cost"])package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://www.twotic.dev/v1/qr/qr", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("TWOTIC_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
fmt.Println(res.Header.Get("X-Twotic-Cost"))
}<?php
$ch = curl_init("https://www.twotic.dev/v1/qr/qr");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("TWOTIC_KEY"),
],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($data);require "net/http"
require "json"
uri = URI("https://www.twotic.dev/v1/qr/qr")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV.fetch('TWOTIC_KEY')}"
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(req)
end
puts JSON.parse(res.body)
puts res["X-Twotic-Cost"]{
"mcpServers": {
"qr": {
"type": "http",
"url": "https://www.twotic.dev/api/mcp/qr",
"headers": { "Authorization": "Bearer tk_live_your_key" }
}
}
}Endpoints
What you can build
Put a QR code on a receipt or invoice
Request the SVG at generation time and inline it into the document. No image hosting, and no broken link when the asset is moved.
Print a WiFi join code for a venue
The WiFi endpoint produces a code that joins the network on scan, with the SSID and password escaped correctly. Guests connect without anyone reading a password aloud.
Let an agent produce a scannable code
Over MCP, an agent generating a ticket, a booking or an event can attach a working QR code without any image tooling.
Use QR Codes from an AI agent
Every endpoint above is also an MCP tool. Pick your client and the steps below fill in with this API’s real server URL, so there is nothing to substitute.
In claude.ai and the Claude desktop app
- 1Open Settings, then Connectors.
- 2Choose Add custom connector.
- 3Paste the server URL below and confirm.
- 4A Twotic sign-in page opens. Approve the connection.
- 5Start a new conversation. The tools are available there.
Server URL
https://www.twotic.dev/api/mcp/qrSigns you in through Twotic. Access expires hourly and renews itself, and you can revoke this one app without touching your API keys.
Once connected, the tools are named qr_<endpoint>. Every QR Codes endpoint becomes one. Calls are metered exactly like an HTTP request, against the same allowance and balance.
Frequently asked
What is the content limit?+
About 213 bytes, which covers URLs, WiFi credentials and short text comfortably. Longer content is refused with a clear message rather than silently truncated into an unscannable code.
Can I get a PNG?+
The endpoint returns SVG, or the raw module matrix as JSON if you set format=json. SVG converts to PNG in one step with any rendering library, and vector is the better source for print in every case.
Are these dynamic QR codes?+
No. The code encodes exactly the content you supply. To change the destination later, encode a URL you control and redirect it — which is how every dynamic QR product works underneath.
Why does my code fail to scan?+
Almost always contrast or quiet zone. Keep the dark colour genuinely dark against a light background — inverted codes are unreliable on many scanners — and leave the margin at four modules or more.