USPS Web Tools: Address Validation

Number of APIs: 3

Welcome

This is a community resource for developers using the USPS Web Tools APIs. It was created by Lob's developer experience team. We welcome feedback to improve these collections. Just Drop us an email

Modern API Docs

Thanks to Qodex, we created an OpenAPI spec for these APIs and generated documentation using Redoc. Check them out at ...

www.uspsweb.tools

We share the story behind this collection and modernizing USPS Web Tools developer experience.

USPS Authentication

USPS Web Tools API are accessible using your Web Tools User ID. To authenticate a request add the USERID attribute to the outermost XML element and set the value equal to your Web Tools User ID.

Register on the USPS Web Tools API Portal for your Web Tools ID.

USPS official Developers Guide - PDF format.

Note: USPS Web Tools API does not follow standard OAuth, OpenID or Basic Authentication patterns. For this reason, we use Environment variables and Qodex Pre-request Script in our HTTP requests

How Collection Works

Collections are made up on multiple http requests. These requests use Qodex environment variables to set the USERID and XML parameters.

You can fork the USPS Web Tools Environment we provide OR create your own that looks like the below image.

IMPORTANT: make sure you select the right environment in your workspace.

Since most methods are GETs and XML payloads are passed as a URL parameter, we use Qodex Pre-request Script tab to declare variables for use in building the XML and dynamically set it prior to making an API call.

Important Notice: User ID
The Web Tools User ID provided is for you and your company to use when requesting data via the Internet from the U.S. Postal Service API servers. As per the Terms and Conditions of Use Agreement you agreed to during the Web Tools registration process, you are responsible to maintain the confidentiality of your User ID as specified. You may not package any APIs with your User ID for resale or distribution to others. The U.S. Postal Service does not prohibit the reuse and/or distribution of the API documentation (User's Guide) with sample code in order to generate awareness, encourage use or provide ease-of-use to customers or affiliates.

Warning - If the U.S. Postal Service discovers use of the same User ID from more than one web site, all users will be subject to loss of access to the USPS production server and/or termination of the licenses granted under the Terms and Conditions of Use.

  1. Verify GET {{baseUrl}}/ShippingAPI.dll?API=Verify&XML={{xmlParam}}

  2. City State Lookup GET {{baseUrl}}/ShippingAPI.dll?API=CityStateLookup&XML={{xmlParam}}

  3. Zip code Lookup GET {{baseUrl}}/ShippingAPI.dll?API=ZipCodeLookup&XML={{xmlParam}}