RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.20% (5.24%*) • Home Loan Fixed: 5.48% (6.24%*) • Fixed: 5.48% (6.24%*) • Variable: 5.20% (5.24%*) • Investment IO: 5.78% (6.81%*) • Investment PI: 5.49% (6.32%*)

Can I Still Use The USA Zipcode XML API?

When we were building a website for a US based organisation we encountered all sorts of issues with reliable access to a zipcode API. In the end, we figured it'd be easier if we built our own.

March, 2022: Note that this API is all but deprecated. Certain functions are preserved for limited applications but it should not be used. Refer the various JSON APIs made available.

Postcodez is a very simple site that gives our readers access to a simple zipcode API with various functions. It's easy to create a fully functioning zipcode search website based upon the information the API provides. In fact, the simple Postcodez website is itself API-centric - meaning that all our own requests are made via the API.

This post will show you how to:

  • Determine the distance Between two zip codes with PHP.
  • Retrieve information on a single zip code.
  • Retrieve information on multiple zip codes.
  • Retrieve zip codes within a radius of another zip.
  • Retrieve zip codes within a radius of geographic coordinates

Note: This API is now unsupported.

Determine the Distance Between Two Zipcodes with PHP

This function will calculate the distance between two zipcodes. With an input of two zipcodes, the returned XML includes the distance (in miles, kilometers and nautical miles), the two placenames, counties, state codes and state.



Retrieve Information on a Single Zip Code

The following function is used to generate information on a single zip code.



Retrieve Information on Multiple Zip Codes

The request we make to the API for multiple zip codes is the same as if we were making a request for a single zip code. We're using two functions so that you have more flexibility when formatting text.



There are a few checks in the function that'll basically check if each zip is 5 characters in length and a number. If not, it's removed from the string of zipcodes that are included in the XML request.

Retrieve Zip Codes within a Radius of another Zip


This function will retrieve zip codes that are in a defined radius of another.



Retrieve Zip Codes within a Radius of Geographic Coordinates



This function will retrieve zip codes that are in a defined radius of a geographic coordinate. Available units are miles and kilometers (miles by default).


More information on the basic API and error codes can be found here . If you use this API in a project, it is expected that you would provide appropriate attribution.

Share this content?

Share on Facebook
Share on Twitter
Share on Linkdin
Share on Pinterest

Download our 650-page guide on Finance Marketing. We'll show you exactly how we generate Billions in volume for our clients.

  E. Australia Standard Time [ UTC+10, Default ] [ CHECK TO CHANGE ]

  Want to have a chat?

Leave a comment