GET
/qr/wifiGenerate a WiFi join QR code
Builds a WIFI: payload and returns it as a scannable SVG. Scanning it joins the network on both iOS and Android.
Special characters in the SSID and password are escaped as the format requires — without that, a network name containing a semicolon or comma produces a code that quietly fails or joins the wrong network.
$0.0005 per call300 req/minFree allowance applies
Request
curl -X GET "https://www.twotic.dev/v1/qr/qr/wifi" \
-H "Authorization: Bearer $TWOTIC_KEY"const res = await fetch("https://www.twotic.dev/v1/qr/qr/wifi", {
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/wifi",
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/wifi", 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/wifi");
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/wifi")
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" }
}
}
}Parameters
query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| ssid | string | required | The network name.e.g. Cafe Guest |
| password | string | optional | The network password. Omit when encryption is NOPASS. |
| encryption | string | optional | Security type. Defaults to WPA.one of: WPA · WEP · NOPASS |
| scale | integer | optional | Pixels per module, 1-40. Defaults to 8. |
Response
200The join code as an SVG image.
As an agent tool
Connect https://www.twotic.dev/api/mcp/qr and this endpoint is exposed as the tool qr_wifi.
Generate a QR code that joins a WiFi network when scanned, from an SSID, password and encryption type. Choose this over the general QR tool for network credentials — it builds the WIFI: payload and escapes special characters correctly, which is easy to get wrong by hand. Requires `ssid`; `password` unless encryption is NOPASS.