API Documentation
ipaddress.ai is a leading IP lookup API trusted by thousands of developers with 99.99% uptime. Free to use, no authentication required.
Returns the caller's IP address. CLI tools get plain text, browsers get the HTML page, and Accept: application/json returns JSON.
text/plain · text/html · application/jsonReturns full IP information as JSON — geolocation, ASN, hostname, and user agent.
application/json| Field | Type | Description |
|---|---|---|
| ip | string | IP address |
| ip_decimal | integer | Decimal representation of the IP |
| country | string | Country name |
| country_eu | boolean | Whether the country is in the EU |
| country_iso | string | ISO 3166-1 alpha-2 country code |
| city | string | City name |
| hostname | string | Reverse DNS hostname |
| latitude | float | Approximate latitude |
| longitude | float | Approximate longitude |
| asn | string | Autonomous System Number (e.g. AS6327) |
| asn_org | string | ASN organization / ISP name |
| user_agent | object | Parsed user agent with product, version, raw_value |
Always returns just the IP address as plain text, regardless of user agent.
text/plainReturns the country name associated with the caller's IP.
text/plainReturns the ISO 3166-1 alpha-2 country code.
text/plainReturns the city name associated with the caller's IP.
text/plainReturns the Autonomous System Number for the caller's IP.
text/plainReturns the approximate latitude and longitude as comma-separated values.
text/plainLook up geolocation and network information for any public IP address.
application/json · text/html| Parameter | Type | Description |
|---|---|---|
| ip required | string | IPv4 or IPv6 address (e.g. 8.8.8.8, 2001:4860::8888) |
Returns 400 for invalid IPs. Browser requests get the full HTML page with a map.
Test if a specific port on the caller's IP is reachable from the internet.
application/json| Parameter | Type | Description |
|---|---|---|
| port required | integer | Port number between 1 and 65535 |
Returns 400 for invalid port numbers (0, negative, or above 65535).
Health check endpoint. Returns a simple status for monitoring.
application/json