IP Lookup API by QWeb Ltd

This is the IP lookup API by QWeb Ltd. Use this API to get information for a given IP address, including country, region and city information, hostname address, ASN, and CIDR range.

We built this API primarily to do country and region lookups for a given IP, allowing us to restrict access to our hosted website administration panels by country, and also allowing us to default billing and delivery address fields to a visitor's own location in our bespoke checkout systems.

This API supports both IPv4 and IPv6 lookups, returning a JSON object containing the given IPs hostname, CIDR block, AS and ASN information, country, region and city information, and whether the IP is a known proxy server.


To use this API, first create a free API Console account and then log in to the API Console to generate an access key.

Once you have an access key, simply send a GET request to https://apis.qweb.co.uk/ip-lookup/ACCESS_KEY/IP_ADDRESS.json and a JSON formatted response will be returned. IP_ADDRESS can be an IPv4 or IPv6 address.

The returned data will be a JSON object containing an answer property, which will either be success if the API key and IP address are valid, or an error message on fail. Additionally, if the return is successful, the JSON object will contain ip, cidr, hostname, as, asn, country, region, city, and is_proxy properties.

is_proxy will contain the value yes if the IP is of a known proxy server.

All fields are returned. If a field value cannot be determined, it's returned as an empty property. Where country is known, this will be returned as an ISO 3166-1 Alpha 2 two letter code.

For example, https://apis.qweb.co.uk/ip-lookup/ACCESS_KEY/ will return the following JSON:

	"as":"British Telecommunications PLC",

Being a REST API, you can access this data from any device with a working Internet connection, using any programming language or development framework that has the ability to request HTTP URIs. The following example is a PHP script using Curl to request and display the region and country where an IP is located.

$api = curl_init();

$accessKey = 'YOUR_ACCESS_KEY';
$ip = '';

curl_setopt($api, CURLOPT_URL, 'https://apis.qweb.co.uk/ip-lookup/'.$accessKey.'/'.$ip.'.json');
curl_setopt($api, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($api);

$data = json_decode($response);

if($data->answer == 'success')
	echo $ip.' is located in '.$data->region.', '.$data->country;

This IP lookup API has a built-in cache mechanic and is super quick to respond, and we of course aim to keep our servers up at all times, but in case of network issues and for the best possible performance, we recommend building your application to cache the results of your lookups locally. Lookup responses don't change often, so a cache of about 1 month should still be reasonably accurate.

Generate an access key or See our other API services

This service includes IP2Location LITE data available from https://lite.ip2location.com.

Copyright © 2023 - 2024 QWeb Ltd. All rights reserved. Company number 11693058. Privacy Policy