DNS leak test API
Verify whether your VPN is routing all DNS lookups inside its tunnel or leaking them to your ISP. Your browser resolves unique one-time hostnames controlled exclusively by our authoritative test server - identifying the exact resolvers handling your traffic, detecting EDNS Client Subnet exposure, and auto-expiring test records after 10 minutes.
api.middle.network/v1/tools/dns-leakRequest body
Send JSON: { "input": { … } } with these fields. Fields not listed are ignored.
tokenstringrequiredThe test id the browser looked up names under (from the DNS leak test page).Up to 40 characterssentintegeroptionalHow many test names the browser looked up.1 to 20 · Default6
Response
The same result shape every tool uses. status is the worst finding, summary and each finding come in plain and tech, and data holds the raw DNS leak test detail.
200The test ran. RateLimit headers show what’s left today.400The input broke the schema, or the target is not valid (with suggestions when it looks like a typo).401No API key, or the key is not valid or was revoked.403The tool sends traffic at the target and isn’t open to API keys yet (activeTool), or the target’s owner has asked not to be tested (optedOut).429Too many checks: per minute, per day, or at the same target.
curl -X POST https://api.middle.network/v1/tools/dns-leak \
-H "Authorization: Bearer $MN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input":{"token":"k3v9q2x7m1p8r4t6w0yz"}}'const res = await fetch("https://api.middle.network/v1/tools/dns-leak", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MN_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"input":{"token":"k3v9q2x7m1p8r4t6w0yz"}}),
});
const result = await res.json();
console.log(result.status, result.summary.plain);import os, requests
res = requests.post("https://api.middle.network/v1/tools/dns-leak",
headers={"Authorization": f"Bearer {os.environ['MN_API_KEY']}"},
json={"input":{"token":"k3v9q2x7m1p8r4t6w0yz"}})
result = res.json()
print(result["status"], result["summary"]["plain"]){
"tool": "dns-leak",
"target": "k3v9q2x7m1p8r4t6w0yz",
"status": "pass",
"summary": {
"tech": "…",
"plain": "…"
},
"findings": [
{
"level": "pass",
"tech": "…",
"plain": "…"
}
],
"data": {},
"ms": 420,
"at": "2026-01-01T00:00:00.000Z"
}Put your key in MN_API_KEY. No key yet? Here’s how to get one. More in this group: DNS propagation, DNSSEC validation, DNS health report, Authoritative vs cached.
Try it without code
The same test runs free in your browser, no key needed.