Get Worldwide Postal Code Data with Zip Code API (Sponsored)

Accurate shipping and location information is well worth the price you need to pay for it. You can sell that information, you can target consumers to perfection, and save yourself loads of frustration when it comes to shipping. Creating your own location API isn’t worth the time — there are amazing APIs that can do […]

The post Get Worldwide Postal Code Data with Zip Code API (Sponsored) appeared first on David Walsh Blog.

Accurate shipping and location information is well worth the price you need to pay for it. You can sell that information, you can target consumers to perfection, and save yourself loads of frustration when it comes to shipping. Creating your own location API isn’t worth the time — there are amazing APIs that can do that job for you, like Zip Code API.

Quick Hits

  • Free to try with 10,000 requests per month!
  • Provides world wide postal codes, not just the most popular countries
  • Provides distance calculations and radius search
  • Detailed documentation with code samples in Node.js, PHP, Python, and more
  • Awesome pricing for small to large sized websites

Using Zip Code API

After signing up for a free account, Zip Code API generates an API key for you to use. To search for a given zip code or zip codes, use the /search endpoint with codes and country parameters:

curl "https://app.zipcodebase.com/api/v1/search?codes=90210&country=US" \ -H "apikey: MY_API_KEY"
{ "query":{ "codes":[ "90210" ], "country":"US" }, "results":{ "90210":[ { "postal_code":"90210", "country_code":"US", "latitude":"34.09010000", "longitude":"-118.40650000", "city":"Beverly Hills", "state":"California", "state_code":"CA", "province":"Los Angeles", "province_code":"037" } ] }
}

You can get bulk zip code information by separating postal codes by comma — a good example being gathering both shipping and billing addresses.

Knowing the distance between two zip codes could help in calculating shipping between a start and a destination. You can get that distance information via the /distance endpoint:

curl "https://app.zipcodebase.com/api/v1/distance?code=90210&compare=53711&country=US&unit=miles" -H "apikey: MY_API_KEY"
{ "query":{ "unit":"miles", "code":"90210", "country":"US", "compare":[ "53711" ] }, "results":{ "53711":1671.98 }
}

You can also get zip code data per city or entire state:

# City
curl "https://app.zipcodebase.com/api/v1/code/city?city=Madison&state_code=WI&country=US" -H "apikey: MY_API_KEY" # State
curl "https://app.zipcodebase.com/api/v1/code/state?state_code=WI&country=US" -H "apikey: MY_API_KEY"

I love how simple Zip Code API is — it doesn’t try to do too much but provides a wealth of information and flexibility. I also love the allowance of 10,000 requests for the free account. Its reliability is also a major highlight. If you need zip code information for geolocation, shipping, or other purposes, give this a shot!

Rojenx is a leading concept artist who work appears in games and publications

Check out his personal gallery here

This site uses Akismet to reduce spam. Learn how your comment data is processed.