USPS Tracking Numbers are Recycled and Not Unique Values

Tadashi Shigeoka ·  Thu, June 29, 2017

When providing EC services within the United States or to the US, using USPS (United States Postal Service) is essential.

You should remember that the tracking numbers issued by USPS are not unique values and are reused (recycled) after delivery completion. Forgetting this can cause unexpected system errors.

If you Google search with the keywords USPS Tracking Number Reused, you’ll find several articles from people with similar questions:

When developing with USPS tracking codes, the key point to be careful about is that tracking codes are reused. A tracking code assigned to User A’s shipment in the past can easily be assigned to User B’s shipment a year later.

Therefore, implementing logic that expects tracking codes as keys to be unique becomes a breeding ground for bugs. Of course, you should never set unique constraints on them.

You might think, “Why not provide tracking codes with a base and number of digits that make them unique?” However, having too many digits would make the UX terrible for manual input, so from a user perspective, it’s probably better to reuse them.

That’s all from the Gemba.