API Examples
End-to-end snippets you can drop into a dashboard, a cron job or a Discord bot.
cURL — read live hashrate
curl -s http://192.168.1.42/api/system/info \
| jq '.miner.hashRate * 1e9'
Prints the current hashrate in H/s.
cURL — push a new pool URL to a swarm of miners
for ip in 192.168.1.42 192.168.1.43 192.168.1.44; do
curl -X POST "http://${ip}/api/setting/mining" \
-H "Content-Type: application/json" \
-d '{"PrimaryPool":"stratum+tcp://solobtc.nmminer.com:3333"}'
done
Python — total LAN hashrate
import requests
# Pick any one reachable miner to bootstrap discovery.
seed = "192.168.1.42"
ips = requests.get(f"http://{seed}/alive", timeout=2).json()["ips"]
total_hs = 0.0
for ip in ips:
try:
info = requests.get(f"http://{ip}/api/system/info", timeout=2).json()
total_hs += info["miner"]["hashRate"] * 1e9
except Exception as e:
print(f"{ip}: {e}")
print(f"Total LAN hashrate: {total_hs/1e3:,.1f} KH/s across {len(ips)} miner(s)")
Python — find every miner physically
import requests
seed = "192.168.1.42"
ips = requests.get(f"http://{seed}/alive", timeout=2).json()["ips"]
for ip in ips:
requests.post(f"http://{ip}/api/swarm/find", timeout=2)
print(f"flashing {ip}")
Walk through the house — each miner will blink in turn.
JavaScript (browser) — minimal live dashboard
<!DOCTYPE html>
<html>
<head><title>NMMiner Live</title></head>
<body>
<pre id="out">loading...</pre>
<script>
const SEED = "192.168.1.42";
async function tick() {
const alive = await fetch(`http://${SEED}/alive`).then(r => r.json());
const rows = await Promise.all(
alive.ips.map(ip => fetch(`http://${ip}/api/system/info`)
.then(r => r.json())
.then(j => ({
ip,
host: j.identity.hostName,
ver: j.identity.fwVersion,
khs: (j.miner.hashRate * 1e6).toFixed(1),
acc: j.miner.sAccepted,
rej: j.miner.sRejected,
bestEv: j.miner.bestDiffEver,
})).catch(() => null))
);
const lines = rows.filter(Boolean).map(r =>
`${r.host.padEnd(24)} ${r.ip.padEnd(15)} ${r.khs.padStart(7)} KH/s` +
` acc=${r.acc} rej=${r.rej} bestEver=${r.bestEv}`
);
document.getElementById("out").textContent =
`NMMiner LAN — ${rows.length} miners\n\n` + lines.join("\n");
}
tick(); setInterval(tick, 5000);
</script>
</body>
</html>
Open the file in any browser — CORS is wide-open by design.
Python — restart all miners at a given time
import requests, datetime, time
ips = ["192.168.1.42", "192.168.1.43", "192.168.1.44"]
target = datetime.datetime(2026, 7, 1, 3, 0, 0)
while datetime.datetime.now() < target:
time.sleep(30)
for ip in ips:
try:
requests.post(f"http://{ip}/api/system/restart", timeout=2)
print(f"restart sent to {ip}")
except Exception as e:
print(f"{ip}: {e}")
Avoid running this more often than necessary — every restart drops the Stratum session and any pending shares.