Free IP API

A JSON API with no sign-up and no key: get your own IP address or the location, provider and ASN of any IP address or domain.

ipadresimne.net offers a free JSON API for using IP address data in your apps, scripts and terminal. No API key, account or sign-up is needed. A single request returns the location, internet provider, ASN, hostname and connection type of an IP address.

Endpoints

URLResponse
ipadresimne.netYour public IP address as plain text. Only for command-line clients such as curl, wget, HTTPie and PowerShell; browsers get the regular web page.
ipadresimne.net/ipYour public IP address as plain text, for any client, with CORS enabled.
ipadresimne.net/en/jsonEverything about your own connection, as JSON.
ipadresimne.net/en/api/{ip-or-domain}Details for any IPv4/IPv6 address or domain name, as JSON.

The /en prefix returns continent, country and region names in English. Without it (ipadresimne.net/json, ipadresimne.net/api/8.8.8.8), continent and country names, as well as the names of Turkish provinces, come back in Turkish. Always use https:// URLs in your applications.

Getting Your IP Address as Plain Text

The home page returns nothing but your IP address to command-line clients, which makes it the shortest option for scripts. For other clients and for JavaScript running in a browser, use /ip: it returns plain text to every client and includes a CORS header.

$ curl ipadresimne.net
203.0.113.45

$ curl https://ipadresimne.net/ip
203.0.113.45

If your connection supports both IPv4 and IPv6, you'll see the address of whichever protocol you connected with. To force one or the other, use curl's -4 or -6 option (-6 works when our site is reachable over IPv6).

JSON Responses: /json and /api

/en/json describes your own connection, and /en/api/{query} describes the IP address or domain you pass in. The query can be an IPv4 address (/en/api/8.8.8.8), an IPv6 address (/en/api/2001:4860:4860::8888) or a domain name (/en/api/google.com). Running curl ipadresimne.net/en/8.8.8.8 from a terminal returns the same JSON, while the same URL in a browser opens the 8.8.8.8 IP lookup report.

Sample response

$ curl https://ipadresimne.net/en/api/8.8.8.8
{
    "ip": "8.8.8.8",
    "version": 4,
    "type": "public",
    "hostname": "dns.google",
    "location": {
        "continent": "North America",
        "country": "United States",
        "country_code": "US",
        "region": "California",
        "city": "Mountain View",
        "postal": null,
        "latitude": 37.422,
        "longitude": -122.085,
        "timezone": "America/Los_Angeles",
        "utc_offset": "-07:00",
        "is_eu": false
    },
    "network": {
        "asn": 15169,
        "organization": "Google LLC",
        "isp": "Google",
        "block": "8.8.8.0/24",
        "connection": "hosting",
        "tor": false,
        "vpn": false,
        "relay": false
    },
    "source": "DB-IP"
}

You can also open the live response in your browser. For domain queries, two fields are added at the top: query (the domain you asked for) and resolved (all of its IPv4 and IPv6 addresses). The rest of the report describes the first address in that list:

$ curl https://ipadresimne.net/en/api/dns.google
{
    "query": "dns.google",
    "resolved": ["8.8.8.8", "8.8.4.4", "2001:4860:4860::8888", "2001:4860:4860::8844"],
    "ip": "8.8.8.8",
    …
}

Response Fields

FieldDescription
ipThe IP address that was looked up
versionIP version: 4 or 6
typeAddress type: public, private, loopback, cgnat, link-local or reserved
hostnameReverse DNS (PTR) record, or null if there is none
location.continent, country, country_codeContinent, country name and two-letter ISO 3166-1 country code
location.region, city, postalRegion or state, city and postal code (when known)
location.latitude, longitudeApproximate coordinates that point to the center of an area, not a street address
location.timezone, utc_offsetIANA time zone (e.g. Europe/Istanbul) and the current UTC offset, including daylight saving time
location.is_eutrue if the country is a member of the European Union
network.asn, organizationAutonomous system number and the organization that operates the network
network.ispInternet service provider
network.blockThe IP block (CIDR) the address belongs to
network.connectionConnection type: isp (residential/business), mobile, hosting (data center), proxy, vpn, relay, tor, or null if unknown
network.tor, vpn, relaytrue if the address is a Tor exit node, belongs to a known VPN service or to a relay service such as iCloud Private Relay
sourceWhere the data came from (e.g. DB-IP); if missing fields were filled in by a fallback service, its name is appended

