JSON API

IPTest.ro API documentation

JSON responses for the visitor IP or an explicitly supplied address.

Endpoint

GET https://iptest.ro/api/ip
GET https://iptest.ro/api/ip?ip=8.8.8.8

JavaScript

const response = await fetch('https://iptest.ro/api/ip');
const data = await response.json();
console.log(data.ip);

PHP

$json = file_get_contents('https://iptest.ro/api/ip?ip=8.8.8.8');
$data = json_decode($json, true);
echo $data['ip'];

Response fields

ip, version, country_code, country_ro, country_en, operator, is_cloudflare, cidr, source.