IP2Location™ Web Service
![]() |
IP2Location™ web service is providing a service to do a reverse lookup of an IP address to an ISO3166 country code, region or state, city, latitude and longitude, ZIP/Postal code, time zone, Internet Service Provider (ISP) or company name, domain name, net speed, area code, weather station code, weather station name, mobile country code (MCC), mobile network code (MNC) and carrier brand, elevation, and usage type. To search, submit a query string and a set of parameters to the IP2Location™ Web APIs service and you will receive a search result. Search results are derived from IP2Location™ index of over 4 billion unique IP addresses. IPv4 and IPv6 supported. |
All successful HTTP or HTTPS request will return a response code of 200. In our web API, it also returns the lookup country code if successful or error code if failed.
Each API unit subscription allows 100,000 query credits. If you need more credits, please add multiple units during checkout. Total credits will be in multiplier (x 100,000) of number of units paid. An unique API key will be provided to query the web service.
IP2Location™ Web API uses a single web interface to perform the reverse lookup logic. The protocol used is HTTP or HTTPS GET. You can test this API as easy as using a web browser.
api.ip2location.com/?ip=<ip_address>&key=<your_api_key>&package=<WS1|WS2|WS3|...|WS24>
- No database to download, to install or to upgrade in the server side
- Support HTTP or HTTPS queries up to 100,000 times or 1 year (which one comes first)
| Name | Description |
|---|---|
| key | (required) API key. |
| ip | (required) IP address (IPv4 or IPv6) for reverse lookup purpose. If not present, the server IP address will be used for the reverse lookup. |
| package |
(optional) If not present, the web service will assume the WS1 package query. Valid value: WS1 | WS2 | WS3 | WS4 | WS5 | WS6 | WS7 | WS8 | WS9 | WS10 | WS11 | WS12 | WS13 | WS14 | WS15 | WS16 | WS17 | WS18 | WS19 | WS20 | WS21 | WS22 | WS23 | WS24 Please refer to the below pricing table for value returned. |
| format | (optional) If not present, text format will be returned as the search result. Valid value: json | xml |
You can try out our web service by using the demo key. For example, http://api.ip2location.com/?ip=8.8.8.8&key=demo. Demo query limit is 20 per day.
IPv4:
api.ip2location.com/?ip=18.10.188.23&key=demo&package=WS10
IPv6:
api.ip2location.com/?ip=2607:f8b0:4001:c02::93&key=demo&package=WS1
| Package | Information Returned | Credit |
|---|---|---|
| WS1 | Country Code |
1 credit (0.0005/query) |
| WS2 | Country, ISP |
2 credits (0.0010/query) |
| WS3 | Country, Region, City |
2 credits (0.0010/query) |
| WS4 | Country, Region, City, ISP |
3 credits (0.0015/query) |
| WS5 | Country, Region, City, Latitude, Longitude |
3 credits (0.0015/query) |
| WS6 | Country, Region, City, Latitude, Longitude, ISP |
4 credits (0.0020/query) |
| WS7 | Country, Region, City, ISP, Domain |
4 credits (0.0020/query) |
| WS8 | Country, Region, City, Latitude, Longitude, ISP, Domain |
5 credits (0.0025/query) |
| WS9 | Country, Region, City, Latitude, Longitude, ZIPCode |
4 credits (0.0020/query) |
| WS10 | Country, Region, City, Latitude, Longitude, ZIPCode, ISP, Domain |
6 credits (0.0029/query) |
| WS11 | Country, Region, City, Latitude, Longitude, ZIPCode, TimeZone |
5 credits (0.0025/query) |
| WS12 | Country, Region, City, Latitude, Longitude, ZIPCode, TimeZone, ISP, Domain |
7 credits (0.0034/query) |
| WS13 | Country, Region, City, Latitude, Longitude, TimeZone, NetSpeed |
5 credits (0.0025/query) |
| WS14 | Country, Region, City, Latitude, Longitude, ZIPCode, TimeZone, ISP, Domain, NetSpeed |
8 credits (0.0039/query) |
| WS15 | Country, Region, City, Latitude, Longitude, ZIPCode, TimeZone, AreaCode |
7 credits (0.0034/query) |
| WS16 | Country, Region, City, Latitude, Longitude, ZIPCode, TimeZone, ISP, Domain, NetSpeed, AreaCode |
10 credits (0.0049/query) |
| WS17 | Country, Region, City, Latitude, Longitude, TimeZone, NetSpeed, Weather |
6 credits (0.0029/query) |
| WS18 | Country, Region, City, Latitude, Longitude, ZIPCode, TimeZone, ISP, Domain, NetSpeed, AreaCode, Weather |
11 credits (0.0054/query) |
| WS19 | Country, Region, City, Latitude, Longitude, ISP, Domain, Mobile |
8 credits (0.0039/query) |
| WS20 | Country, Region, City, Latitude, Longitude, ZIPCode, TimeZone, ISP, Domain, NetSpeed, AreaCode, Weather, Mobile |
13 credits (0.0064/query) |
| WS21 | Country, Region, City, Latitude, Longitude, ZIPCode, TimeZone, AreaCode, Elevation |
8 credits (0.0039/query) |
| WS22 | Country, Region, City, Latitude, Longitude, ZIPCode, TimeZone, ISP, Domain, NetSpeed, AreaCode, Weather, Mobile, Elevation |
14 credits (0.0069/query) |
| WS23 | Country, Region, City, Latitude, Longitude, ISP, Domain, Mobile, UsageType |
11 credits (0.0054/query) |
| WS24 | Country, Region, City, Latitude, Longitude, ZIPCode, TimeZone, ISP, Domain, NetSpeed, AreaCode, Weather, Mobile, Elevation, UsageType |
18 credits (0.0088/query) |
| WS1 Query: | http://api.ip2location.com/?ip=<ip_address>&key=<your_api_key> |
| WS1 Response: | US |
| WS24 Query: | http://api.ip2location.com/?ip=<ip_address>&key=<your_api_key>&package=WS24 |
| WS24 Response: | US;United States;California;Mountain View;37.405992;-122.078515;94043;-08:00;Google Inc.;google.com;T1;1;650;USCA0746;Mountain View;-;-;-;31;SES |
The web service supports text, json and xml response format. Below please find the details:
| Format | Example query string and response value |
| text |
query string:http://api.ip2location.com/?ip=<ip_address>&key=<your_api_key>&package=WS24response format: US;United States;California;Mountain View;37.405992;-122.078515;94043;-08:00;Google Inc.;google.com;T1;1;650;USCA0746;Mountain View;-;-;-;31;SES |
| json |
query string:http://api.ip2location.com/?ip=<ip_address>&key=<your_api_key>&package=WS24&format=jsonresponse format:
{ |
| xml |
query string:http://api.ip2location.com/?ip=<ip_address>&key=<your_api_key>&package=WS24&format=xmlresponse format:
<result> |
If you need other XML based web services, please visit http://www.fraudlabs.com





