Skip to content

USPS v3 SDKs

MIT-licensed packages for Python, Node.js and PHP that call the USPS v3 APIs, with OAuth and token refresh handled.

Web Tools packages to replace

USPS shut down Web Tools on January 25, 2026. These packages are still on the registries, and every Web Tools request they make returns 410 Gone.

Package Registry State
usps-api PyPI Broken
usps-webtools npm Broken
pyusps PyPI Broken, unmaintained
vinceg/usps Packagist Stale for 5+ years

A requirements.txt, package.json or composer.json that still lists one of these is calling a retired API. The SDKs below replace them on the USPS v3 APIs.

Python

pip install usps-v3

Validate an address Python
from usps_v3 import Client

# Or set USPS_CLIENT_ID and USPS_CLIENT_SECRET and call Client()
client = Client(client_id="your-id", client_secret="your-secret")

result = client.addresses.validate(
    street_address="1600 Pennsylvania Ave NW",
    city="Washington",
    state="DC",
    zip_code="20500"
)
print(result["address"]["ZIPPlus4"])  # "0005"

Features

  • Python 3.9+
  • One dependency (httpx)
  • File-based token cache
  • Thread-safe OAuth

Replaces

  • usps-api (archived)
  • usps-webtools (defunct)
  • pyusps (unmaintained)

Node.js

npm install usps-v3

Validate an address JavaScript
import { USPSClient } from 'usps-v3';

const client = new USPSClient({
  clientId: process.env.USPS_CLIENT_ID,
  clientSecret: process.env.USPS_CLIENT_SECRET,
});

const result = await client.addresses.validate({
  streetAddress: '1600 Pennsylvania Ave NW',
  city: 'Washington',
  state: 'DC',
  ZIPCode: '20500',
});
console.log(result.address.ZIPPlus4); // "0005"

Features

  • Node 18+
  • TypeScript definitions
  • Zero dependencies
  • Token caching and refresh

Replaces

  • usps-webtools (broken since the shutdown)
  • usps-webtools-promise (archived)

composer require revaddress/usps-v3-php

Validate an address PHP
use RevAddress\USPSv3\Client;

$usps = new Client('your-client-id', 'your-client-secret');

$result = $usps->validateAddress([
    'streetAddress' => '1600 Pennsylvania Ave NW',
    'city'          => 'Washington',
    'state'         => 'DC',
    'ZIPCode'       => '20500',
]);
echo $result['address']['DPVConfirmation']; // "Y"

Features

  • PHP 8.0+
  • No package dependencies
  • File token cache
  • 59 tests

Replaces

  • usps-php-api (abandoned)
  • vinceg/usps (stale for 5+ years)

The hosted RevAddress API

The RevAddress API handles USPS OAuth, rate limits and token refresh for you. A free key covers Census standardization; USPS verification needs purchased funding.