GeoIP Legacy Web Services
We have implemented recent changes to our GeoIP Legacy web services in line with the retirement of GeoIP Legacy Databases. Please see our blog post for more information.
Note: This documentation is for the GeoIP legacy services. New customers do not have access to these services. Please use the GeoIP2 web services.
The GeoIP web services allow you to look up information about a given IP address using an HTTP-based API.
IP Geolocation Usage
IP geolocation is inherently imprecise. Locations are often near the center of the population. Any location provided by a GeoIP database should not be used to identify a particular address or household.
HTTP-based API
The HTTP API requires you to pass a set of parameters as an HTTP GET or POST. Results are returned in a simple text format documented below.
We offer several different services, each providing a different amount of information about the IP address.
All of the services take the same parameters as inputs. The only difference between them is the URI they use and the data they return. The two parameters that each service takes are the IP address to look up and your MaxMind license key.
The parameters should be passed in a query string or as a form post (application/x-www-form-urlencoded). The IP address parameter should be named i (lower case "I") and the license key should be named l (lower case "L").
The IP address should be passed as a string like "44.55.66.77" or "2001:db8::2:1".
Per-Service URIs
The URIs for each service are as follows:
Service | URI |
---|---|
Country | https://geoip.maxmind.com/geoip/v1.0/country |
City | https://geoip.maxmind.com/geoip/v1.0/city |
City/ISP/Org | https://geoip.maxmind.com/geoip/v1.0/city-isp-org |
Insights (formerly Omni) | https://geoip.maxmind.com/geoip/v1.0/insights |
You might also be using the original GeoIP Legacy URIs:
Service | URI |
---|---|
Country | https://geoip.maxmind.com/a |
City | https://geoip.maxmind.com/b |
City/ISP/Org | https://geoip.maxmind.com/f |
Insights (formerly Omni) | https://geoip.maxmind.com/e |
The geoip.maxmind.com
hostname automatically picks the data center
geographically closest to you.
Security
You must access this service via HTTPS. We require TLS 1.2 or greater for HTTPS requests to our servers to keep your data secure.
Output
All services return data as a set of comma-separated fields. The ISP name, Organization name, and AS number fields are quoted, since they may contain a comma. The other fields are not escaped or quoted, but they will never contain a comma.
All strings are returned in the ISO-8859-1 encoding. This encoding is also referred to as latin1.
Included in … | ||||||
---|---|---|---|---|---|---|
Name | Type (length) | Description | Country? | City? | City/ISP/Org? | Insights (formerly Omni)? |
Accuracy radius | integer | The radius in kilometers around the specified location where the IP address is likely to be. | ||||
City name | string | The city or town name as defined by GeoNames associated with the IP address. | ||||
Region code | string | The ISO-3166-2 code for the state/region associated with the IP address. We previously returned a FIPS 10-4 code for all countries other than the United States and Canada. See our blog post detailing changes to our legacy web services. | ||||
Region name | string | The region name as defined by GeoNames associated with the IP address. | ||||
Postal code | string | The postal code associated with the IP address. These are available for some IP addresses in Australia, Canada, France, Germany, Italy, Spain, Switzerland, United Kingdom, and the US. We return the first 3 characters for Canadian postal codes. We return the first 2-4 characters (outward code) for postal codes in the United Kingdom. | ||||
Metro code | integer | The metro code associated with the IP address. These are only available for IP addresses in the US. | ||||
Area code | string | Deprecated. This field will be empty in the updated legacy web service. See our blog post detailing changes to our legacy web services. | ||||
Country code | string (2) | A ISO 3166-1 country code for the country associated with the IP address. In addition to the standard codes, we may also return one of the following:
The US country code is returned for IP addresses associated with overseas US military bases. | ||||
Country name | string | The country name as defined by GeoNames associated with the IP address. | ||||
Continent code | string (2) | A two-character code for the continent associated with the IP address. The possible codes are:
| ||||
Latitude | decimal | The approximate latitude of the location associated with the network. This value is not precise and should not be used to identify a particular address or household | ||||
Longitude | decimal | The approximate longitude of the location associated with the network. Latitude and Longitude are often near the center of population. These values are not precise and should not be used to identify a particular address or household. | ||||
Time zone | string | The time zone associated with the IP address. Time zone names are taken from the IANA time zone database. See the list of possible values. | ||||
AS number | string | The autonomous system number associated with the IP address. | ||||
User type | enum | The user type associated with the IP address. This will be one of the following values.
| ||||
Netspeed | enum | The network speed associated with the IP address. This can be one of the following values:
| ||||
Domain | string | The second level domain associated with the IP address. This will be something like "example.com" or "example.co.uk", not "foo.example.com". | ||||
ISP name | string | The name of the ISP associated with the IP address. | ||||
Organization name | string | The name of the organization associated with the IP address. | ||||
City confidence factor | string | A value from 0-100 representing our confidence that the city is correct. | ||||
Region confidence factor | string | A value from 0-100 representing our confidence that the region is correct. | ||||
Postal confidence factor | string | A value from 0-100 representing our confidence that the postal code is correct. | ||||
Country confidence factor | string | A value from 0-100 representing our confidence that the country is correct. | ||||
Error code | string | If there was an error or warning with this request, this field contains an error code string. The possible error codes are:
|
Output field order
Since all output is returned as a comma separated string, the order in which fields are returned must be known in order to parse the result. If the request is successful, the error field may be omitted entirely, since it always comes last.
Service | Field Order |
---|---|
Country |
|
City |
|
City/ISP/Org |
|
Insights |
|
Client Code Examples
The examples below are all for the Insights or City/ISP/Org web services. Client code for other services will be very similar. The only differences are the URI path and the fields which are returned.
Perl
This is an example for the Insights web service.
PHP
This is an example for the Insights web service.
Python 2
This is an example for the Insights web service.
Python 3
This is an example for the Insights web service.
Ruby 1.9
This is an example for the Insights web service.
Java
This is an example for the Insights web service.
C#
This is an example for the Insights web service.
VB.Net
This is an example for the City/ISP/Org web service.
Cold Fusion
This is an example for the City/ISP/Org web service.
ASP
This is an example for the City/ISP/Org web service.
VBScript
This is an example for the City/ISP/Org web service.
This page was last updated on September 12, 2024.