For private addresses such as 192.168.1.1, the type field tells you what kind of address it is, and the location and network fields are null.

Error Codes

HTTP statusMeaning
400Invalid IP address or domain name
404The domain has no IP address (no A/AAAA record)
429Per-minute rate limit exceeded
503DNS resolution is temporarily unavailable; try again shortly

Error responses have a JSON body with a single field describing the problem, in English under /en and in Turkish otherwise:

{
    "error": "Too many lookups in a short time. Please try again in a minute."
}

Rate Limits and Fair Use

  • Rate limit: /api lookups are limited to 30 requests per minute per IP address (per /64 block for IPv6). Go over it and you'll get HTTP 429; wait a minute and try again.
  • /json: if you call it very frequently, the hostname isn't looked up again and may come back as null.
  • CORS: JSON responses and /ip are sent with Access-Control-Allow-Origin: *, so you can call them directly from JavaScript in the browser.
  • Cache results: an IP address's location and network data rarely change, so store results for at least a few hours instead of looking up the same address over and over.
  • Bulk lookups: if you need to look up thousands of addresses, host a free geolocation database such as DB-IP Lite on your own server instead of hammering the API.
  • Handle errors: make sure your application keeps working when it receives a 429 or 503 response or runs into a timeout.

Code Examples

curl

curl https://ipadresimne.net/en/json
curl https://ipadresimne.net/en/api/8.8.8.8
curl https://ipadresimne.net/en/api/2001:4860:4860::8888
curl -s https://ipadresimne.net/en/api/google.com | jq -r '.network.organization'

PowerShell

$info = Invoke-RestMethod https://ipadresimne.net/en/api/8.8.8.8
$info.location.country
$info.network.organization

# Just your own IP address
(Invoke-RestMethod https://ipadresimne.net/ip).Trim()

Python (requests)

import requests

resp = requests.get("https://ipadresimne.net/en/api/8.8.8.8", timeout=10)
resp.raise_for_status()
data = resp.json()
print(data["location"]["country"], data["network"]["asn"])

Python (standard library)

import json
from urllib.request import urlopen

with urlopen("https://ipadresimne.net/en/json", timeout=10) as resp:
    data = json.load(resp)

print(data["ip"], data["location"]["city"])

JavaScript (fetch)

async function getIpInfo() {
  const res = await fetch("https://ipadresimne.net/en/json");
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
  return res.json();
}

getIpInfo().then((data) => {
  console.log(data.ip, data.location.country);
});

PHP

<?php
$context = stream_context_create(['http' => ['timeout' => 10]]);
$body = file_get_contents('https://ipadresimne.net/en/api/8.8.8.8', false, $context);
if ($body === false) {
    exit('Request failed');
}
$data = json_decode($body, true);
echo $data['location']['country'], ' - ', $data['network']['organization'], PHP_EOL;

License and Attribution

Location and network data come mainly from DB-IP's Lite databases, which are updated monthly and licensed under CC BY 4.0. If you display location data from this API on a website, in an app or in a report, you must credit it with the text “IP Geolocation by DB-IP” linked to https://db-ip.com.

IP API FAQ

Do I need an API key or an account?

No. The API is free and needs no key, account or sign-up. https://ipadresimne.net/en/json returns details about your own IP address, and https://ipadresimne.net/en/api/8.8.8.8 returns details about any IP address or domain name as JSON.

What is the API rate limit?

Lookups are limited to 30 requests per minute per IP address (per /64 block for IPv6). If you go over the limit, you'll get an HTTP 429 response; wait a minute and try again. Cache results instead of looking up the same address over and over.

Can I call the API from JavaScript in the browser?

Yes. JSON responses and the /ip endpoint are sent with Access-Control-Allow-Origin: *, so you can call them with fetch directly from any website.

Do I need to give attribution if I display the location data?

Yes. Location data comes from DB-IP's database, which is licensed under CC BY 4.0. If you publish it, you must show the text “IP Geolocation by DB-IP” with a link to https://db-ip.com.