Get started with the IpQuery.Info API
One endpoint enriches any IPv4 or IPv6 address with geolocation, ASN and registry, mobile carrier, VPN/proxy/Tor, cloud, crawler, threat-list, and anycast/multicast data. Companion endpoints profile an AS or a prefix and turn the signals into an allow / challenge / block decision.
Prefer to see it first? Try the API live — no signup — then come back for the details. The full field list is in the API reference.
Endpoint
GET https://ipquery.info/api
Also available:
| Endpoint | Plan | What it returns |
|---|---|---|
GET /api/asn/{asn} | All | AS name, country, registry, allocation date, type and its announced IPv4/IPv6 prefixes (up to 1,000 each). 15169 or AS15169. |
GET /api/prefix?cidr=8.8.8.0/24 | All | The announced prefix covering a CIDR or single IP, with its origin AS, country, registry and cloud/hosting flags. |
POST /api/assess | Advanced, Business, first 15 days | An allow / challenge / block decision with reasons, for signup, checkout and login flows. |
GET /api/meta | No key needed | Every dataset behind the API with its source, licence and last update. Not metered. |
Each costs one request unit except /api/meta, which is free. Details are in the API reference.
Authentication
Prefer an Authorization: Bearer API_KEY header. Create and manage keys on the API Keys page. URL-only clients may use ?apiKey=API_KEY when query-key compatibility is enabled; use a dedicated restricted key rather than a primary server key. For public/client-side use, enable Record-Only mode plus an origin allowlist.
Query parameters
| Parameter | Required | Description |
|---|---|---|
ip | No | A single IPv4/IPv6 address. Omit all selectors to query the caller's own IP. |
ipList | No | Comma-separated batch of addresses (whitespace stripped). The same list can be sent in a POST body for larger batches. |
fields | No | Comma-separated response fields to include, for example country_iso_code,is_vpn,risk_score. query_ip_address is always returned. |
tag | No | Arbitrary label (max 20 chars) recorded with successful lookups for analytics segmentation. |
ua | No | User-Agent string to use for crawler detection instead of the request header. Only meaningful with ip. |
reverse | No | Set to true to request bounded reverse-DNS enrichment. |
compat | No | Pass v1 for the pre-2026-08 is_vpn / is_proxy semantics (supported until 1 February 2027). |
Code samples
cURL
curl -H "Authorization: Bearer YOUR_API_KEY" "https://ipquery.info/api?ip=8.8.8.8&tag=signup-flow"
JavaScript (fetch)
const res = await fetch(
"https://ipquery.info/api?ip=8.8.8.8",
{ headers: { Authorization: "Bearer YOUR_API_KEY" } }
);
const data = await res.json();
console.log(data[0].country, data[0].is_vpn);
Python (requests)
import requests
r = requests.get("https://ipquery.info/api",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"ip": "8.8.8.8"})
result = r.json()[0]
print(result["country"], result["asn_name"])
Node.js
const https = require("https");
const options = {
hostname: "ipquery.info",
path: "/api?ip=8.8.8.8",
headers: { Authorization: "Bearer YOUR_API_KEY" }
};
https.get(options, (res) => {
let body = "";
res.on("data", (chunk) => (body += chunk));
res.on("end", () => {
const result = JSON.parse(body)[0];
console.log(result.country, result.is_vpn);
});
});
PHP
<?php
$query = http_build_query([
"ip" => "8.8.8.8",
]);
$context = stream_context_create(["http" => [
"header" => "Authorization: Bearer YOUR_API_KEY\r\n",
]]);
$json = file_get_contents("https://ipquery.info/api?$query", false, $context);
$result = json_decode($json, true)[0];
echo $result["country"] . " " . $result["asn_name"];
Go
package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://ipquery.info/api?ip=8.8.8.8", nil)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
var results []map[string]interface{}
json.NewDecoder(resp.Body).Decode(&results)
fmt.Println(results[0]["country"], results[0]["asn_name"])
}
Ruby
require "net/http"
require "json"
require "uri"
uri = URI("https://ipquery.info/api")
uri.query = URI.encode_www_form(ip: "8.8.8.8")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer YOUR_API_KEY"
result = JSON.parse(Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request).body }).first
puts "#{result['country']} #{result['asn_name']}"
Java
import java.net.URI;
import java.net.http.*;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://ipquery.info/api?ip=8.8.8.8"))
.header("Authorization", "Bearer YOUR_API_KEY")
.build();
HttpResponse<String> response =
client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
C# (.NET)
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "YOUR_API_KEY");
var json = await client.GetStringAsync("https://ipquery.info/api?ip=8.8.8.8");
using var doc = JsonDocument.Parse(json);
var first = doc.RootElement[0];
Console.WriteLine(first.GetProperty("country").GetString());
Batch lookups
Pass a comma-separated ipList, or send a POST body containing a JSON array, JSON object with ips, or plain text/CSV list. The response is an array with one object per address, in order. Batch lookups are capped at 1,000 addresses, consume one unit of quota per successfully enriched address, and are recorded in your analytics charts.
curl -H "Authorization: Bearer YOUR_API_KEY" "https://ipquery.info/api?ipList=8.8.8.8,1.1.1.1,2606:4700:4700::1111"
curl -X POST "https://ipquery.info/api?fields=country_iso_code,is_vpn,risk_score" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '["8.8.8.8","1.1.1.1"]'
Assess a visitor in one call
On the Advanced plan (and during the trial), POST /api/assess returns a decision you can act on directly. Rules are optional; anything you leave out falls back to the rules saved on the key, then to the defaults. If geolocation evidence is unavailable and no Tor, VPN, proxy, relay, datacenter or abuser list matched, it returns 503 enrichment_unavailable without a decision or usage charge. Do not treat that error as an allow decision.
curl -X POST "https://ipquery.info/api/assess" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ip":"203.0.113.7","email":"someone@example.com","rules":{"vpn":"challenge","tor":"block"}}'
Attribution
Geolocation comes from DB-IP IP to City Lite (CC BY 4.0). If you show geolocation results publicly, credit it with a link: <a href="https://db-ip.com">IP Geolocation by DB-IP</a>.