I am looking for an API that will give me all the zip codes within a 20 mile radius of a given US city. So far based on my online search, I could only find APIs that will give me all the zip codes with a 20 mile radius for a given zip code. Hence I’m trying to find an API that will (a) first find the zip code of the center point of a city, and then (b) use the API that I referred above to pass the zip code and the distance (e.g. 20 miles) to get all the zip codes within that 20 mile radius.
So I’m looking for (a) above, which is an API that will return the zip code of the center point of a city. This is all for US.
You can use the Google Geocoding API to get the location coordinates of a city, then use reverse geocoding to look up the actual zip code for that location.
Bear in mind if you get this data from Google you need to use it on a Google Map and are not supposed to use it outside of that.