{ "name": "United States Postal Service", "courier_code": "usps", "tracking_numbers": [ { "tracking_url": "https://tools.usps.com/go/TrackConfirmAction?tLabels=%s", "name": "USPS 20", "id": "usps_20", "description": "20 digit USPS numbers", "regex": [ "\\s*(?", "(?([0-9]\\s*){2})", "(?([0-9]\\s*){9})", "(?([0-9]\\s*){8})", ")", "(?[0-9]\\s*)" ], "validation": { "checksum": { "name": "mod10", "evens_multiplier": 3, "odds_multiplier": 1 } }, "test_numbers": { "valid": [ "0307 1790 0005 2348 3741", " 0 3 0 7 1 7 9 0 0 0 0 5 2 3 4 8 3 7 4 1 ", "7112 3456 7891 2345 6787" ], "invalid": [ "0307 1790 0005 2348 3742" ] }, "additional": [ { "name": "Service Type", "regex_group_name": "ServiceType", "lookup": [ { "matches": "71", "name": "Certified Mail" }, { "matches": "73", "name": "Insured Mail" }, { "matches": "77", "name": "Registered Mail" }, { "matches": "81", "name": "Return Receipt For Merchanise" } ] } ] }, { "name": "USPS 34v2", "id": "usps_32V2", "description": "variation on 34 digit USPS IMpd numbers", "regex": [ "\\s*(?4\\s*2\\s*0\\s*)(?([0-9]\\s*){5})", "(?([0-9]\\s*){4})", "(?", "(?9\\s*[2345]\\s*)?", "(?([0-9]\\s*){8})", "(?([0-9]\\s*){11})", ")", "(?[0-9]\\s*)" ], "validation": { "checksum": { "name": "mod10", "evens_multiplier": 3, "odds_multiplier": 1 } }, "tracking_url": "https://tools.usps.com/go/TrackConfirmAction?tLabels=%s", "test_numbers": { "valid": [ "4201002334249200190132607600833457", "4201028200009261290113185417468510", " 4 2 0 1 0 2 8 2 0 0 0 0 9 2 6 1 2 9 0 1 1 3 1 8 5 4 1 7 4 6 8 5 1 0 " ], "invalid": [ "4201028200009261290113185417468511" ] } }, { "name": "USPS 91", "id": "usps_91", "description": "USPS now calls this the IMpd barcode format", "regex": [ "\\s*(?:(?4\\s*2\\s*0\\s*)(?([0-9]\\s*){5}))?", "(?", "(?9\\s*[12345]\\s*)?", "(?([0-9]\\s*){2})", "(?([0-9]\\s*){2})", "(?([0-9]\\s*){8})", "(?([0-9]\\s*){11}|([0-9]\\s*){7})", ")", "(?[0-9]\\s*)" ], "validation": { "checksum": { "name": "mod10", "evens_multiplier": 3, "odds_multiplier": 1 }, "serial_number_format": { "prepend_if": { "matches_regex": "^(?!9[1-5]).+", "content": "91" } } }, "partners": [{ "description": "FedEx SmartPost uses USPS for last mile delivery, but not all USPS91 numbers are SmartPosts", "partner_type": "shipper", "partner_id": "fedex_smartpost", "validation": { "matches_all": [ { "regex_group_name": "ServiceType", "matches": "29" }, { "matches": "61", "regex_group_name": "SCNC" } ] } }], "tracking_url": "https://tools.usps.com/go/TrackConfirmAction?tLabels=%s", "test_numbers": { "valid": [ "420 22153 9101026837331000039521", "7196 9010 7560 0307 7385", "9505 5110 6960 5048 6006 24", "9101 1234 5678 9000 0000 13", "92748931507708513018050063", "9400 1112 0108 0805 4830 16", "9361 2898 7870 0317 6337 95", "9405803699300124287899" ], "invalid": [ "61299998820821171811", "9200000000000000000000", "420000000000000000000000000000", "420000009200000000000000000000" ] }, "additional": [ { "name": "Service Type", "regex_group_name": "ServiceType", "lookup": [ { "matches": "11", "name": "First Class (R)" }, { "matches": "29", "name": "Fedex Smart Post" } ] } ] } ] }