IP address or hostname:


Output format:
Options:
(Just in case you needed to disable any of these features for any reason)


		
▼ Show developer API information ▼

Developer API Information:

This API is intended to be pretty fast and has no rate limits. You may use this API for free but please do not abuse it.
If you're using this API in an application, please be nice and set your application's user-agent string accordingly.
"Abuse" basically just means hammering the API with loads of requests constantly. Basically, be nice to the API and it will be nice to you in return.
Abuse may result in your IP address and/or application being rate-limited. I run this for personal use and I make it available to others for the same reason.
The information provided by this site is compiled by MaxMind and is updated weekly by them.
Location information is approximate and may not always be available.

Please note: If you're still making use of the original API (if you're making requests to api.cgi, this applies to you), you are advised to update your code to make use of the latest version of the API, documented below. The previous API is depreciated; Though it will not be removed, there should be no expectation of long-term reliability.
The most current version of the API will always be documented below. Though legacy API versions will remain available for use, only minimal effort will be put into keeping them functional.

Endpoint: /api/v1/lookup

Looks up the geolocation and, optionally, ISP information for the given IP address or hostname.
IPv4 and IPv6 are supported, though if you give a hostname that needs to be resolved, its IPv6 address will be used.
The API can be accessed by providing GET or POST variables to the page /api/v1/lookup.

API Variables

type=(json|xml|text) - This allows you to specify the data type for responses. If not provided, the default is type=text.
addr=(address|hostname) - IP address or hostname to look up. If a hostname is given, the first IP address given from resolving it will be used. If no address is given, the requesting IP address will be used. If you need to look up yourself and you do not know your external IP address, just omit this variable.
hostname=(true|false) - Enables/disables the reverse DNS hostname lookup. If every millisecond matters and you don't need a hostname, disabling this may help. If not provided, the default is hostname=true.
asn=(true|false) - Enables/disables the ASN information lookup. Again, if speed is required and you did not need an ASN or organization name, disabling this may help. In practice, disabling these only shaves a few milliseconds off each lookup. If not provided, the default is asn=true.

Example Usage

/api/v1/lookup?type=json&addr=example.com - Returns all information, including reverse DNS hostname and ASN information, in JSON format for example.com.
/api/v1/lookup?type=xml&addr=1.1.1.1&hostname=false - Returns all information except reverse DNS hostname in XML format for 1.1.1.1.
/api/v1/lookup?type=text&addr=8.8.8.8&asn=false - Returns all information except AS number and organization in human-readable plain-text format for 8.8.8.8.

Endpoint: /api/v1/ip

If you need to get your current public IP address without performing any lookups, an API endpoint is available to do so at /api/v1/ip and accepts GET or POST methods.
The text response type for this API will return nothing but the requesting client's IP address, making it suitable for implementing into scripts, while the JSON and XML response types provide slightly more information about the status of the API call, making those types useful for implementation into more complex programs.

API Variables

type=(json|xml|text) - This allows you to specify the data type for the response. If not provided, the default is type=text.

Example Usage

/api/v1/lookup?type=json - Returns the requesting client's current IP address, in a JSON data structure.
/api/v1/lookup - Returns the requesting client's current IP address as plain-text with no other formatting or extra characters. Suitable for simple shell scripts.