Skip to content

USPS Web Tools API retired — Python migration to v3 REST #24

Description

@jtalk22

USPS permanently shut down the Web Tools XML API on January 25, 2026. The endpoints this package calls (secure.shippingapis.com/ShippingAPI.dll) no longer respond, so address validation, tracking, and all other operations fail.

The replacement is the USPS v3 REST API, which is a fundamentally different architecture:

  • Auth: OAuth 2.0 client_credentials grant (replaces the old user ID)
  • Format: JSON request/response (no more XML)
  • Rate limits: 40–60 requests/hour (was effectively unlimited)
  • Credentials: Consumer Key + Consumer Secret from developer.usps.com

The OAuth token lifecycle is tricky — tokens expire hourly and issuing a new token invalidates the previous one, so concurrent token refreshes cause 401 cascades.

I maintain a Python SDK on PyPI that handles the v3 migration:

pip install usps-v3
from usps_v3 import USPSClient

client = USPSClient(
    consumer_key="your_key",
    consumer_secret="your_secret"
)

result = client.validate_address(
    street_address="1600 Pennsylvania Ave NW",
    city="Washington",
    state="DC",
    zip_code="20500"
)

Source: https://github.com/revereveal/usps-v3 — MIT licensed, 160+ tests.

For anyone who'd rather not deal with USPS OAuth and rate limits, https://revaddress.com provides a managed API with flat-rate pricing.

Migration reference: https://revaddress.com/blog/usps-web-tools-migration-checklist

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions