GeoNiq provides an easy API to query IP addresses and get geolocation, security, and network information.
GET /
Returns the IP address of the requester.
Defaults response format to json.
Code Examples
import requests
req = requests.get("https://geoniq.paragonnet.xyz/api/v1/geo")
print(req.json())
<?php
$curl = curl_init("https://geoniq.paragonnet.xyz/api/v1/geo/");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
curl_close($curl);
print_r(json_decode($response, true));
?>
fetch("https://geoniq.paragonnet.xyz/api/v1/geo")
.then(res => res.json())
.then(console.log);
GET /{ip}
Returns detailed information about a specific IP.
Defaults response format to json.
Code Examples
import requests
req = requests.get("https://geoniq.paragonnet.xyz/api/v1/geo/YOUR_IP_ADDRESS")
print(req.json())
<?php
$curl = curl_init("https://geoniq.paragonnet.xyz/api/v1/geo/YOUR_IP_ADDRESS");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
curl_close($curl);
print_r(json_decode($response, true));
?>
fetch("https://geoniq.paragonnet.xyz/api/v1/geo/YOUR_IP_ADDRESS")
.then(res => res.json())
.then(console.log);
GET /{ip1},{ip2},...
Query multiple IPs at once. Returns an array of results.
Append ?format=json|xml|yaml to request URL.
After getting the response, you can access fields like city, country, or currency:
Code Examples
import requests
req = requests.get("https://geoniq.paragonnet.xyz/api/v1/geo/YOUR_IP_ADDRESS")
data = req.json()
print("City:", data['data']['city'])
print("Country:", data['data']['country'])
print("Currency:", data['data']['currency']['code'])
<?php
$curl = curl_init("https://geoniq.paragonnet.xyz/api/v1/geo/YOUR_IP_ADDRESS");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
curl_close($curl);
$GeoNiq = json_decode($response);
echo "City: " . $GeoNiq->data->city . "\n";
echo "Country: " . $GeoNiq->data->country . "\n";
echo "Currency: " . $GeoNiq->data->currency->code . "\n";
?>
fetch("https://geoniq.paragonnet.xyz/api/v1/geo/YOUR_IP_ADDRESS")
.then(res => res.json())
.then(data => {
console.log("City:", data.data.city);
console.log("Country:", data.data.country);
console.log("Currency:", data.data.currency.code);
});