The postcoder API is free. Currently at v1.0 - any requests please contact me via e-mail or twitter. All data is provided the Ordnance Survey under thier OpenData license.
Jump to: Query URI | Parameters | Partial Response | Full Response | Errors | Abuse | About author
Basic query URI
All API requests should be directed to the following URL:
The API accepts both partial and full postcode data. A partial postcode would have a valid start but an unknown ending, e.g. WC2H. A full postcode would be a complete and valid postcode, e.g. WC2H7BP
The partial response brings back a series of nodes (/postcoder/results/postcode) which contain a set of attributes about the postcode and fuller postcode information link.
<query>wc2h7b</query>
<date>Tue, 18 Oct 2011 08:45:14 -0500</date>
<results>
<postcode standard="WC2H7BA" spaced="WC2H 7BA" secondary="7BA" primary="WC2H">http://webcoding.co.uk/postcode/?query=WC2H7BA</postcode>
<postcode standard="WC2H7BD" spaced="WC2H 7BD" secondary="7BD" primary="WC2H">http://webcoding.co.uk/postcode/?query=WC2H7BD</postcode>
<postcode standard="WC2H7BE" spaced="WC2H 7BE" secondary="7BE" primary="WC2H">http://webcoding.co.uk/postcode/?query=WC2H7BE</postcode>
<postcode standard="WC2H7BF" spaced="WC2H 7BF" secondary="7BF" primary="WC2H">http://webcoding.co.uk/postcode/?query=WC2H7BF</postcode>
<postcode standard="WC2H7BG" spaced="WC2H 7BG" secondary="7BG" primary="WC2H">http://webcoding.co.uk/postcode/?query=WC2H7BG</postcode>
<postcode standard="WC2H7BJ" spaced="WC2H 7BJ" secondary="7BJ" primary="WC2H">http://webcoding.co.uk/postcode/?query=WC2H7BJ</postcode>
<postcode standard="WC2H7BL" spaced="WC2H 7BL" secondary="7BL" primary="WC2H">http://webcoding.co.uk/postcode/?query=WC2H7BL</postcode>
<postcode standard="WC2H7BP" spaced="WC2H 7BP" secondary="7BP" primary="WC2H">http://webcoding.co.uk/postcode/?query=WC2H7BP</postcode>
<postcode standard="WC2H7BX" spaced="WC2H 7BX" secondary="7BX" primary="WC2H">http://webcoding.co.uk/postcode/?query=WC2H7BX</postcode>
<postcode standard="WC2H7BY" spaced="WC2H 7BY" secondary="7BY" primary="WC2H">http://webcoding.co.uk/postcode/?query=WC2H7BY</postcode>
<postcode standard="WC2H7BZ" spaced="WC2H 7BZ" secondary="7BZ" primary="WC2H">http://webcoding.co.uk/postcode/?query=WC2H7BZ</postcode>
</results>
</postcoder>
The full infromation response is a much more detailed listing about the postcode including coordinates, streets and wards. Please note that the "name" and "class" nodes in the streets listings may or may not exist. class will usually refer to a road such as the M1 which doesnt have a name and vice versa
<postcoder contact="@ouchy" author="webcoding.co.uk" version="1.0">
<query>wc2h7bp</query>
<date>Tue, 18 Oct 2011 08:48:46 -0500</date>
<results>
<result>
<postcode standard="WC2H7BP" spaced="WC2H 7BP" secondary="7BP" primary="WC2H">/pcap/lookup.php?query=WC2H7BP</postcode>
<coordinates>
<grid>
<northing>180772</northing>
<easting>529849</easting>
<latlonstr>51.510453257485, -0.12863797229729</latlonstr>
<latitude>51.510453257485</latitude>
<longitude>-0.12863797229729</longitude>
<googlemap>http://maps.google.co.uk/?ll=51.510453257485,-0.12863797229729&z=18</googlemap>
</grid>
</coordinates>
<administration>
<district>City of Westminster London Boro</district>
<ward>St. James's Ward</ward>
</administration>
<streets>
<street proximity_to_postcode="63.29m" authority="City of Westminster London Boro" county="Greater London Authority" locality="St. James's" settlement="LONDON"> <name>Lisle Street</name><class/></street>
<street proximity_to_postcode="125.21m" authority="City of Westminster London Boro" county="Greater London Authority" locality="St. James's" settlement="LONDON"><name>Little Newport Street</name><class/></street><street proximity_to_postcode="128.74m" authority="City of Westminster London Boro" county="Greater London Authority" locality="St. James's" settlement="LONDON"><name>Newport Place</name><class/></street>
<street proximity_to_postcode="128.89m" authority="City of Westminster London Boro" county="Greater London Authority" locality="St. James's" settlement="LONDON"><name>Whitcomb Street</name><class/></street>
<street proximity_to_postcode="132.91m" authority="City of Westminster London Boro" county="Greater London Authority" locality="St. James's" settlement="LONDON"><name>Charing Cross Road</name><class>A400</class></street>
</streets>
</result>
</results>
</postcoder>
Errors are always returned in XML format as /postcoder/errors/error where error can be a 1..N list.
Current possible error scenarios and responses
1. Error - "Missing POSTCODE reference" - No data has been entered as a query
2. Error - "POSTCODE reference requires more than 2 characters" - The minimum search limit is 3 characters
3. Error - "Unable to locate this postcode" - The data entered did not match any postcodes or partial postcodes.
I reserve the right to remove any IP or user from using this system who I feel is abusing the system. If you want the whole database of information for your own postcode system then e-mail me and I'll happily help you out.
I'm @ouchy - this is done in my spare time for some fun. I'm a software engineer by day. Enjoy :)