API reference
Live tests
Ping and traceroute from a pingbox inside the network
- Ping
POST /v1/ping - Traceroute
POST /v1/traceroute
Ping
Ping an IP address, hostname or device (by infid) from a pingbox inside your network. It sends count probes 200 ms apart and returns each probe plus a summary. You often won't need it: ping history for backhauls (almost continuous), devices (about every 10 seconds) and CPEs (about every minute) is already in get_device_history, get_backhaul_history and get_cpe_history (series pings). It's handy for addresses we don't monitor, a particular pingbox's point of view, or a quick burst. A device is pinged from the pingbox that monitors it and anything else from your network default, unless you pass a pingboxid from list_pingboxes. Hostnames are looked up in public DNS.
Needs the actions scope.
Parameters
-
ispstring queryISP code from GET /isps. Optional when the key reaches exactly one ISP.
Request body
JSON.
-
targetstring or integerDotted IPv4, hostname, or device infid
-
countinteger optionalProbes to send (default 10, max 20)
-
pingboxidinteger optionalPingbox to run from, from
list_pingboxes(default: the device's own pingbox for an infid, otherwise your network default)
Response
-
targetobject3 fields
-
inputstring -
ipstring -
namestring nullableDevice name for an infid, the hostname for a hostname
-
-
pingboxobjectThe pingbox the test ran from
2 fields
-
pingboxidinteger -
namestring
-
-
sentinteger -
receivedinteger -
loss_pctnumber -
rtt_msobject nullableMilliseconds; null when nothing answered
3 fields
-
minnumber -
avgnumber -
maxnumber
-
-
probesarray of objectsEach item: 3 fields
-
rtt_msnumber nullable -
ttlinteger nullable -
errorstring nullable
-
Example
curl -X POST -H "Authorization: Bearer $SWIFTFOX_KEY" \
-H "Content-Type: application/json" -d '{"target":"10.0.0.1"}' \
"https://api.swiftfox.net/v1/ping?isp=yourisp" Response (example data):
{
"target": {
"input": "230",
"ip": "10.10.7.21",
"name": "Hilltop Sector 1"
},
"pingbox": {
"pingboxid": 1,
"name": "Hilltop"
},
"sent": 3,
"received": 3,
"loss_pct": 0,
"rtt_ms": {
"min": 2.31,
"avg": 2.6,
"max": 3.02
},
"probes": [
{
"rtt_ms": 2.31,
"ttl": 62,
"error": null
},
{
"rtt_ms": 2.47,
"ttl": 62,
"error": null
},
{
"rtt_ms": 3.02,
"ttl": 62,
"error": null
}
]
} Traceroute
A traceroute from a pingbox inside your network to an IP address, hostname or device (by infid). It runs a few sweeps and merges them per hop with loss and latency, like MTR. Hops are labelled with your device names and infids, the backhaul crossed between two known devices (backhaul_from_prev, for get_backhaul), or the network owner for public hops when we already know it. Empty first sweeps are retried automatically (see rounds_completed). A device is traced from the pingbox that monitors it and anything else from your network default, unless you pass a pingboxid from list_pingboxes. Hostnames are looked up in public DNS.
Needs the actions scope.
Parameters
-
ispstring queryISP code from GET /isps. Optional when the key reaches exactly one ISP.
Request body
JSON.
-
targetstring or integerDotted IPv4, hostname, or device infid
-
roundsinteger optionalTTL sweeps to run (default 3, max 5)
-
pingboxidinteger optionalPingbox to run from, from
list_pingboxes(default: the device's own pingbox for an infid, otherwise your network default)
Response
-
targetobject3 fields
-
inputstring -
ipstring -
namestring nullableDevice name for an infid, the hostname for a hostname
-
-
pingboxobjectThe pingbox the test ran from
2 fields
-
pingboxidinteger -
namestring
-
-
rounds_requestedinteger -
rounds_completedinteger -
sweeps_attemptedinteger -
reachedboolean -
warningstring optional -
hopsarray of objectsEach item: 8 fields
-
ttlinteger -
ipstring nullablenull = no reply at this hop
-
deviceobject optionalA Swift Fox device with this IP
2 fields
-
infidinteger -
namestring
-
-
asnstring optionalPublic hops
-
ownerstring optionalPublic hops
-
loss_pctnumber -
rtt_msobject nullableMilliseconds; null when nothing answered
3 fields
-
minnumber -
avgnumber -
maxnumber
-
-
backhaul_from_prevobject optionalThe backhaul crossed from the previous hop
2 fields
-
bhidinteger -
namestring
-
-
Example
curl -X POST -H "Authorization: Bearer $SWIFTFOX_KEY" \
-H "Content-Type: application/json" -d '{"target":"10.0.0.1"}' \
"https://api.swiftfox.net/v1/traceroute?isp=yourisp" Response (example data):
{
"target": {
"input": "230",
"ip": "10.10.7.21",
"name": "Hilltop Sector 1"
},
"pingbox": {
"pingboxid": 0,
"name": "Riverbend Cloud"
},
"rounds_requested": 3,
"rounds_completed": 3,
"sweeps_attempted": 3,
"reached": true,
"hops": [
{
"ttl": 1,
"ip": "10.10.0.1",
"device": {
"infid": 101,
"name": "Core Router"
},
"loss_pct": 0,
"rtt_ms": {
"min": 0.31,
"avg": 0.35,
"max": 0.41
}
},
{
"ttl": 2,
"ip": "10.10.7.1",
"device": {
"infid": 214,
"name": "Hilltop Router"
},
"loss_pct": 0,
"rtt_ms": {
"min": 1.02,
"avg": 1.14,
"max": 1.38
},
"backhaul_from_prev": {
"bhid": 12,
"name": "RB-HT"
}
},
{
"ttl": 3,
"ip": "10.10.7.21",
"device": {
"infid": 230,
"name": "Hilltop Sector 1"
},
"loss_pct": 0,
"rtt_ms": {
"min": 2.29,
"avg": 2.55,
"max": 2.98
}
}
]
}