API Documentation

Easy to integrate REST API

Quick Start

Get your IP address from the terminal:

curl who-is.hu/ip

Response: 203.0.113.42

Endpoints

GET /ip

Returns the client's IP address as plain text.

curl who-is.hu/ip

Response (text/plain):

203.0.113.42

GET /json

Returns the client's IP address with related information in JSON format.

curl who-is.hu/json

Response (application/json):

{
  "ip": "203.0.113.42",
  "version": "IPv4",
  "organization": "Example ISP",
  "network": "EXAMPLE-NET",
  "asn": "AS64496",
  "cidr": "203.0.113.0/24",
  "country": "HU"
}

GET /api/myip

Returns the client's IP address in JSON format (minimal).

curl who-is.hu/api/myip

Response:

{
  "ip": "203.0.113.42",
  "version": "IPv4"
}

GET /api/lookup/{query}

IP address or domain lookup. The {query} can be an IPv4, IPv6 address, or domain name.

curl who-is.hu/api/lookup/8.8.8.8

Response for IP address:

{
  "query": "8.8.8.8",
  "type": "ipv4",
  "ip": {
    "ip": "8.8.8.8",
    "version": "ipv4",
    "organization": "Google LLC",
    "network": "GOGL",
    "asn": "AS15169",
    "cidr": "8.8.8.0/24",
    "country": "US"
  }
}
curl who-is.hu/api/lookup/example.com

Response for domain name:

{
  "query": "example.com",
  "type": "domain",
  "dns": {
    "a": ["93.184.215.14"],
    "aaaa": ["2606:2800:21f:cb07:6820:80da:af6b:8b2c"],
    "mx": ["mail.example.com"],
    "ns": ["a.iana-servers.net", "b.iana-servers.net"],
    "txt": ["v=spf1 -all"],
    "soa": "ns.icann.org. noc.dns.icann.org. 2024011001 7200 3600 1209600 3600",
    "caa": ["0 issue \"letsencrypt.org\""]
  },
  "ip": {
    "ip": "93.184.215.14",
    "version": "ipv4",
    "organization": "EDGECAST"
  }
}

GET /api/health

Service health check.

curl who-is.hu/api/health

Response:

{"status": "ok"}

Usage Examples

Bash script

#!/bin/bash
MY_IP=$(curl -s who-is.hu/ip)
echo "Your IP address: $MY_IP"

Python

import requests

# Simple IP lookup
ip = requests.get('https://who-is.hu/ip').text
print(f'IP: {ip}')

# Detailed JSON
data = requests.get('https://who-is.hu/json').json()
print(f'Organization: {data.get("organization")}')

JavaScript (fetch)

// Simple IP
fetch('https://who-is.hu/ip')
  .then(r => r.text())
  .then(ip => console.log('IP:', ip));

// JSON
fetch('https://who-is.hu/json')
  .then(r => r.json())
  .then(data => console.log(data));

Rate Limiting

The service limits the number of requests to prevent abuse:

If exceeded, you will receive a 429 Too Many Requests response.

Errors

In case of an error, a JSON error message is returned:

{
  "error": "invalid query"
}
400 Invalid request (bad IP/domain format)
429 Too many requests (rate limit)
500 Server error