EasyPostcodes is a web-based address lookup API for retrieving the list of addresses for any given UK postcode. The database is based on the Royal Mail PAF file.
How it works.
All you need is your API Key which can be obtained by creating a trial account. You will not need your credit card for that. With your trial account you get a bundle of 100 requests for you to use for testing during the integration stage.
Once you have your trial account, just log into the portal and navigate to your keys from the menu on the left. Use one in your production environment and the other for development. At any point you can rotate the keys in accordance to your requirements.
Below you will see code examples to aid you with development. We have intentionally tried to keep it very simple. However, if you still find that you need to talk to us, then we would love to hear from you. The email address to use is email@example.com
Making a request.
C# .NET Example
Of course you would want to enhance the above example further, by ensuring the response was successful before deserializing the addresses. Also, you may want to implement a retry mechanism just in case of network errors, and so on.
Another thing you could do here is to define Typed or Named HttpClients. Either way, ensure you do not add the 'Key' header multiple times, as it is easy to make that mistake here.
Finally, you will want to read the API Key and the Uri from a configuration setting somewhere as those can change over time.
Handling the result.
Upon a successful request, you will get back an array of addresses that pertain to the given postcode used in the request. Below is the Address Model.
Please note that the geolocation information like the Northing, Easting, Latitude, and Longitude are not provided for the newest postcodes. This is on our features roadmap. For now the geolocation data is only for postcodes that the Ordnance Survey provides, which is about 99.97% coverage.
On this page we have only provided a couple of examples to get you going. If you find that the guide is not adequate or if you find mistakes in it, do let us know. We are here to help if you need us. We can even help you integrate EasyPostcodes into your application. Just let us know. We hope our address lookup API service will be to your satisfaction, but if it is not, then send us some feedback please.
We’d love to hear from you.
Contact us to learn more...