Tutto quello che ti serve per integrare OpenIPApi nella tua applicazione. URL base: https://api.openipapi.com (versionato come /v1).
threat_score e i flag VPN/proxy/Tor sono input per la tua logica decisionale. Combinali con segnali di account, pagamento, dispositivo e comportamento — non usarli mai come unica base per il blocco. Vedi la Metodologia dei dati per i dettagli.
Tutte le richieste API devono includere la tua chiave API nell'header X-API-Key Puoi trovare la tua chiave API nella console.
X-API-Key: oip_your_api_key_here
Tutte le richieste API vengono effettuate al seguente URL base tramite HTTPS:
https://api.openipapi.com
Specifica leggibile dalla macchina (OpenAPI 3.1): /openapi.yaml.
Tutte le risposte sono JSON. Le risposte di successo restituiscono HTTP 200.
Le risposte di errore restituiscono un codice di stato 4xx o 5xx appropriato con un campo error .
{
"error": "invalid_api_key",
"message": "The provided API key is invalid or has been revoked.",
"status": 401
}
Cerca geolocalizzazione, rete e dati di minaccia per un singolo indirizzo IP.
https://api.openipapi.com/v1/lookup/{ip}
| Parametro | Tipo | Descrizione |
|---|---|---|
| ip | path | Indirizzo IPv4 o IPv6 da cercare. |
| fields | query (optional) | Elenco separato da virgole dei campi di primo livello da restituire: geo,network,threat,abuse. |
| date | query (optional) | Ricerca storica — restituisce lo snapshot per questo IP alla data indicata (YYYY-MM-DD). Fino a 365 giorni indietro. Richiede Pro+. Restituisce un no_snapshot errore se non sono disponibili dati per quella data. |
| Campo | Descrizione | Piano |
|---|---|---|
| ip | The queried IP address. | All |
| type | IPv4 or IPv6. | All |
| geo.country_code | 2-letter ISO 3166-1 country code. | All |
| geo.country | Full country name. | All |
| geo.region | Region / state name. | All |
| geo.region_code | Region / state code. | All |
| geo.city | City name. | All |
| geo.postal_code | Postal / ZIP code. | All |
| geo.latitude | Latitude (decimal degrees). | All |
| geo.longitude | Longitude (decimal degrees). | All |
| geo.timezone | IANA timezone identifier (e.g. Europe/Berlin). | All |
| geo.is_sanctioned | True if the country is on OFAC, EU, or UN sanction lists. | All |
| geo.sanction_lists | Array of applicable sanction programs, e.g. ["OFAC","EU"]. | All |
| network.asn | Autonomous System Number. | Starter+ |
| network.as_name | AS organisation name. | Starter+ |
| network.as_domain | AS organisation domain. | Starter+ |
| network.isp | Internet Service Provider name. | All |
| network.organization | Network organisation name. | All |
| network.connection_type | residential, datacenter, mobile, education, or government. | All |
| threat.is_vpn | True if the IP is a known VPN endpoint. | Pro+ |
| threat.is_proxy | True if the IP is a known open proxy. | Pro+ |
| threat.is_tor | True if the IP is a Tor exit node. | Pro+ |
| threat.is_relay | True if the IP is an anonymous relay. | Pro+ |
| threat.is_hosting | True if the IP belongs to a hosting provider. | Pro+ |
| threat.threat_score | Composite risk score 0–100. A signal, not a final verdict — combine with account, payment, device and behavior data. | Pro+ |
| threat.threat_categories | Array of threat category strings. | Pro+ |
| threat.bot_type | Verified bot identifier (e.g. "googlebot", "bingbot") or null. Verified via reverse-DNS + forward confirmation. | All |
| abuse.contact_email | Abuse contact email from WHOIS data. | Pro+ |
$ curl https://api.openipapi.com/v1/lookup/185.220.101.45 \
-H "X-API-Key: oip_your_api_key_here"
{
"ip": "185.220.101.45",
"type": "IPv4",
"geo": {
"country_code": "DE",
"country": "Germany",
"region": "Hessen",
"region_code": "HE",
"city": "Frankfurt am Main",
"postal_code": "60313",
"latitude": 50.1109,
"longitude": 8.6821,
"timezone": "Europe/Berlin",
"is_sanctioned": false,
"sanction_lists": []
},
"network": {
"asn": 205100,
"as_name": "F3 Netze e.V.",
"as_domain": "f3netze.de",
"isp": "F3 Netze",
"organization": "F3 Netze e.V.",
"connection_type": "datacenter"
},
"threat": {
"is_vpn": true,
"is_proxy": false,
"is_tor": true,
"is_relay": false,
"is_hosting": true,
"threat_score": 85,
"threat_categories": ["tor_exit_node", "known_abuser"],
"bot_type": null
},
"abuse": {
"contact_email": "abuse@f3netze.de"
}
}
Cerca più indirizzi IP in una singola richiesta. I limiti di dimensione del batch dipendono dal piano.
https://api.openipapi.com/v1/lookup/batch
plan_required errore. | Piano | Max IP per richiesta |
|---|---|
| Starter | 100 |
| Pro | 500 |
| Business | 1,000 |
| Enterprise | 5,000 |
{
"ips": [
"185.220.101.45",
"8.8.8.8",
"1.1.1.1"
]
}
Restituisce un array incapsulato di oggetti di ricerca completi, nello stesso ordine della richiesta.
{
"results": [
{ "ip": "185.220.101.45", /* full lookup object */ },
{ "ip": "8.8.8.8", /* full lookup object */ },
{ "ip": "1.1.1.1", /* full lookup object */ }
],
"count": 3
}
Restituisce geolocalizzazione e dati di minaccia per l'indirizzo IP che effettua la richiesta. Utile per le funzionalità "Qual è il mio IP?".
https://api.openipapi.com/v1/me
La risposta è identica a GET /v1/lookup/{ip} con l'IP del chiamante pre-compilato.
$ curl https://api.openipapi.com/v1/me \
-H "X-API-Key: oip_your_api_key_here"
Recupera informazioni dettagliate su un Autonomous System Number. Richiede il piano Starter o superiore.
https://api.openipapi.com/v1/asn/{asn}
Il asn parametro accetta sia 13335 che AS13335 formati.
$ curl https://api.openipapi.com/v1/asn/13335 \
-H "X-API-Key: oip_your_api_key_here"
{
"asn": 13335,
"as_name": "Cloudflare, Inc.",
"as_domain": "cloudflare.com",
"organization": "Cloudflare, Inc.",
"country_code": "US",
"ip_ranges_count": 1284,
"total_ips": 2359296
}
Valida un indirizzo IP e determina il suo tipo. Non consuma quota di ricerca.
https://api.openipapi.com/v1/validate/{ip}
{
"ip": "185.220.101.45",
"valid": true,
"type": "IPv4",
"private": false,
"bogon": false
}
Fraud score composito (0–100) con livello di rischio e raccomandazione operativa. Combina segnali VPN, proxy, Tor, datacenter e abusi storici. Piano Starter o superiore
https://api.openipapi.com/v1/fraud/{ip}
{
"ip": "185.220.101.45",
"fraud_score": 92,
"risk_level": "critical",
"signals": {
"is_vpn": true,
"is_proxy": false,
"is_tor": true,
"is_datacenter": true,
"is_known_attacker": true,
"high_risk_country": false
},
"recommendation": "block"
}
| Punteggio | Livello di rischio | Raccomandazione | Azione tipica |
|---|---|---|---|
| 0–30 | low | allow | Lascia passare la richiesta |
| 31–60 | medium | review | Registra per revisione manuale |
| 61–85 | high | challenge | Richiedi CAPTCHA / 2FA / autenticazione step-up |
| 86–100 | critical | block | Rifiuta e invia un alert |
Dati di probe di rete in tempo reale dai nostri 60+ nodi di probing attivo: porte TCP aperte, banner di servizio, reverse DNS, dettaglio completo del certificato TLS (soggetto, emittente, SAN, validità) e categorie di servizio rilevate. Piano Pro o superiore
https://api.openipapi.com/v1/probe/{ip}
"stale": true.{
"ip": "185.220.101.45",
"reachable": true,
"last_probed": "2026-04-18T14:23:11+00:00",
"age_hours": 2.3,
"stale": false,
"refresh_queued": false,
"probe_count_24h": 14,
"probed_from_nodes": 8,
"open_ports": [
{ "port": 22, "service": "ssh", "banner": "SSH-2.0-OpenSSH_8.9p1" },
{ "port": 80, "service": "http", "banner": "nginx/1.24.0" },
{ "port": 443, "service": "https", "banner": null },
{ "port": 9001, "service": "tor-relay", "banner": null }
],
"reverse_dns": "tor-exit.f3netze.de",
"tls": {
"subject_cn": "*.f3netze.de",
"issuer": "Let's Encrypt",
"valid_from": "2026-02-10T00:00:00Z",
"valid_to": "2026-05-10T00:00:00Z",
"sans": ["f3netze.de", "*.f3netze.de"],
"fingerprint": "7e:4f:...:b2:e1"
},
"banners": {
"22": "SSH-2.0-OpenSSH_8.9p1",
"80": "nginx/1.24.0"
},
"detected_services": {
"is_tor_relay": true,
"is_ssh_open": true,
"is_web_server": true,
"is_vpn": false,
"is_proxy": false
}
}
22 (ssh), 80 / 8080 (http), 443 / 8443 (https), 1080 (socks5), 3128 / 8888 (http-proxy), 9001 / 9030 (tor-relay / tor-dir), 9050 / 9150 (tor-socks), 1194 (openvpn), 4500 (ipsec-nat-t), 51820 (wireguard).
Identifica se un IP appartiene a un pool di proxy residenziali noto, a una VPN commerciale o a un range datacenter. A differenza dei generici flag is_proxy questo endpoint attribuisce l'IP al provider specifico (Bright Data, Oxylabs, NordVPN, ecc.) — fondamentale per i team antifrode che devono consentire alcuni provider e bloccare altri. Add-on Proxy Intel
https://api.openipapi.com/v1/proxy-attribution/{ip}
{
"ip": "2.56.16.42",
"detected": true,
"primary_provider": {
"provider": "unknown_vpn",
"display_name": "Unknown VPN",
"network_type": "vpn",
"confidence": 0.75
},
"networks": [
{
"provider": "unknown_vpn",
"network_type": "vpn",
"confidence": 0.75,
"source": "x4bnet-vpn",
"cidr": "2.56.16.0/22"
},
{
"provider": "unknown_datacenter",
"network_type": "datacenter",
"confidence": 0.75,
"source": "x4bnet-datacenter"
}
],
"recommendation": "treat_as_vpn"
}
residential — pool di proxy residenziali (Bright Data, Oxylabs, Smartproxy, IPRoyal, Hola, Honeygain, EarnApp, Peer2Profit, SOAX)vpn — provider VPN commerciali (NordVPN, ExpressVPN, Surfshark, Mullvad, ProtonVPN, PIA, IPVanish, CyberGhost)datacenter — provider di hosting frequentemente usati per uscita proxy commerciale (AWS, DigitalOcean, OVH, Hetzner, ecc.)tor — nodi di uscita / relay Tormobile — pool di proxy degli operatori mobile| Raccomandazione | Significato |
|---|---|
| no_proxy_detected | IP non corrisponde a nessun pool noto — trattare come traffico normale. |
| treat_as_commercial_proxy | IP in un pool di proxy residenziali — probabilmente dannoso su siti non di scraping. |
| treat_as_vpn | IP in un range VPN commerciale — applica la policy VPN. |
| treat_as_datacenter | IP da un range datacenter — non è un utente residenziale reale. |
| block_or_challenge | Nodo Tor — blocca o richiedi autenticazione forte. |
Restituisce le statistiche di utilizzo del periodo di fatturazione corrente per il tuo account.
https://api.openipapi.com/v1/account/usage
{
"plan": "Pro",
"period_start": "2026-03-01",
"period_end": "2026-03-31",
"lookups_used": 184320,
"lookups_limit": 500000,
"lookups_remaining": 315680,
"reset_at": "2026-04-01T00:00:00Z"
}
Elenca i database MMDB disponibili per il tuo piano. Sostituti drop-in MaxMind .mmdb per uso offline / edge — funziona con qualsiasi lettore MaxMind DB (PHP, Go, Python, Node.js, Rust, Java).
https://api.openipapi.com/v1/database/list
{
"plan": "Business",
"sources": [
{
"source": "country",
"filename": "geo-whois-asn-country.mmdb",
"size_bytes": 8225621,
"updated_at": "2026-04-18T02:00:00+00:00",
"etag": "\"fa2b851f9155838b\"",
"download_url": "https://api.openipapi.com/v1/database/download/country"
}
]
}
Trasmette il file MMDB grezzo. Supporta ETag +
If-None-Match per GET condizionali (304 Not Modified quando il file è invariato). Limite: 10 download per fonte al giorno.
https://api.openipapi.com/v1/database/download/{source}
| Fonte | Contenuto | Licenza | Piano richiesto |
|---|---|---|---|
| country | Codice paese + ASN | CC0 | Pro |
| asn | ASN + organizzazione | CC0 | Business |
| city-geolite2 | Città, regione, lat/lon, fuso orario (GeoLite2) | MaxMind GeoLite2 EULA | Business |
| city-dbip | Città (alternativa a GeoLite2) | DB-IP Lite | Enterprise |
# Download latest MMDB
$ curl -H "X-API-Key: YOUR_KEY" \
-o asn.mmdb \
https://api.openipapi.com/v1/database/download/asn
# Use with maxmind-db/reader
$ composer require maxmind-db/reader
<?php
use MaxMind\Db\Reader;
$reader = new Reader('asn.mmdb');
$record = $reader->get('8.8.8.8');
// ['autonomous_system_number' => 15169,
// 'autonomous_system_organization' => 'Google LLC']
Ogni /v1/lookup risposta include due campi nel blocco geo che indicano se il paese dell'IP è soggetto a sanzioni internazionali.
| Campo | Descrizione |
|---|---|
| geo.is_sanctioned | true se il paese compare in una lista di sanzioni monitorata; false altrimenti. |
| geo.sanction_lists | Array degli identificatori dei programmi di sanzione applicabili: OFAC, EU, UN, UK. Array vuoto [] quando non sono presenti sanzioni. |
Liste di sanzioni coperte: OFAC (USA), UE, Consiglio di Sicurezza ONU, UK OFSI. I paesi attualmente contrassegnati includono Iran, Corea del Nord, Russia, Bielorussia, Siria, Cuba, Venezuela, Sudan e altri. La lista è mantenuta e aggiornata al variare dei programmi.
"geo": {
"country_code": "IR",
"country": "Iran",
...
"is_sanctioned": true,
"sanction_lists": ["OFAC", "EU", "UN"]
}
OpenIPApi esegue verifica DNS inverso doppio per identificare i crawler legittimi. Il risultato è disponibile in threat.bot_type per ogni ricerca.
| Campo | Valori |
|---|---|
| threat.bot_type |
null (non è un bot verificato) oppure uno tra: googlebot,
google_special_crawl,
bingbot,
applebot,
yandexbot,
duckduckbot,
facebookbot,
semrushbot,
ahrefsbot,
mj12bot
|
Metodo di verifica: (1) lookup PTR sull'IP → hostname. (2) L'hostname deve corrispondere al pattern di dominio del bot (es. *.googlebot.com). (3) Il DNS forward sull'hostname deve risolvere all'IP originale. I risultati sono in cache per 24 ore.
"threat": {
"is_vpn": false,
"is_proxy": false,
"is_tor": false,
"threat_score": 0,
"bot_type": "googlebot"
}
Aggiungi un parametro ?date=YYYY-MM-DD a qualsiasi ricerca IP singola per recuperare lo snapshot di quella data.
https://api.openipapi.com/v1/lookup/{ip}?date=2026-01-15
$ curl "https://api.openipapi.com/v1/lookup/185.220.101.45?date=2026-01-15" \
-H "X-API-Key: oip_your_api_key_here"
{
"ip": "185.220.101.45",
"snapshot_date": "2026-01-15",
"is_historical": true,
"data": {
/* standard lookup response */
}
}
{
"error": "No historical snapshot available for this IP on 2026-01-15",
"code": "no_snapshot"
}
| Codice | Stato HTTP | Descrizione |
|---|---|---|
| invalid_api_key | 401 | La chiave API è mancante, malformata o è stata revocata. |
| limit_exceeded | 429 | Hai esaurito le ricerche nel periodo di fatturazione corrente. |
| plan_required | 403 | La funzionalità richiesta non è disponibile nel tuo piano attuale. |
| invalid_ip | 400 | L'indirizzo IP fornito non è un indirizzo IPv4 o IPv6 valido. |
| not_found | 404 | Nessun dato trovato per la risorsa richiesta (es. ASN sconosciuto). |
| no_snapshot | 404 | Nessuno snapshot storico esiste per questo IP alla data richiesta. |
| date_out_of_range | 400 | La data di ricerca storica è a più di 365 giorni nel passato. |
| invalid_date | 400 | Il parametro data è mancante, malformato o nel futuro. |
| plan_upgrade_required | 403 | La funzionalità richiesta richiede un piano di livello superiore. |
| rate_limited | 429 | Troppe richieste in un breve intervallo. Riprova dopo un po'. |
| internal_error | 500 | Si è verificato un errore imprevisto del server. Contatta il supporto se il problema persiste. |
Oltre alle quote mensili di ricerca, le richieste sono limitate per chiave API con una finestra scorrevole. Quando superato, l'API restituisce HTTP 429 con un header Retry-After .
| Piano | Richieste / minuto | Ricerche / mese |
|---|---|---|
| Free | 30 | 10,000 |
| Starter | 120 | 100,000 |
| Pro | 300 | 500,000 |
| Business | 600 | 2,000,000 |
| Enterprise | Custom | Unlimited |
Limiti aggiuntivi: /v1/validate (non autenticato) ha un limite di 60 req/min per IP chiamante; /v1/me a 30 req/min. I download MMDB sono limitati a 10/giorno per fonte per account. Le risposte al limite di frequenza includono Retry-After.
I webhook ti consentono di ricevere notifiche HTTP POST in tempo reale quando lo stato di un IP che stai monitorando cambia. Configurali nella console → Webhook, o tramite la dashboard — nessuna chiamata API richiesta.
| Evento | Si attiva quando |
|---|---|
| vpn_detected | Un IP monitorato viene rilevato come endpoint VPN. |
| tor_detected | Un IP monitorato compare in una lista di nodi Tor o viene sondato come relay Tor. |
| proxy_detected | Un IP monitorato viene rilevato come proxy aperto o SOCKS. |
| high_threat | Il threat score supera la soglia configurata (50–95). |
POST https://your-endpoint.example.com/webhook
Content-Type: application/json
User-Agent: OpenIPApi-Webhook/1.0
X-OpenIPApi-Event: high_threat
X-OpenIPApi-Signature: sha256=8c7f1a...b2e
{
"event": "high_threat",
"delivered_at": "2026-04-18T12:34:56Z",
"webhook_id": 142,
"data": {
"ip": "185.220.101.45",
"threat_score": 92,
"previous_score": 45,
"is_tor": true,
"is_vpn": true
}
}
Ogni webhook è firmato tramite HMAC-SHA256 del corpo JSON grezzo con il tuo segreto webhook. La firma viene inviata nell'header X-OpenIPApi-Signature come sha256=<hex>.
Verifica sempre prima di agire sul payload:
PHP
$body = file_get_contents('php://input');
$hdr = $_SERVER['HTTP_X_OPENIPAPI_SIGNATURE'] ?? '';
$expected = 'sha256=' . hash_hmac(
'sha256', $body, $webhookSecret
);
if (!hash_equals($expected, $hdr)) {
http_response_code(401);
exit;
}
// Safe to process $body now
Node.js (Express)
const crypto = require('crypto');
app.post('/webhook',
express.raw({ type: 'application/json' }),
(req, res) => {
const hdr = req.headers['x-openipapi-signature'];
const expected = 'sha256=' + crypto
.createHmac('sha256', process.env.WEBHOOK_SECRET)
.update(req.body).digest('hex');
if (expected !== hdr) return res.status(401).end();
// Process JSON.parse(req.body)
});
Il tuo endpoint deve rispondere entro 10 secondi con HTTP 2xx per confermare la ricezione. Qualsiasi altro stato (o timeout) attiva retry con back-off esponenziale: 1 min, 5 min, 30 min, 2 h, 12 h. Dopo l'ultimo tentativo il webhook viene contrassegnato come fallito e viene generato un alert nella dashboard.
La console → Webhook conserva gli ultimi 100 tentativi di consegna per account, mostrando il tipo di evento, il codice di stato HTTP e il corpo della risposta restituito dal tuo endpoint. Puoi ripetere qualsiasi consegna precedente per reinviare il payload firmato originale, e usare il Debugger di firma per verificare le firme HMAC-SHA256 lato client senza condividere il tuo segreto con nessun server.
Le consegne ripetute includono un header aggiuntivo X-OpenIPApi-Replay: 1 affinché il tuo endpoint possa distinguerle dagli eventi live.
$ curl https://api.openipapi.com/v1/lookup/8.8.8.8 \
-H "X-API-Key: oip_your_api_key_here"
$ curl -X POST https://api.openipapi.com/v1/lookup/batch \
-H "X-API-Key: oip_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"ips": ["8.8.8.8", "1.1.1.1", "185.220.101.45"]}'
$ curl https://api.openipapi.com/v1/me \
-H "X-API-Key: oip_your_api_key_here"
const response = await fetch('https://api.openipapi.com/v1/lookup/8.8.8.8', {
headers: {
'X-API-Key': 'oip_your_api_key_here'
}
});
const data = await response.json();
console.log(data.geo.country); // "United States"
console.log(data.threat.is_vpn); // false
console.log(data.threat.threat_score); // 0
const response = await fetch('https://api.openipapi.com/v1/lookup/batch', {
method: 'POST',
headers: {
'X-API-Key': 'oip_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
ips: ['8.8.8.8', '1.1.1.1', '185.220.101.45']
})
});
const { results } = await response.json();
for (const info of results) {
console.log(info.ip, info.geo.city, info.threat.threat_score);
}
import requests
API_KEY = "oip_your_api_key_here"
headers = {"X-API-Key": API_KEY}
r = requests.get(
"https://api.openipapi.com/v1/lookup/8.8.8.8",
headers=headers
)
r.raise_for_status()
data = r.json()
print(data["geo"]["country"]) # United States
print(data["threat"]["is_vpn"]) # False
print(data["threat"]["threat_score"]) # 0
import requests
API_KEY = "oip_your_api_key_here"
headers = {
"X-API-Key": API_KEY,
"Content-Type": "application/json"
}
payload = {
"ips": ["8.8.8.8", "1.1.1.1", "185.220.101.45"]
}
r = requests.post(
"https://api.openipapi.com/v1/lookup/batch",
json=payload,
headers=headers
)
r.raise_for_status()
for info in r.json()["results"]:
print(info["ip"], info["geo"]["city"], info["threat"]["threat_score"])
10.000 ricerche gratuite al mese. Nessuna carta di credito richiesta.
Ottieni la tua chiave API gratis