I need an API to give me the zip code of a location when someone enters a location like Los Angeles, California. I have seen many APIs that give you the details by the zip code, but I need the reverse.
USPS has an address information api. You give it an address and it gives you the zip code. And as the commenters said, you need to provide an address, because many cities have multiple zip codes.