Find a Location from an IP Address

Find out what you can do with our API...

API method to use: ip_location

Skip to demo


Trace an IP address to find the real-world geographical location of a computer or device, including a country and approximate city.

Every computer or device connected to the internet has an Internet Protocol Address (IP Address) which can be used to indentify it. We can trace this IP address to find the real-world geographical location of a computer or device, including a country and approximate city, as well as latitude and longitude information which can be used to plot the location on a map, for example.

There are many reasons you might wish to know where your visitors are geographically based; dynamically changing the language of your website, pre-selecting a visitor's country on your sign-up forms, and reducing credit card fraud based on geographic location are just a few examples.

Mandatory Parameters

Name Description
api_key or javascript_key Use your API key if invoking server-side. If invoking from the browser via JavaScript, generate a JavaScript key using the javascript_key method.
ip_address Enter an IPV4 address in text form (e.g. or the DNS name (e.g.

Optional Parameters

Name Description
client You can optionally include an identifier for your final client or user. This is logged in your usage log and you will be able to view your usage statistics by client.
output Set to json for a JSON response; the default response is XML. Not applicable to the SOAP API.
callback When using JSON, specify a JSONP wrapper in which the JSON response is to be wrapped.

Returned Values

The XML response is contained within a <ip_location_res> element.

Name Description
status Returns ok if the operation has succeeded, or error if an error has occurred; Returns the error_code for error details.
error_code Returns the error code when the status is error. See below for error codes.
t2a_version_number The current API version number.
credit_used The number of credits used in order to execute the request.
mode Returns normal or test when executed in the free test mode.
ip_address The IP address submitted, in text form. If the submitted value was a DNS entry, this is the IP address of that entry.
hostname DNS entry value.
geo_data A geo_data record. Note that city is set in geo_data, where possible

Error Codes

See the common error codes. There are no errors which are specific to this method.

Free Test Mode

When operating in the free test mode errors are returned if mandatory parameters are missing, or it returns a dummy data response, in an identical format to a real response.

Note that the mode is returned as test when the method is operating in the free test mode.

Example XML Response

<?xml version="1.0"?>
    <country_name>United Kingdom</country_name>

Back to Geolocation

Full API method list


Enter an IP Address to find its location.