Ping Test API Reference
Perform a ping test to a host from multiple geographic locations.
Service details and pricing: Ping Test API
Request example
Query the endpoint via an HTTPS POST request (replace YOUR_API_KEY_HERE with your API key):
curl -X POST "https://api.apivoid.com/v2/ping-test" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-d '{"host": "google.com"}'The same request in PHP:
$host = 'google.com';
$apiKey = 'YOUR_API_KEY_HERE';
$curl = curl_init('https://api.apivoid.com/v2/ping-test');
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'X-API-Key: ' . $apiKey]);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode(['host' => $host]));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if ($httpCode === 200) {
$responseData = json_decode($response, true);
print_r($responseData);
} else {
print_r('An error occurred: '.$response);
}Request parameters
Required
Host to submit, e.g. google.com.
⚠ Government and educational domains are blocked.
Response example
A successful request returns HTTP 200 with a JSON body:
{
"host": "google.com",
"locations": [
{
"continent_code": "NA",
"continent_name": "North America",
"country_code": "US",
"country_name": "United States",
"city_name": "San Francisco",
"ping_output": {
"host": "google.com",
"ip_address": "142.251.46.238",
"ip_hostname": "sfo03s27-in-f14.1e100.net",
"is_valid_ip": true,
"is_private_ip": false,
"is_loopback_ip": false,
"is_reserved_ip": false,
"packets_sent": 3,
"packets_received": 3,
"percent_packet_loss": 0,
"icmp_requests": [
{
"bytes": 64,
"icmp_seq": 1,
"ttl": 117,
"time_ms": 0.977
},
{
"bytes": 64,
"icmp_seq": 2,
"ttl": 117,
"time_ms": 0.689
},
{
"bytes": 64,
"icmp_seq": 3,
"ttl": 117,
"time_ms": 0.454
}
],
"rtt": {
"min": 0.454,
"avg": 0.706,
"max": 0.977,
"mdev": 0.213
},
"elapsed_ms": 2018
},
"error": ""
},
{
"continent_code": "AS",
"continent_name": "Asia",
"country_code": "IN",
"country_name": "India",
"city_name": "Bangalore",
"ping_output": {
"host": "google.com",
"ip_address": "142.250.70.110",
"ip_hostname": "pnbomb-ac-in-f14.1e100.net",
"is_valid_ip": true,
"is_private_ip": false,
"is_loopback_ip": false,
"is_reserved_ip": false,
"packets_sent": 3,
"packets_received": 3,
"percent_packet_loss": 0,
"icmp_requests": [
{
"bytes": 64,
"icmp_seq": 1,
"ttl": 118,
"time_ms": 18
},
{
"bytes": 64,
"icmp_seq": 2,
"ttl": 118,
"time_ms": 17.5
},
{
"bytes": 64,
"icmp_seq": 3,
"ttl": 118,
"time_ms": 17.3
}
],
"rtt": {
"min": 17.262,
"avg": 17.594,
"max": 17.999,
"mdev": 0.305
},
"elapsed_ms": 2022
},
"error": ""
},
...
],
"elapsed_ms": 3279
}Response fields
The fields returned in the JSON response:
hoststring
Host submitted for the ping test.
locationsarray
List of geographic locations with the ping output from each location.
locations[n] → continent_codestring
Continent code (e.g. NA) of the pinging location.
locations[n] → continent_namestring
Continent name of the pinging location.
locations[n] → country_codestring
Country code (e.g. US) of the pinging location.
locations[n] → country_namestring
Country name of the pinging location.
locations[n] → city_namestring
City name of the pinging location.
locations[n] → ping_output → hoststring
Host that was pinged.
locations[n] → ping_output → ip_addressstring
IP address the host resolved to from this location.
locations[n] → ping_output → ip_hostnamestring
Hostname (reverse DNS) of the resolved IP address.
locations[n] → ping_output → is_valid_ipboolean
Returns true if the resolved IP address is valid.
locations[n] → ping_output → is_private_ipboolean
Returns true if the resolved IP address is private.
locations[n] → ping_output → is_loopback_ipboolean
Returns true if the resolved IP address is a loopback address.
locations[n] → ping_output → is_reserved_ipboolean
Returns true if the resolved IP address is reserved.
locations[n] → ping_output → packets_sentinteger
Number of ICMP packets sent.
locations[n] → ping_output → packets_receivedinteger
Number of ICMP packets received.
locations[n] → ping_output → percent_packet_lossinteger
Percentage of packets lost.
locations[n] → ping_output → icmp_requestsarray
List of ICMP requests; each item has bytes, icmp_seq, ttl and time_ms.
locations[n] → ping_output → icmp_requests[n] → bytesinteger
Number of bytes in the ICMP echo reply.
locations[n] → ping_output → icmp_requests[n] → icmp_seqinteger
Sequence number of the ICMP request.
locations[n] → ping_output → icmp_requests[n] → ttlinteger
Time-to-live (TTL) value in the ICMP reply.
locations[n] → ping_output → icmp_requests[n] → time_msfloat
Round-trip time of the ICMP request, in milliseconds.
locations[n] → ping_output → rtt → minfloat
Minimum round-trip time in milliseconds.
locations[n] → ping_output → rtt → avgfloat
Average round-trip time in milliseconds.
locations[n] → ping_output → rtt → maxfloat
Maximum round-trip time in milliseconds.
locations[n] → ping_output → rtt → mdevfloat
Round-trip time standard deviation in milliseconds.
locations[n] → ping_output → elapsed_msinteger
Time taken by the ping test from this location, in milliseconds.
locations[n] → errorstring
Error message if the ping from this location failed.
elapsed_msinteger
Time taken to process the request, in milliseconds.