GET /api/ip-lookup

IP Lookup

Resolve a domain or IP and return the primary IP address plus basic network metadata - ASN, country, provider, and reverse DNS. PTR lookup is best-effort and is only attempted for public IP addresses; private or reserved IP inputs return ptr: null. Results are cached for 60 seconds.

Query parameters

inputrequiredA domain (example.com), IPv4 address (1.1.1.1), or IPv6 address (2606:4700:4700::1111).

Example requests

curl (domain)

curl "https://tinyutils.dev/api/ip-lookup?input=example.com"

curl (IPv4)

curl "https://tinyutils.dev/api/ip-lookup?input=1.1.1.1"

curl (IPv6)

curl "https://tinyutils.dev/api/ip-lookup?input=2606:4700:4700::1111"

JavaScript (fetch)

const res = await fetch(
  "https://tinyutils.dev/api/ip-lookup?input=example.com"
);
const data = await res.json();

Example response (domain)

{
  "ok": true,
  "input": "example.com",
  "resolved": {
    "hostname": "example.com",
    "ipv4": ["93.184.216.34"],
    "ipv6": []
  },
  "ip": "93.184.216.34",
  "network": {
    "asn": 15133,
    "asn_org": "EdgeCast Networks, Inc.",
    "country": "US",
    "provider": "EdgeCast Networks, Inc.",
    "ptr": null
  },
  "meta": {
    "responseTimeMs": 72,
    "cached": false,
    "rateLimitedScope": "global"
  },
  "error": null
}

Example response (private IP)

{
  "ok": true,
  "input": "192.168.0.1",
  "resolved": {
    "hostname": null,
    "ipv4": ["192.168.0.1"],
    "ipv6": []
  },
  "ip": "192.168.0.1",
  "network": {
    "asn": null,
    "asn_org": null,
    "country": null,
    "provider": null,
    "ptr": null,
    "is_private": true
  },
  "meta": {
    "responseTimeMs": 2,
    "cached": false,
    "rateLimitedScope": "global"
  },
  "error": null
}

Error response

{
  "ok": false,
  "error": "INVALID_INPUT"
}

Error codes

INVALID_INPUTThe input is missing or not a valid domain or IP address.
BLOCKED_HOSTThe hostname is an internal/reserved address (e.g. localhost, .local) or resolved to a private or reserved IP.
DNS_LOOKUP_FAILEDThe domain could not be resolved to any IP address.
TIMEOUTDNS resolution did not complete within the time limit.
RATE_LIMITEDYou have exceeded the daily request limit.
INTERNAL_ERRORAn unexpected server error occurred.

Rate limiting

Requests are rate-limited via a global pool shared across all TinyUtils endpoints. Results are cached for 60 seconds to reduce duplicate lookups. When the limit is exceeded, the endpoint returns HTTP 429 with RATE_LIMITED.

Network enrichment data (ASN, country, provider) is best-effort. If the enrichment source is unavailable, those fields return null and the rest of the response is still returned.

See also

Looking for use-case guidance? IP Lookup API walks through common scenarios and integration patterns.