USPS Track and Trace

Gets tracking information from USPS.

Inputs

NameTypeDescription
Tracking NumberStringTracking number

Outputs

NameTypeDescription
SuccessBooleanWhether successfully retrieved any tracking information
StatusStringTracking status:
Delivered, In Transit, Ready for Shipment, Ready for Pickup, Problem with Delivery, Returning to Sender, Label Created, More Information Needed
Status DescriptionStringStatus description
Last Event DateStringDate of the last update
Tracking URLStringUSPS tracking URL
Tracking SummaryStringUSPS tracking summary
Tracking EventsListUSPS Tracking events

Statuses mapping

{
  'Ready for Shipment': ['pre-shipment info sent to usps'],
  'Delivered': ['delivered'],
  'In Transit': [
    'shipment received, package acceptance pending',
    'in transit',
    'rescheduled',
    'usps awaiting item',
    'awaiting delivery scan',
    'departed usps regional destination facility',
    'departed usps regional facility',
    'accepted at usps',
    'arrived',
    'out for delivery',
    'forwarded',
    'departed',
  ],
  'Returning to Sender': ['insufficient address', 'refused', 'return to sender processed'],
  'Problem with Delivery': [
    'vacant',
    'left no address',
    'forward expired',
    'addressee unknown',
    'held at post office',
    'delivery attempted',
    'no such number',
    'notice left (no authorized recipient available)',
    'no access to delivery location',
  ],
  'Ready for Pickup': ['available for pickup', 'delivered, po box'],
  'At Customs': ['inbound into customs'],
}