Request#
/lookup/ipAPI key or Bearer token| Body field | Type | Required | Rules |
|---|---|---|---|
ip | string | Yes | IPv4 or IPv6. Additional body properties are not accepted. |
{
"ip": "203.0.113.42"
}Request examples#
curl --request POST 'https://api.lookupnest.com/api/v1/lookup/ip' \
--header "x-api-key: $LOOKUPNEST_API_KEY" \
--header 'Content-Type: application/json' \
--header 'Origin: https://app.example.com' \
--data '{"ip":"203.0.113.42"}'// Run on your server. Node.js with built-in fetch.
const key = process.env.LOOKUPNEST_API_KEY;
if (!key) throw new Error('Set LOOKUPNEST_API_KEY');
const response = await fetch('https://api.lookupnest.com/api/v1/lookup/ip', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': key,
Origin: 'https://app.example.com'
},
body: JSON.stringify({"ip":"203.0.113.42"}),
signal: AbortSignal.timeout(15000) // Your client timeout, not a service SLA.
});
const payload = await response.json();
if (!response.ok || payload.success === false) {
throw new Error(payload.message || ('HTTP ' + response.status));
}
// Use payload in your application; do not log credentials or full customer data.
console.log({ status: response.status, creditsCharged: payload.credits_charged });# Python 3 standard library. Run on your server.
import json, os, urllib.request, urllib.error
key = os.environ['LOOKUPNEST_API_KEY']
request = urllib.request.Request(
'https://api.lookupnest.com/api/v1/lookup/ip',
data=json.dumps({"ip":"203.0.113.42"}).encode('utf-8'),
headers={
'Content-Type': 'application/json',
'x-api-key': key,
'Origin': 'https://app.example.com'
},
method='POST'
)
try:
with urllib.request.urlopen(request, timeout=15) as response:
payload = json.load(response)
if payload.get('success') is False:
raise RuntimeError(payload.get('message', 'Lookup failed'))
print({'status': response.status})
except urllib.error.HTTPError as error:
# Handle the documented HTTP status; do not blindly retry charged lookups.
raise RuntimeError(f'LookupNest returned HTTP {error.code}') from error<?php
// Server-side PHP with the cURL extension.
$key = getenv('LOOKUPNEST_API_KEY');
if (!$key) { throw new RuntimeException('Set LOOKUPNEST_API_KEY'); }
$handle = curl_init('https://api.lookupnest.com/api/v1/lookup/ip');
curl_setopt_array($handle, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 15,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'x-api-key: ' . $key,
'Origin: https://app.example.com'
],
CURLOPT_POSTFIELDS => json_encode(['ip' => '203.0.113.42'], JSON_THROW_ON_ERROR)
]);
$body = curl_exec($handle);
if ($body === false) { throw new RuntimeException(curl_error($handle)); }
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
$payload = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
if ($status >= 400 || ($payload['success'] ?? true) === false) {
throw new RuntimeException('LookupNest request failed: HTTP ' . $status);
}
// Use $payload without logging API keys or full submitted customer records.Success response#
The following example follows the published IP response schema. Network, location and usage values are illustrative.
{
"usage_id": "9e3c2c24-8f68-4cc5-a5da-90a5bbca679c",
"credits_charged": 1,
"credits_remaining": 99,
"source": "api",
"success": true,
"message": "Illustrative IP lookup result",
"data": {
"status": "ok",
"data": {
"id": "example-record",
"ip": "203.0.113.42",
"lookup_left": 99,
"last_updated": "2026-11-09T00:00:00Z",
"network": {
"asn": "AS64500",
"range": "203.0.113.0/24",
"hostname": null,
"provider": "Example network",
"organisation": "Example organisation",
"type": "hosting"
},
"location": {
"continent_name": null,
"continent_code": null,
"country_name": null,
"country_code": null,
"region_name": null,
"region_code": null,
"city_name": null,
"postal_code": null,
"latitude": null,
"longitude": null,
"timezone": null,
"currency": {
"code": null,
"name": null,
"symbol": null
}
},
"device_estimate": {
"address": 0,
"subnet": 0
},
"detections": {
"proxy": false,
"vpn": false,
"compromised": false,
"scraper": false,
"tor": false,
"hosting": true,
"anonymous": false,
"risk": 20
},
"is_modified": 0
}
}
}Response envelope and source#
| Field | Meaning |
|---|---|
usage_id | Request usage reference, UUID format. |
credits_charged | Integer usage charge returned for the request. Example values are not a universal price. |
credits_remaining | Integer remaining-credit metadata. |
source | One of redis, database or api, describing retrieval source. |
data.status | The typed success value is ok. |
data.data | The IP lookup record; see the complete field dictionary. |
A cached retrieval source is not a statement that the lookup is free. Reconcile the returned charge and your account report.
Documented statuses#
| HTTP | Description |
|---|---|
200 | IP reputation result. |
400 | Invalid IP address. |
401 | Authentication is required or the token is invalid. |
403 | The browser Origin is missing or is not allowed for this API key. |
429 | The authenticated user exceeded the IP lookup rate limit. |
502 | The lookup provider returned an invalid or unsuccessful response. |
503 | The lookup provider is not configured or is rate limited. |
504 | The lookup provider timed out. |
Do not assume the email endpoint has the same status set. Each reference page shows the statuses declared for that operation.
Interpret the result#
Use a risk score with its underlying flags and your application context. VPN or hosting use alone is not proof of abuse. IP geolocation is network context, not a verified personal address.
Continue with the full IP field dictionary and decision-design guidance.