Geo-code an address

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


Back to Address & Postcode

Full API method list

Demo


Enter an address to find its latitude/longitude and northings/eastings.

API method to use: geo_code

Description


Returns latitude, longitude, northing and easting of a UK postcode, address, place or street.

This is useful for plotting points on a map or performing a range of mapping calculations.

Knowing where in the country your customers are can help you deliver a better, more personalised service. Whether you use this information to effectively target your marketing campaigns or to analyse customer behaviour around the country, your goal can be easily achieved using our API.

This method will only geo-code your inputted address details to the centre of the nearest postcode. To geo-code a specific address to the highest level of accuracy (an individual premises) please use address_geo_code.

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.
text Enter a UK place name, address, street name or postcode.

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 <geo_code_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.
geo_data_list List of geo_data records.

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"?>
<geo_code_res>
  <t2a_version_number>1.0.0.8</t2a_version_number>
  <status>ok</status>
  <geo_data_list>
    <geo_data>
      <north>450919</north>
      <east>462573</east>
      <country_code>GB</country_code>
      <latitude>53.950596</latitude>
      <longitude>-1.04804</longitude>
      <description>YO10 5NP</description>
    </geo_data>
  </geo_data_list>
</geo_code_res>