get 9 digit zip code from 5 digit zip code, programmatic, api

You are only allowed to use the USPS API for information if you are using the USPS to send out mail...

But you could check out SmartyStreets (I used to work there) or another CASS-Certified vendor. They are licensed for address verification, and you can also perform city-state and ZIP code lookups without an address (depending on who you choose).

I think you'll find them much easier and more comprehensive than the default USPS web service.

Here's some sample code... take your pick: https://github.com/smartystreets/LiveAddressSamples


The US Postal Service have a number of APIs. Their "Address Information APIs" include:

Address Standardization

Eliminate addressing errors and help ensure accurate and timely delivery. This tool corrects errors in street addresses, including abbreviations and missing information. It also supplies a ZIP+4® Code.

ZIP Code™ Lookup

Find matching ZIP Codes or ZIP+4 Codes for any given address, city, and state in the U.S.

City/State Lookup

Use a ZIP Code to get accurate city and state information.

The Address Information APIs require permission to use.