According to the USPS website, API usage is free here: https://www.usps.com/business/web-tools-apis/list-of-apis.ht...
One of the API's relates to zip codes.
One of the API's relates to zip codes.
Access to the API isn't automatic. You have to apply, which I did, and then was turned down. They only grant access if you're using the info to ship packages via the USPS. I was completely honest that I wanted the data to build open-government apps of different kinds, and they declined me.
I found a town called Bakersfield that has more than one zip fro the town, it does JSON back with more data than I thought would be part of free plan.
For some reason I could not get "san_francisco","san-francisco", "sanfrancisco", or "sf" to work.