For AI agents: the documentation index is at llms.txt. Add .md to any page's URL for its Markdown.

Tracking number formats, USPS, and Express Mail

When you call GET /v1/track/:number without ?carrier=, lastscanned identifies the carrier from the tracking number's prefix, length, and check digit before making any network request.

Because detection runs deterministically ahead of the lookup, a mistyped UPS 1Z, 16-digit Canada Post PIN, or UPU S10 international number fails fast with 400 unknown_carrier instead of wasting a lookup or polling the wrong carrier.

Shipping container numbers (ISO 6346) are detected the same way, by owner code and check digit, for the six ocean lines we cover. A leased container (owner codes such as TGHU and TCNU) can sail with any line, so pass ?carrier= with the line. See Container tracking.

How two-pass detection works

detect(trackingNumber) upper-cases and trims the input, then evaluates every carrier in fixed precedence order across two passes:

  1. Pass 1 — Strict matches(n): Checks unambiguous prefixes, exact lengths, and check digits (ups1Z, s10, dhlExpress, gs1). The first carrier whose matches(n) returns true wins.
  2. Pass 2 — Looser mayMatch(n): Only runs if no carrier matched in Pass 1. Catches secondary or partner formats:

One carrier per number. Detection sends the number to the single winning carrier and never falls back to another carrier on 404 not_found. To override detection—or to look up a carrier that has no auto-detected format like GLS US (?carrier=glsus) or pre-USPS consolidator scans on 92… labels (?carrier=osm, ?carrier=pitneybowes)—pass ?carrier=<id>.

// Evaluating carriers in exact precedence order:
// ups → usps → dhl → fedex → amazon → ontrac → uniuni → gofo → veho →
// speedee → cdl → bettertrucks → axlehire → cirro → yanwen → 4px → cainiao → yunexpress → wanbexpress → sfexpress →
// speedx → intelcom → canadapost → purolator → tforce → glsus → osm → pitneybowes → cne → sunyou → ubi → sendle → asendia
export function detect(trackingNumber: string): Carrier | undefined {
  const n = trackingNumber.trim().toUpperCase();
  const all = Object.values(carriers);
  return all.find((c) => c.matches(n)) ?? all.find((c) => c.mayMatch?.(n));
}

Common tracking number formats

These are the shapes people usually have in hand. The table below is the full regex list, in detection order.

USPS and Express Mail

  • IMpb (domestic). 20–26 digits starting with 92, 93, 94, or 95. A number that begins 9200 or 9214 is still that IMpb shape, not a separate product. Look up a USPS number.
  • 420 + ZIP. A barcode scanner often puts 420 and a 5-digit ZIP in front of the IMpb number. Detection uses the tracking number inside that prefix.
  • Express Mail and other international S10. Two letters, nine digits, and US, such as EA…US. The ninth digit is the UPU S10 check digit.
  • Consolidator 92… labels. These detect as USPS. While USPS still shows little more than awaiting item, the USPS lookup reads OSM Worldwide or Pitney Bowes scans itself when they have more. Pass ?carrier=osm or ?carrier=pitneybowes to ask that partner directly. The USPS awaiting-item checker separates electronic information from a physical scan.

UPS, FedEx, and containers

  • UPS. 1Z plus 16 letters and digits, with a Mod-10 check digit. UPS lookup.
  • FedEx. 12, 15, or 20 digits, or 22 digits starting with 96.
  • ISO 6346 containers. Owner code, six-digit serial, and a check digit. Maersk (MSKU, MRKU, MRSU, MNBU, SUDU), MSC (MSCU, MEDU, MSDU, MSMU, MSNU, MSBU), COSCO (CSNU, CBHU, CCLU, CSLU, FCIU), Evergreen (EGHU, EGSU, EISU, EITU), ONE (ONEU, KKFU), and Yang Ming (YMMU) match their own codes. A leased prefix such as TGHU or TCNU needs ?carrier= for the line that booked the box. Container tracking API.

Complete regex & prefix reference (every carrier)

The table below shows the exact regular expressions and check-digit functions used in production (n is already trimmed and upper-cased).

OrderCarrieridPass 1: Strict matches(n)Pass 2: Fallback mayMatch(n)Check digit
14-72472S10 *CO with a valid check digit (/^[A-Z]{2}\d{9}CO$/)—s10(n)
2UPSups/^1Z[0-9A-Z]{16}$/—ups1Z(n) (Mod-10)
3USPSusps/^(420\d{5})?9[2345]\d{18,24}$/ or /^[A-Z]{2}\d{9}US$/—s10(n) on …US
4DHLdhl/^\d{10}$/, /^(JJ?D\d{10,20}|GM\d{16,20}|0034043\d{13})$/, or /^[A-Z]{2}\d{9}DE$/—dhlExpress(n) on 10-digit; s10(n) on …DE
5daodao/^000(?:5712696|5715127)\d{10}$/——
6FedExfedex/^(\d{12}|\d{15}|\d{20}|96\d{20})$/——
7Amazonamazon/^TB[ACM]\d{12}$/——
8OnTrac / LaserShipontrac/^([CD]\d{14}|1LS[A-Z0-9]{12,15}(-\d)?|L[AEHINX]\d{8})$/——
9UniUniuniuni/^UUS[0-9A-Z]{13,16}$//^(UR\d{12,20}|U9999\d{6,20}|U000\d{6,20})$/—
10GOFO Expressgofo/^GFUS\d{14}$//^GF\d{13}$/—
11Vehoveho/^VH[0-9A-Z]{12}$/——
12Spee-Deespeedee/^SP(\d{16}|\d{18})$/——
13CDL Last Milecdl/^CDL\d{11}$//^\d{9}-\d$/—
14Better Trucksbettertrucks/^(BTS_[0-9A-Z]{8,14}|BTP[0-9A-Z]{12})$/——
15AxleHire (Jitsu)axlehire—/^SCD[0-9A-Z]{16}$/ or 12/16-char mixed alphanumeric (!letters-then-digits)—
16Cirrocirro/^(CR\d{12}|CIFR\d{13})$/——
17Yanwenyanwen/^[A-Z]{2}\d{9}YP$/ or /^YW[A-Z]{3}\d{12}$/—s10(n) on …YP
184PX4px/^4PX\d{13}CN$/——
19Cainiaocainiao/^(LP\d{14,17}|AP\d{14})$/——
20YunExpressyunexpress/^YT\d{16}$/——
21Wanb Expresswanbexpress/^WNB[A-Z]{2}\d{10}YQ$/——
22SF Expresssfexpress/^SF\d{13}$/ (detected; not tracked live)/^\d{12}$/ (only when no available carrier takes it)—
23SpeedXspeedx/^SPX([0-9A-Z]{15}|[0-9A-Z]{21})$/——
24Intelcom (Dragonfly)intelcom/^INTLCM[A-Z]\d{9}$/——
25Canada Postcanadapost/^\d{16}$/ or /^[A-Z]{2}\d{9}CA$/—gs1(n) on 16-digit; s10(n) on …CA
26Kuehne+Nagelkuehnenagel—/^RWM\d{9}$|^\d{2}A\d{9}$/—
27MailPlusmailplus/^MPXL\d{6}$//^MPX\d{9}$/—
28Purolatorpurolator— (12-digit PINs require ?carrier=purolator)/^[A-Z]{3}\d{9}$/—
29TForce Final Miletforce/^TF\d{18}$//^[A-Z]{2}\d{7}-\d{1,2}$/—
30GLS USglsus— (never auto-detected; requires ?carrier=glsus)——
31OSM Worldwideosm/^OSM[0-9A-Z]{14}$//^A\d{10}[A-Z]{3}\d{8}$/ (92… USPS barcodes require ?carrier=osm)—
32Pitney Bowespitneybowes/^UPAA[A-Z]\d{15}$/— (92… USPS barcodes require ?carrier=pitneybowes)—
33CNE Expresscne/^3A5V\d{9}$/——
34SunYousunyou/^SY[A-Z]{2}\d{9}$/——
35UBI Smart Parcelubi/^AU\d{13}$/——
36Sendlesendle/^(QSS\d{9}|QS\d{6})$/——
37Asendiaasendia/^AHOY[0-9A-Z]{8}$/— (USPS, AS…US & destination numbers require ?carrier=asendia)—
38Japan PostjapanpostXX123456785JP-style ✓—s10(n)
39Singapore PostsingpostXX123456785SG-style ✓—s10(n)
40Korea PostkoreapostXX123456785KR-style ✓—s10(n)
41NZ PostnzpostXX123456785NZ-style ✓—s10(n)
42DPD UKdpduk—15 + 12 digits—
43APC Postal Logisticsapc—(none: needs ?carrier=apc)—
44Landmark GloballandmarkLTN + 8–14 digits——
45Canpar ExpresscanparD + 15 digits——
46Loomis Expressloomis—(none: needs ?carrier=loomis)—
47GLS Canadaglscanada—(none: needs ?carrier=glscanada)—
48Nationexnationex—(none: needs ?carrier=nationex)—
49bpostbpostXX123456785BE-style ✓—s10(n)
50PostNordpostnordXX123456785SE/…DK-style ✓—s10(n)
51Österreichische PostaustrianpostXX123456785AT-style ✓—s10(n)
52Poczta PolskapolishpostXX123456785PL-style ✓—s10(n)
53Amerijetamerijet/^810\d{8}$/ with the mod-7 check digit——
54GLS Group Europegls—11 digits—
55InPostinpost5 or 6 + 23 digits——
56PacketapacketaZ + 9 or 10 digits——
57Hermes Germanyhermesde—(none: needs ?carrier=hermesde)—
58YDHydhYDH + 10 digits + 2 letters——
59Equick ChinaequickEQK + 2 letters + 10 digits + 2 letters——
60TopYoutopyou—/^TYZR[A-Z]\d{10}YQ$/—
61La Poste / ColissimolaposteColissimo digit + letter + 11 digits ✓ (GS1); XX123456785FR-style ✓—s10(n)
62PostNLpostnl3S + 4 letters + 7–9 digits; XX123456785NL-style ✓—s10(n)
63CorreoscorreosXX123456785ES-style ✓PQ + 20–22 letters/digitss10(n)
64Poste ItalianeposteitalianeXX123456785IT-style ✓—s10(n)
65CJ Logisticscjlogistics—(none: needs ?carrier=cjlogistics)—
66Yamato Transportyamato—(12 digits is FedEx's: needs ?carrier=yamato)—
67Delhiverydelhivery—(none: needs ?carrier=delhivery)—
68Blue Dartbluedart—(none: needs ?carrier=bluedart)—
69Evrievri—— (?carrier=evri)—
70An Postanpost/^[A-Z]{2}\d{9}IE$/—s10(n)
71Swiss Postswisspost/^[A-Z]{2}\d{9}CH$/ or /^99\d{16}$/—s10(n)
72BRT (Bartolini)brt—— (?carrier=brt)—
73Aramex Australia / NZaramexau—— (?carrier=aramexau)—
74CouriersPleasecouriersplease/^CP[A-Z]{5}\d{7}$/——
75Team Global Expressteamglobalexpress—— (?carrier=teamglobalexpress)—
76Ninja Vanninjavan—/^(NV|NL)(SG|MY|ID|PH|VN|TH|MM)[A-Z0-9]{6,16}$/—
77Flash Expressflashexpress—/^TH\d{2}[A-Z0-9]{8,12}[A-Z]$/—
78ICS Couriericscourier/^[A-Z]{2}\d[A-Z0-9]{11}[A-Z]\d[A-Z]\d[A-Z]\d$/——
79Chit Chatschitchats—— (?carrier=chitchats)—
80Passportpassport/^PG\d{10,11}[A-Z]{2}$/——
81ePost Globalepostglobal/^EPG\d{15}$/——
82JYExpressjyexpress—— (?carrier=jyexpress)—
83Sagawa Expresssagawa—— (?carrier=sagawa)—
84Aramexaramex—— (?carrier=aramex)—
85T-cat (Taiwan Pelican Express)tcat—— (?carrier=tcat)—
86Hanjinhanjin—— (?carrier=hanjin)—
87Lotte Global Logisticslotte—— (?carrier=lotte)—
88Logenlogen—— (?carrier=logen)—
89Shadowfaxshadowfax—— (?carrier=shadowfax)—
90SFC (Sendfromchina)sfc—— (?carrier=sfc)—
91Anjun Logisticsanjun—— (?carrier=anjun)—
92Winitwinit—— (?carrier=winit)—
93NZ Couriersnzcouriers—— (?carrier=nzcouriers)—
94Post Hasteposthaste—— (?carrier=posthaste)—
95Castle Parcelscastleparcels—— (?carrier=castleparcels)—
96Gaopostgaopost—— (?carrier=gaopost)—
97YF Expressyfexpress—— (?carrier=yfexpress)—
98GDWSEgdwse—— (?carrier=gdwse)—
99Chronopostchronopost—— (?carrier=chronopost)—
100Bring / Posten NorgebringXX123456785NO-style ✓370 + 15 digitss10(n)
101Matkahuoltomatkahuolto/^MH\d{9}FI$//^MA\d{19}$/—
102Posti FinlandpostiXX123456785FI-style ✓JJFI + 14 digitss10(n)
103Česká poštaceskapostaXX123456785CZ-style ✓—s10(n)
104CTT PortugalcttXX123456785PT-style ✓—s10(n)
105SEURseur—— (?carrier=seur)—
106Nova Poshtanovaposhta—20 or 59 + 12 digits—
107Samedaysameday—— (?carrier=sameday)—
108FAN Courierfancourier—— (?carrier=fancourier)—
109Econtecont—— (?carrier=econt)—
110Meestmeest—CV + 9 digits + UA—
111Yurtiçi Kargoyurtici—— (?carrier=yurtici)—
112NOEST Expressnoest—/^[A-Z0-9]{3}-[A-Z0-9]{3}-\d{6,9}$/—
113Paquetexpresspaquetexpress—3 letters + 2 digits + 1–3 letters + 6–9 digits—
114Andreaniandreani—— (?carrier=andreani)—
115The Courier Guythecourierguy—— (?carrier=thecourierguy)—
116PostNetpostnet—— (?carrier=postnet)—
11799minutosminutos99—— (?carrier=minutos99)—
118Mainfreightmainfreight—— (?carrier=mainfreight)—
119YTO ExpressytoYT + 13 digits, or YTD/YTG/YTH/YTZ + 12 digits——
120SPL Saudi PostsplXX123456785SA-style ✓—s10(n)
121KEX Express Thailandkex—— (?carrier=kex)—
122Pos MalaysiaposmalaysiaXX123456785MY-style ✓—s10(n)
123GDEXgdex—— (?carrier=gdex)—
124City-Link Expresscitylink—— (?carrier=citylink)—
125LBC Expresslbc—— (?carrier=lbc)—
126DHL eCommercedhlecommerce—— (?carrier=dhlecommerce)—
127DHL Parcel NLdhlparcelnlJVGL + 20 digits——
128DHL Parcel Iberiadhlparceles—— (?carrier=dhlparceles)—
129DHL Parcel PLdhlparcelpl—— (?carrier=dhlparcelpl)—
130DHL eCommerce UKdhlecommerceuk—— (?carrier=dhlecommerceuk)—
131DHL Freightdhlfreight—— (?carrier=dhlfreight)—
132DHLinkdhlink—— (?carrier=dhlink)—
133XQ Expressxqexpress—— (?carrier=xqexpress)—
134Ali Business Logisticsalibusiness—— (?carrier=alibusiness)—
135OmnivaomnivaS10 *EE with a valid check digit (/^[A-Z]{2}\d{9}EE$/)—s10(n)
136UkrposhtaukrposhtaS10 *UA with a valid check digit (/^[A-Z]{2}\d{9}UA$/)/^05\d{11}$/s10(n)
137Speedyspeedy—— (?carrier=speedy)—
138DPD Romaniadpdro—— (?carrier=dpdro)—
139DPD Polanddpdpl—/^\d{13}[A-Z]$/—
140DPDdpd—/^0\d{13}$/—
141DPD Portugaldpdpt—— (?carrier=dpdpt)—
142Thailand PostthailandpostS10 *TH with a valid check digit (/^[A-Z]{2}\d{9}TH$/)—s10(n)
143Chunghwa PostchunghwapostS10 *TW with a valid check digit (/^[A-Z]{2}\d{9}TW$/)—s10(n)
144EMSems/^E[A-Z]\d{9}CN$/—s10(n)
145ELTAeltaUPU S10 numbers ending in GR (check digit validated)—s10(n)
146Estafetaestafeta/^\d{12}[A-Z]\d{9}$/ (the 22-character guide)——
147Total Expresstotalexpress/^[A-Z]{4}\d{9}TX$/——
148Sagawa Globalsagawaglobal/^IDA\d{12}$/——
149MRWmrw/^\d{5}[A-Z]\d{6}$/——
150Nacexnacex/^\d{4}\/\d{8}$/ (agency/waybill)——
151HuaHanhuahan/^HHW[A-Z]{2}\d{10}[A-Z]{2}$/——
152Chukou1chukou1—/^[A-Z]{3}\d{6,7}LW\d{6,8}$/—
153ZTO Internationalztointl—/^77122\d{9}$/—
154STO Expresssto—— (?carrier=sto)—
155OCAoca—/^\d{19}$/—
156OCASAocasa—— (?carrier=ocasa)—
157Coordinadoracoordinadora—— (?carrier=coordinadora)—
158HCT Logisticshct—— (?carrier=hct)—
159Starkenstarken—— (?carrier=starken)—
160Hunter Expresshunterexpress—— (?carrier=hunterexpress)—
161Aras Kargoaras—— (?carrier=aras)—
162SMSA Expresssmsa—— (?carrier=smsa)—
163Naqel Expressnaqel—— (?carrier=naqel)—
164AUS Expressasusexp—— (?carrier=asusexp)—
165BDTPostbdtpost—— (?carrier=bdtpost)—
166Boyi Hongdabyhd—— (?carrier=byhd)—
167BYT Logisticsbyt—— (?carrier=byt)—
168CD Internationalchengda—— (?carrier=chengda)—
169CHH Logisticschunhong—— (?carrier=chunhong)—
170Chuangyu Logisticscyexpress—— (?carrier=cyexpress)—
171DHFEXdhfex—— (?carrier=dhfex)—
172EDL Expressedlexpress—— (?carrier=edlexpress)—
173ED POSTedpost—— (?carrier=edpost)—
174ETSCPetscp—— (?carrier=etscp)—
175Fuhai Wulianfuhai618—— (?carrier=fuhai618)—
176FJEXfujexp—— (?carrier=fujexp)—
177JSH Galaxy Expressgalaxyex—— (?carrier=galaxyex)—
178ASGYLgdasgyl—— (?carrier=gdasgyl)—
179Tianhai Supply Chaingzbtygj—— (?carrier=gzbtygj)—
180YouMeiYuTonggzymyt—— (?carrier=gzymyt)—
181HLSZ56hlsz56—— (?carrier=hlsz56)—
182HOYANG Expresshoyang—— (?carrier=hoyang)—
183Heping Logisticshpgjwl—— (?carrier=hpgjwl)—
184HSD Expresshsdex—— (?carrier=hsdex)—
185JTEXhzjtex—— (?carrier=hzjtex)—
186PD Expresshzpdex—— (?carrier=hzpdex)—
187Jiuhao Internationaljhgj—— (?carrier=jhgj)—
188JDT Logisticsjiudt—— (?carrier=jiudt)—
189LeiYi Logisticsleiyi—— (?carrier=leiyi)—
190Lingdong Internationallingdong—— (?carrier=lingdong)—
191Mayi Yinfumayiyinfu—— (?carrier=mayiyinfu)—
192Miuson Expressmiuson—— (?carrier=miuson)—
193Pingda Internationalpingda56—— (?carrier=pingda56)—
194PY Expresspyexpress—— (?carrier=pyexpress)—
195QFL Expressqfl—— (?carrier=qfl)—
196QYEXPqyexp—— (?carrier=qyexp)—
197Qyun Expressqyun—— (?carrier=qyun)—
198Shang Fang Internationalshangfang—— (?carrier=shangfang)—
199SHSGEXPshsgexp—— (?carrier=shsgexp)—
200StarGlobalstarglobal—— (?carrier=starglobal)—
201TDE Logisticssztdgyl—— (?carrier=sztdgyl)—
202Tianhui Hengyuanthhy—— (?carrier=thhy)—
203Usky Expressusky—— (?carrier=usky)—
204WM Cloudwmycc—— (?carrier=wmycc)—
205XS Expressxsexp—— (?carrier=xsexp)—
206YJI Logisticsyanjin—— (?carrier=yanjin)—
207Yilong Logisticsyilong—— (?carrier=yilong)—
208Yincag Logisticsyincag—— (?carrier=yincag)—
209ESHUN (ZES Express)eshun/^ZES[A-Z]{2}\d{10}YQ$/——
210ACS Courieracscourier—— (?carrier=acscourier)—
211Airpak Expressairpakexpress—— (?carrier=airpakexpress)—
212Allegro Oneallegroone/^ALE\d{12}$//^A[0D][0-9A-Z]{8}$/ and /^AD[0-9A-Z]{15}$/—
213Anterajaanteraja—— (?carrier=anteraja)—
214AyMakanaymakan/^AY\d{9,11}$/——
215Carguscargus—— (?carrier=cargus)—
216CDEKcdek—— (?carrier=cdek)—
217Correos Expresscorreosexpress—— (?carrier=correosexpress)—
218CTT Expresscttexpress—/^00\d{20}$/—
219DAI Postdaipost—— (?carrier=daipost)—
220ECMS Expressecms/^EC[A-Z]{3}\d{11}$/——
221Ecoscootingecoscooting—— (?carrier=ecoscooting)—
222Geisgeis—— (?carrier=geis)—
223Jeeblyjeebly/^JB\d{6,7}$/ and /^JBP\d{6}$/——
224DHL eCommerce Türkiyemngkargo—— (?carrier=mngkargo)—
225Northlinenorthline—/^\d[A-Z]{3}\d{5,8}$/ (customer-prefixed consignment notes)—
226Nova Globalnovaglobal/^WB\d{16}NPG$/——
227OMGOomgo/^OMGO\d{13}$/——
228Pakistan PostpakistanpostValid UPU S10 number ending PK (check digit verified), or `/^(RGL\—s10(n)
229Paperflypaperfly/^PFL-BD-CB-\d{10}$//^\d{6}-\d{6}-[A-Z]\d-[A-Z]\d$/—
230Pathao Courierpathao/^D[A-Z]\d{6}[A-Z0-9]{6}$/——
231PHLPostphlpostValid UPU S10 number ending PH (check digit verified)—s10(n)
232Planzerplanzer/^\d{5}\.\d{10}$/——
233Pos Indonesiaposindonesia—`/^P\d2(0[1-9]—
234Posta ShqiptarepostashqiptareValid UPU S10 number ending AL (check digit verified)—s10(n)
235Pošta SlovenijepostaslovenijeValid UPU S10 number ending SI (check digit verified)—s10(n)
236PostExpostex—— (?carrier=postex)—
237PósturinnposturinnUPU S10 ..IS, valid check digit—s10(n)
238Pro Carrierprocarrier/^UBG\d{9}$/——
239PTS Worldwide Expressptsexpress—— (?carrier=ptsexpress)—
240Quantium Solutionsquantium—— (?carrier=quantium)—
241Qwintryqwintry/^QR\d{8}$/——
242Redurredur—— (?carrier=redur)—
243RedXredx—— (?carrier=redx)—
244South African Post OfficesapoValid UPU S10 number ending ZA (check digit verified)—s10(n)
245Seino Transportationseino—— (?carrier=seino)—
246Sendexsendex—— (?carrier=sendex)—
247Sendingsending—— (?carrier=sending)—
248SerpostserpostUPU S10 ..PE, valid check digit—s10(n)
249Servientregaservientrega—— (?carrier=servientrega)—
250Shipashipa/^SD\d{9}$/——
251ShipEntegrashipentegra/^1SE\d{9}$/——
252Shree Maruti Couriershreemaruti—— (?carrier=shreemaruti)—
253SkyNet Worldwide Expressskynetworldwide—— (?carrier=skynetworldwide)—
254SkyPostalskypostal/^SKAMZUS\d{10}$//^SP\d{11}BR$/—
255Speedafspeedaf`/^(AE——
256SpeedPAKspeedpak/^E[ES][A-Z0-9]{26}$/——
257PostNL (Spring GDS)springgds—— (?carrier=springgds)—
258Slovak Parcel Servicesps/^703\d{11}(\d{2})?$/ (SPS's 703 prefix; the 11-digit shipment number alone is shared with other carriers)——
259SPX Express Indonesiaspxid/^SPXID\d{11}[0-9A-Z]$//^ID\d{12}[0-9A-Z]?$/—
260SPX Express Malaysiaspxmy/^SPXMY\d{11}[0-9A-Z]$//^MY\d{12}[0-9A-Z]$/—
261SPX Express Philippinesspxph/^SPXPH\d{10,16}[A-Z]?$/, /^SPEPH\d{11}[0-9A-Z]$//^PH\d{12,14}[A-Z]?$/—
262SPX Express Thailandspxth/^SPXTH\d{11}[0-9A-Z]$//^TH\d{12}[0-9A-Z]?$/—
263SPX Express Vietnamspxvn/^SPXVN\d{11}[0-9A-Z]$//^VN\d{12}[0-9A-Z]$/—
264Stallion Expressstallionexpress—`/^(SE)?2\d(0[1-9]—
265Starexstarex/^STR[A-Z]{2}\d{12}$/——
266ST Courierstcourier—— (?carrier=stcourier)—
267Straightshipstraightship`/^STR(TD\d9——
268Swiss Post Cargoswisspostcargo—— (?carrier=swisspostcargo)—
269TIPSAtipsa—/^\d{22}$/ (not starting 96)—
270TMM Expresstmmexpress—— (?carrier=tmmexpress)—
271TNTtnt—— (?carrier=tnt)—
272TOPTRANStoptrans—— (?carrier=toptrans)—
273TracX Logistracxlogis/^QSP\d{9}$/——
274TWS Express Couriertwsexpress—/^28\d{4}[A-Z]\d{6}$/—
275Urvaamurvaam—— (?carrier=urvaam)—
276Valmovalmo/^VL\d{13}$/——
277Vasp Expressovaspexpresso—— (?carrier=vaspexpresso)—
278VenipakvenipakParcel numbers: /^V\d{5}E\d{7}$/——
279Vinted Govintedgo—/^1[78]\d{14}$/—
280Vozovozvozovoz—— (?carrier=vozovoz)—
281Zeleriszeleris/^[0-9A-F]{8}\d{9}[A-Z]$/——
282ZR Expresszrexpress/^\d{1,2}-[A-Z0-9]{10}-ZR$/——
28317FEIA17feia/^FEI[A-Z]{2}\d{10}YQ$/——
2842GO Express2go—/^[A-Z]\d{7}[A-Z]$/—
2854Sides4sides/^F[SE]\d{9}RU$/——
2865Post5post—— (?carrier=5post)—
287A1 POSTa1post—— (?carrier=a1post)—
288ABF Freightabffreight—— (?carrier=abffreight)—
289A. Duie Pyleaduiepyle—— (?carrier=aduiepyle)—
290AEX Paraguayaexparaguay—/^A\d{9}$/—
291AIT Worldwideaitworldwide—/^S\d{8}$/—
292AJEXajex/^AJ[AS]\d{12}$/——
293AM Home Deliveryamhomedelivery—/^AM\d{9}$/—
294Grupo ampmampm—/^(CNA\d{12}|IDTS\d{14})$/—
295AnserXanserx/^BTYCN\d{10}YQ$/——
296APC Overnightapcovernight—/^20[12]\d(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{14}$/—
297Apple Expressappleexpress/^(APPL\d{13}|CACAINIAO\d{11})$/——
298Aramex New Zealandaramexnz—— (?carrier=aramexnz)—
299A Tu Hora Expressatuhoraexpress/^0{6}\d{10}001\d{5}$/——
300Bangladesh Postbangladeshpost—S10 *BD with a valid check digit (/^[A-Z]{2}\d{9}BD$/)—
301BEX Expressbexexpress—— (?carrier=bexexpress)—
302BJS Home Deliverybjshomedelivery—/^B\d{7}-\d{4}$/—
303BlueEXblueex—/^CP\d{12}$/—
304Blue Expressblueexpress—— (?carrier=blueexpress)—
305Bombino Expressbombino—— (?carrier=bombino)—
306Bookurierbookurier/^BOK\d{7}$/——
307MRL Globalmrlglobal—/^C[A-Z]{3}\d{6}$/—
308Border Expressborderexpress—/^[A-Z]{4}\d{5,8}$/ (not a valid ISO 6346 container number)—
309Bostabosta—— (?carrier=bosta)—
310BOX NOWboxnow—— (?carrier=boxnow)—
311Bringer Parcel Xpressbringerparcel/^BPS[A-Z0-9]{12,13}$/——
312Bulgarian Postsbulgarianposts/^PS[0-9A-Z]{11}$/——
313Burd Deliveryburddelivery/^0574500\d{11}$/——
314C3Xc3x—— (?carrier=c3x)—
315Cacesacacesa/^CNPRT\d{20}$/——
316Castorescastores—— (?carrier=castores)—
317CCFSccfs—— (?carrier=ccfs)—
318Central Transportcentraltransport—— (?carrier=centraltransport)—
319CEVA Logisticscevalogistics—— (?carrier=cevalogistics)—
320Chazkichazki—— (?carrier=chazki)—
321Chilexpresschilexpress—— (?carrier=chilexpress)—
322Chronodialichronodiali/^(?:CHPU\d{19}|CD\d{10})$/——
323Ciblexciblex—— (?carrier=ciblex)—
324City Expresscityexpressrs/^68800[125]\d{8}$/——
325CityMailcitymail/^BCM[A-Z]{1,2}\d{8,9}$/——
326CJ Packetcjpacket/^CJP[A-Z]{2,3}\d{10}YQ$/——
327Closer Logisticscloserlogistics—— (?carrier=closerlogistics)—
328Coliswebcolisweb—— (?carrier=colisweb)—
329Connect Couriersconnectcouriers—— (?carrier=connectcouriers)—
330Copa Airlines Couriercopacourier—/^H\d{7}$/—
331Correo ArgentinocorreoargentinoS10 *AR with a valid check digit (/^[A-Z]{2}\d{9}AR$/)—s10(n)
332Correos de MéxicocorreosmexicoS10 *MX with a valid check digit (/^[A-Z]{2}\d{9}MX$/)—s10(n)
333Correos de El SalvadorcorreossalvadorS10 *SV with a valid check digit (/^[A-Z]{2}\d{9}SV$/)—s10(n)
334Correo UruguayocorreouruguayoS10 *UY with a valid check digit (/^[A-Z]{2}\d{9}UY$/)—s10(n)
335Courier Centercouriercenter—— (?carrier=couriercenter)—
336CSEcserussia—— (?carrier=cserussia)—
337Cyprus PostcypruspostS10 *CY with a valid check digit (/^[A-Z]{2}\d{9}CY$/)—s10(n)
338Danske Fragtmænddanskefragtmaend/^\d{20}[A-Z]{2}\d{6}$//^[A-Z]{2}\d{6}$/—
339Daylight Transportdaylighttransport—— (?carrier=daylighttransport)—
340Day & Rossdayross—/^A\d{8}$/—
341Dayton Freightdaytonfreight—— (?carrier=daytonfreight)—
342Delovye Liniidellin—— (?carrier=dellin)—
343GAASH Worldwidegaash/^GAIH\d{8}$//^(?:GWD\d{9}|PH\d{10})$/—
344D Expressdexpress—/^[A-Z]{2}\d{10}$/—
345Direxdirex—— (?carrier=direx)—
346DobroPostdobropost/^DBRPST\d{10}$/——
347Domain Logisticsdomainlogistics—— (?carrier=domainlogistics)—
348Domexdomex—— (?carrier=domex)—
349DPD South Africadpdza—— (?carrier=dpdza)—
350DPEX Worldwidedpex—— (?carrier=dpex)—
351Dragon Star Curierdragonstarcurier—— (?carrier=dragonstarcurier)—
352Drop2Shopdrop2shop/^GLB\d{13}$/——
353Droppdropp—— (?carrier=dropp)—
354DSVdsv—— (?carrier=dsv)—
355Early Birdearlybird—— (?carrier=earlybird)—
356Easy Maileasymail—— (?carrier=easymail)—
357Egypt PostegyptpostS10 *EG with a valid check digit (/^[A-Z]{2}\d{9}EG$/) or /^[A-Z]{3}\d{8}EG$/—s10(n)
358Ekartekart/^(?:AMI|BAL|BGS|BSI|DEL|FLO|FMP|GLA|LUA|MY[ENS]|SDL|SHO|SPO|SRT|TEL)[CPR]\d{10}$/——
359eMileemile/^EM\d{12}CA$/ or /^EM\d{16}CA$/——
360EMS VietnamemsvietnamS10 *VN with a valid check digit (/^[A-Z]{2}\d{9}VN$/) or /^E[A-Z]\d{9}VN$/—s10(n)
361Envia Colombiaenviacolombia—— (?carrier=enviacolombia)—
362Envialiaenvialia—— (?carrier=envialia)—
363Estes Expressestes—— (?carrier=estes)—
364EuroExpresseuroexpressba—— (?carrier=euroexpressba)—
365Evdemo Lojistikevdemo—— (?carrier=evdemo)—
366Evropatevropat—— (?carrier=evropat)—
367EWEewe/^EMC\d{11}$/ or /^AMZ\d{10}$/——
368Exelotexelot/^XLT\d{9}$/——
369Exlineexline—— (?carrier=exline)—
370Exmateexmate/^EXK\d{8}J$/——
371Express Oneexpressone—— (?carrier=expressone)—
372Fargofargouz/^TEZ\d{6,10}$/——
373Fastfratefastfrate—— (?carrier=fastfrate)—
374FedEx Freightfedexfreight—— (?carrier=fedexfreight)—
375FedEx Polandfedexpl—— (?carrier=fedexpl)—
376Fermopointfermopoint—— (?carrier=fermopoint)—
377First Linefirstline/^1ST\d{11}$/——
378Flash Express Philippinesflashexpressph—/^P\d{4}[0-9A-Z]{6,7}[A-Z]$/—
379FleetExpressfleetex—/^(?:SR|DS)\d{12}$/—
380FleetOpticsfleetoptics/^F(?:OAESH\d{7}|ONSP\d{11}|DAV\d{16}|DYNS[0-9A-Z]{11}|CLR\d{12}|SLS\d{15}|EPO\d{15})$/——
381Flip Postflippost/^\d{2}-\d{3}-\d{3}$/——
382Followmontfollowmont—— (?carrier=followmont)—
383Forward Airforwardair—— (?carrier=forwardair)—
384Forza Deliveryforzadelivery/^FD\d{6,9}$/——
385Foxpostfoxpost/^CLFOX\d{15}$/——
386Franch Expressfranchexpress—— (?carrier=franchexpress)—
387Geniki Taxydromikigenikitaxydromiki—— (?carrier=genikitaxydromiki)—
388GlobalPostglobalpost/^GP[A-Z]{4}\d{10}(US|GB)$/——
389GLS Franceglsfr—/^00(?=[A-Z0-9]{6}$)(?=.*[A-Z])(?=.*\d)[A-Z0-9]{6}$/—
390GLS Italyglsit—/^[A-Z]{2}\d{9}$/—
391GMS Worldwide Expressgmsworldwide—— (?carrier=gmsworldwide)—
392GO4go4—— (?carrier=go4)—
393GoBoltgobolt—— (?carrier=gobolt)—
394GO! Expressgoexpress—— (?carrier=goexpress)—
395GOFO Francegofofr/^(GFFR\d{13,14}|CIFR\d{14})$//^PK-?\d{19}-?\d$/—
396GOFO Italygofoit—— (?carrier=gofoit)—
397GOFO Netherlandsgofonl—— (?carrier=gofonl)—
398GoGo Xpressgogoxpress—— (?carrier=gogoxpress)—
399Grand Slam Expressgrandslamexpress—— (?carrier=grandslamexpress)—
400GS Postboxgspostbox—— (?carrier=gspostbox)—
401GTA AirSkipgtaairskip/^GR[GS]\d{5}[0-9A-Z]{11}$/——
402GoTo Logisticsgtlgoto/^(TKGTL[0-9A-Z]{11}|GTL\d{10})$/——
403Happy-Posthappypost—— (?carrier=happypost)—
404HayPosthaypostS10 *AM with a valid check digit (/^[A-Z]{2}\d{9}AM$/)—s10(n)
405Helthjemhelthjem/^(00)?37072476\d{10}$/——
406HepsiJEThepsijet—— (?carrier=hepsijet)—
407Hermes Austriahermesat—— (?carrier=hermesat)—
408Hispaposthispapost—/^CNES\d{11}$/—
409Hongkong PosthongkongpostS10 *HK with a valid check digit (/^[A-Z]{2}\d{9}HK$/)—s10(n)
410Hovershiphovership—/^HV[A-Z0-9]{8}$/—
411HR Parcelhrparcel—— (?carrier=hrparcel)—
412Hrvatska poštahrvatskapostaS10 *HR with a valid check digit (/^[A-Z]{2}\d{9}HR$/)—s10(n)
413Huiyi Logisticshywl/^TRK[0-9A-F]{12}$/——
414Ilyang Logisilyanglogis—— (?carrier=ilyanglogis)—
415iMileimile/^IM0601\d{10}$/——
416Indah Logistikindahlogistik/^[A-Z]{3}1CS(?:\d{8}|(?:PL)?\d{12})$/——
417Integral Packintegralpack/^IPE-\d{4}-[A-Z]-\d{8}$/——
418Internet Expressinternetexpress—— (?carrier=internetexpress)—
419Inter Rapidísimointerrapidisimo—— (?carrier=interrapidisimo)—
420Israel PostisraelpostS10 *IL with a valid check digit (/^[A-Z]{2}\d{9}IL$/)—s10(n)
421J&T Express Australiajandtau/^JTAU\d{12}$/——
422J&T Cargojandtcargo—— (?carrier=jandtcargo)—
423J&T Express Germanyjandtde/^JTDE\d{12}$/——
424Janiojanio/^JN[A-Z]{2}\d{12}$/——
425JCEXjcex/^JCZ\d{10}DH$/——
426JD Logisticsjdlogistics/^(?:VG\d{11}|JD(?:[A-Z]\d{12}|[A-Z]{2}\d{11}))$/——
427Jersey PostjerseypostS10 *JE with a valid check digit (/^[A-Z]{2}\d{9}JE$/)—s10(n)
428Jetline Couriersjetlinecouriers—— (?carrier=jetlinecouriers)—
429Jet Logisticjetlogistic—— (?carrier=jetlogistic)—
430JNEjne/^JT\d{11}$/——
431JS Expressjsexpress/^JSE[A-Z]{2}\d{10}YQ$/——
432Jumppointjumppoint/^JP\d{12}$/——
433KazpostkazpostS10 *KZ with a valid check digit (/^[A-Z]{2}\d{9}KZ$/)—s10(n)
434KEX Express Hong Kongkexexpresshk/^KEHKAZ\d{8}$//^L\d{9}$/—
435Kun Expresskunexpress/^KUN\d{10}$/——
436Kunyoung Expresskunyoung—— (?carrier=kunyoung)—
437Kyungdong Expresskyoungdong—— (?carrier=kyoungdong)—
438Kyrgyz PostkyrgyzpostS10 *KG with a valid check digit (/^[A-Z]{2}\d{9}KG$/)—s10(n)
439Laar Courierlaarcourier—— (?carrier=laarcourier)—
440LaBaihlabaih—— (?carrier=labaih)—
441La Poste Burkina FasolaposteburkinafasoS10 *BF with a valid check digit (/^[A-Z]{2}\d{9}BF$/)—s10(n)
442La Poste du SénégallapostesenegalS10 *SN with a valid check digit (/^[A-Z]{2}\d{9}SN$/)—s10(n)
443Last One Mile Co-oplastonemilecoop—— (?carrier=lastonemilecoop)—
444Leopards Courierleopardscourier—— (?carrier=leopardscourier)—
445Liccardi Express Courierliccardi—— (?carrier=liccardi)—
446Lietuvos paštaslietuvospastas/^(CC|CH|HC)\d{9}LT$/——
447Lightning Expresslightningexpress/^[A-Z]{3}\d{3}20\d{2}[01]\d[0-3]\d\d{4}$/——
448Line Clear Expresslineclear—— (?carrier=lineclear)—
449LinHan Internationallinhan/^LHGJ\d{8}CD$/——
450Lion Parcellionparcel/^\d{2}LP\d{10,13}$/——
451Logistiqlogistiq/^ALAEAEF\d{9}$//^AL[A-Z]{5,6}\d{9}$/—
452L-POSTlpost/^ABC\d{8}$/——
453Madhur Couriermadhurcourier—/^P\d{9}$/—
454MailAmericasmailamericas/^ML[A-Z]{2}\d{9}(?:R|EX)$/ or /^MMXQP\d{9}[ENR]$/——
455MaltaPostmaltapostS10 *MT with a valid check digit (/^[A-Z]{2}\d{9}MT$/)—s10(n)
456Maritime-Ontariomaritimeontario—/^F\d{7}$/—
457Mauritius PostmauritiuspostS10 *MU with a valid check digit (/^[A-Z]{2}\d{9}MU$/)—s10(n)
458Micro Expressmicroexpress/^ME\d{13}[A-Z0-9]{3}$/——
459Midland Transportmidlandtransport—/^\d{16}$/—
460M-ONEmone—/^PL\d{9}RS$/—
461Muller & Phippsmulphilog—— (?carrier=mulphilog)—
462Mylerzmylerz—/^63\d{12}$/—
463Next Levelnextleveldelivery—— (?carrier=nextleveldelivery)—
464Nim Expressnimexpress—— (?carrier=nimexpress)—
465noxnox/^SWR\d{21}$/——
466OCS ANAocsana—— (?carrier=ocsana)—
467Olva Courierolvacourier/^ALI-OLVA\d{8}$//^(?:\d{2}-\d{6,8}|\d{6,8}-\d{2})$/—
468One World Expressoneworldexpress/^OWE\d{12}$/——
469ORLEN Paczkaorlenpaczka—/^210\d{10}$/—
470Paackpaack/^PK\d{18}$/——
471Packlinkpacklink/^[A-Z]{2}20\d{2}(?:COM|PRO)\d{10}$/——
472Pack-Manpackman—— (?carrier=packman)—
473PCP Expresspcpexpress—— (?carrier=pcpexpress)—
474PDN Expresspdnexpress/^PDN\d{10}$/——
475PDQ Cargo Traderpdqchile—— (?carrier=pdqchile)—
476PFC Expresspfcexpress—/^R\d{5,6}2\d(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])\d{1,4}$/—
477Pilot Freight Servicespilotfreight—— (?carrier=pilotfreight)—
478PITT OHIOpittohio—/^\d{10}$/ with the mod-7 check digit—
479Pošta na Severna MakedonijapostamkS10 *MK with a valid check digit (/^[A-Z]{2}\d{9}MK$/)—s10(n)
480POST LuxembourgpostluxembourgS10 *LU with a valid check digit (/^[A-Z]{2}\d{9}LU$/)—s10(n)
481PPLppl—— (?carrier=ppl)—
482Precision Deliveriesprecisiondeliveries/^ASL\d{10}$/——
483ProShipsproships—/^ML\d{9}MH$/—
484Pullman Cargopullmancargo—— (?carrier=pullmancargo)—
485Quiqupquiqup—— (?carrier=quiqup)—
486Rabenraben—/^276(?:574|634)\d{9}$/—
487RAM Hand-to-Hand Couriersramh2h/^RAM\d{8}$/——
488Relais Colisrelaiscolis/^CC\d{10,14}$/——
489R+L Carriersrlcarriers—— (?carrier=rlcarriers)—
490Roadrunnerroadrunner—— (?carrier=roadrunner)—
491RPX Indonesiarpxindonesia—— (?carrier=rpxindonesia)—
492Saiasaia—— (?carrier=saia)—
493Sailpostsailpost—— (?carrier=sailpost)—
494SAP Expresssapxexpress—— (?carrier=sapxexpress)—
495SATsatukraine—— (?carrier=satukraine)—
496SEKO Logisticsseko—— (?carrier=seko)—
497Shree Anjani Couriershreeanjani—— (?carrier=shreeanjani)—
498Skroutz Last Mileskroutzlastmile—— (?carrier=skroutzlastmile)—
499SkyKingskyking—— (?carrier=skyking)—
500Slovenská poštaslovenskapostaS10 *SK with a valid check digit (/^[A-Z]{2}\d{9}SK$/)—s10(n)
501Southeastern Freight Linessoutheasternfreightlines—— (?carrier=southeasternfreightlines)—
502Gokulam Speed & Safespeedandsafe—— (?carrier=speedandsafe)—
503Speedexspeedex—— (?carrier=speedex)—
504SPX Express Brazilspxbr—/^BR\d{12}[0-9A-Z]$/—
505Sundarban Couriersundarbancourier—— (?carrier=sundarbancourier)—
506Tanzania PoststanzaniapostsS10 *TZ with a valid check digit (/^[A-Z]{2}\d{9}TZ$/)—s10(n)
507Taxydemataxydema—— (?carrier=taxydema)—
508TCI Expresstciexpress—— (?carrier=tciexpress)—
509TCStcspakistan—— (?carrier=tcspakistan)—
510TDNtdn—— (?carrier=tdn)—
511Tealcatealca—— (?carrier=tealca)—
512Team Expressteamexpressae—— (?carrier=teamexpressae)—
513Team Worldwideteamworldwide—— (?carrier=teamworldwide)—
514Teleshipteleship/^TSGB[A-Z]{2}[A-Z0-9]{15}$/——
515TFM Expresstfmexpress—— (?carrier=tfmexpress)—
516Tgrouptgroup/^3010TGR\d{14}$/——
517Shree Tirupati Couriertirupaticourier—— (?carrier=tirupaticourier)—
518TNT Italytntit—— (?carrier=tntit)—
519Torrestirtorrestir/^M001\d{4}[0-9A-Z]\d{11}$/——
520Trackontrackon—— (?carrier=trackon)—
521Transcorptranscorp—— (?carrier=transcorp)—
522TST-CF Expresststcfexpress—— (?carrier=tstcfexpress)—
523TufesaPacktufesa—— (?carrier=tufesa)—
524United Delivery Serviceuniteddeliveryservice/^APUDS\d{8}$/——
525Upayaupaya/^[A-Z]{6}\d{4}-\d{7}$/——
526Urbanourbano—— (?carrier=urbano)—
527Uzbekistan PostuzbekistanpostS10 *UZ with a valid check digit (/^[A-Z]{2}\d{9}UZ$/)—s10(n)
528Velocesveloces—/^V\d{10}$/—
529Via Cargoviacargo—— (?carrier=viacargo)—
530Vimenpaqvimenpaq—— (?carrier=vimenpaq)—
531VRL Logisticsvrllogistics—— (?carrier=vrllogistics)—
532Whistlwhistl—/^TYP[A-Z]{3}\d{9}$/—
533XDE Logisticsxdelogistics/^XSO\d{12}$/——
534XLCourierxlcourier/^XLC\d{10,12}$/——
535XPOxpoltl—/^\d{9}$/—
536YCS Logisticsycslogistics—— (?carrier=ycslogistics)—
537Yunda Expressyunda—— (?carrier=yunda)—
538Dohrn Transferdohrn—— (?carrier=dohrn)—
539Horoz Lojistikhoroz—— (?carrier=horoz)—
540Morning Globalmorningglobal—/^BR\d{9}MG$/—
541Jordan PostjordanpostS10 *JO with a valid check digit (/^[A-Z]{2}\d{9}JO$/)—s10(n)
542China Postchinapostcustom (see the carrier page)——
543Gatigati—— (?carrier=gati)—
544Zajil Expresszajil—— (?carrier=zajil)—
545SwiftX Expressswiftx/^SWX\d{18}$/——
546Maerskmaersk/^(MSKU|MRKU|MRSU|MNBU|SUDU)\d{7}$/—iso6346(n) (ISO 6346 container check digit)
547MSCmsc/^(MSCU|MEDU|MSDU|MSMU|MSNU|MSBU)\d{7}$/—iso6346(n) (ISO 6346 container check digit)
548COSCO Shippingcosco/^(CSNU|CBHU|CCLU|CSLU|FCIU)\d{7}$/—iso6346(n) (ISO 6346 container check digit)
549Evergreenevergreen/^(EGHU|EGSU|EISU|EITU)\d{7}$/—iso6346(n) (ISO 6346 container check digit)
550ONE (Ocean Network Express)one/^(ONEU|KKFU)\d{7}$/—iso6346(n) (ISO 6346 container check digit)
551Yang Mingyangming/^YMMU\d{7}$/—iso6346(n) (ISO 6346 container check digit)

Check-digit algorithms

Four check-digit validators rule out mistyped numbers and non-tracking numbers (such as 10-digit phone numbers that would otherwise look like a 10-digit DHL Express waybill, or 16-digit credit card numbers that would otherwise look like a Canada Post PIN):

/** UPS 1Z: letters count as (char code - 63) mod 10, odd indices doubled, mod 10. */
export function ups1Z(n: string): boolean {
  const body = n.slice(2, -1).toUpperCase();
  let sum = 0;
  for (let i = 0; i < body.length; i++) {
    const ch = body[i];
    const v = ch >= "0" && ch <= "9" ? Number(ch) : (ch.charCodeAt(0) - 63) % 10;
    sum += i % 2 ? v * 2 : v;
  }
  return (10 - (sum % 10)) % 10 === Number(n.slice(-1));
}

/** UPU S10 (EA123456785US, RR123456785DE, UV123456785YP, EE123456785CA): weights 8,6,4,2,3,5,9,7 over 8 serial digits, mod 11. */
export function s10(n: string): boolean {
  const d = n.slice(2, 11);
  const w = [8, 6, 4, 2, 3, 5, 9, 7];
  const c = 11 - (w.reduce((s, x, i) => s + x * Number(d[i]), 0) % 11);
  return (c === 10 ? 0 : c === 11 ? 5 : c) === Number(d[8]);
}

/** DHL Express 10-digit waybill: first 9 digits mod 7 equal the 10th digit. */
export function dhlExpress(n: string): boolean {
  return Number(n.slice(0, 9)) % 7 === Number(n[9]);
}

/** GS1 mod 10 (Canada Post 16-digit PINs, SSCC, GTIN): weights 3,1 from the right, check digit excluded. */
export function gs1(n: string): boolean {
  const body = n.slice(0, -1);
  let sum = 0;
  for (let i = 0; i < body.length; i++) sum += Number(body[body.length - 1 - i]) * (i % 2 ? 1 : 3);
  return (10 - (sum % 10)) % 10 === Number(n.slice(-1));
}

Format collisions & precedence rules

Several carriers issue overlapping numeric lengths or hand parcels to partner networks. Here is how lastscanned resolves them:

1. 12-digit and 20-digit numbers: FedEx vs Purolator, Canada Post & DHL Paket

  • 12-digit numbers (/^\d{12}$/) route to FedEx in Pass 1. If you are tracking a 12-digit Purolator or Canada Post PIN, pass ?carrier=purolator or ?carrier=canadapost. (12-character alphanumeric Purolator PINs like PQR482019376 auto-detect in Pass 2 via /^[A-Z]{3}\d{9}$/, while Sendle QSS\d{9} numbers win earlier in Pass 1.)
  • 20-digit numbers starting 0034043 (DHL's GS1 prefix, /^0034043\d{13}$/) route to DHL; all other 20-digit numbers route to FedEx.

2. 22-digit numbers (92…–95… vs 96…) & the "USPS Currently Awaiting Package" consolidator override

  • 20–26 digit numbers starting 92, 93, 94, or 95 (optionally prefixed with 420 + 5-digit destination ZIP, /^(420\d{5})?9[2345]\d{18,24}$/) route to USPS in Pass 1, while 22-digit numbers starting 96 (/^96\d{20}$/) route to FedEx.
  • Consolidator middle-mile scans (?carrier=osm and ?carrier=pitneybowes): Parcels shipped via OSM Worldwide or Pitney Bowes typically carry a 92… (or 420 + ZIP + 92…) USPS IMpb barcode. While the parcel is moving through OSM's or Pitney Bowes's middle-mile sort network (3–7 days), USPS only displays "Pre-Shipment: Shipping Label Created, USPS Awaiting Item" ("USPS Currently Awaiting Package"). Pass ?carrier=osm or ?carrier=pitneybowes on that same 92… or 420…92… number to retrieve the consolidator's live regional sort facility scans before USPS acceptance.

3. Why GLS US (?carrier=glsus) is never auto-detected

GLS US (formerly Golden State Overnight / GSO) uses 8–11 digit uncheck-digited numbers (typically 9 digits like 512345678) and arbitrary shipper references (CA0W2208048, 20-digit references) that collide with other carriers and get reused across shipments. glsus sets matches: () => false and has no mayMatch, so you must always pass ?carrier=glsus (or carrier: "glsus" in MCP).

4. Alphanumeric 12- and 16-character codes: AxleHire (Jitsu) vs prefixed carriers

AxleHire (Jitsu) issues 12- and 16-character alphanumeric codes (e.g. 4AUMF4FWVRB5, BQH4FN5QAQYV3SDQ) as well as SCD + 16-character shipper numbers. To prevent AxleHire from swallowing prefixed carrier numbers like VH + 12 (veho), BTP + 12 (bettertrucks), CR + 12 (cirro), QSS + 9 (sendle), or AHOY + 8 (asendia):

  • AxleHire only runs in Pass 2 (mayMatch), after all Pass 1 prefix carriers have been checked.
  • AxleHire explicitly rejects pure letters-then-digits strings (!/^[A-Z]+\d+$/i.test(n)), requiring letters and digits to be interleaved (which also leaves 3-letters-then-9-digits cleanly to Purolator).

5. Partner & white-label numbers (?carrier= overrides)

Pass ?carrier= when tracking any of the following partner or shipper-assigned formats:

  • GLS US: All GLS US / GSO numbers (?carrier=glsus).
  • Purolator: 12-digit all-numeric PINs (?carrier=purolator).
  • OSM Worldwide & Pitney Bowes: 92… / 420+ZIP+92… USPS IMpb barcodes when querying middle-mile sort scans (?carrier=osm or ?carrier=pitneybowes).
  • Asendia: AS…US numbers, USPS domestic induction labels, and destination postal numbers (?carrier=asendia).
  • UniUni: Partner numbers starting GV… or JY… (?carrier=uniuni).
  • GOFO Express: Shipper numbers starting CR… or YT… (?carrier=gofo).
  • Cirro: Parcels delivered by GOFO under a GFUS… barcode auto-detect as gofo; pass ?carrier=cirro to query Cirro directly, or for SKP… shipper numbers.
  • OnTrac, Veho, CDL, TForce Final Mile: Shipper-assigned reference numbers outside the standard barcode formats above.

Cross-border handoffs (yanwen, 4px, cainiao, yunexpress, cne, sunyou, ubi, asendia)

Cross-border parcels originating in China via Yanwen (…YP, YW…), 4PX (4PX…CN), Cainiao (LP…, AP…), YunExpress (YT + 16 digits), CNE Express (3A5V + 9 digits), SunYou (SY + 2 letters + 9 digits), or UBI Smart Parcel (AU + 13 digits)—as well as US outbound parcels via Asendia (AHOY + 8 chars)—are handed over to a destination carrier (such as USPS, UniUni, GOFO, SpeedX, OnTrac, Canada Post, Intelcom / Dragonfly, Australia Post, or Royal Mail) after clearing customs.

When you query the origin cross-border number, lastscanned returns the full scan timeline and populates the top-level message field with the destination carrier and secondary tracking number as soon as the handoff occurs:

{
  "carrier": "yunexpress",
  "trackingNumber": "YT2628500703004876",
  "status": "in_transit",
  "statusDescription": "Arrived at destination airport",
  "message": "Handed to UniUni as UUS5BM1269395824723",
  "events": [ ... ]
}

You can also query the domestic last-mile tracking number (UUS5BM1269395824723, SPX…, INTLCM…, 7012345678901230, GFUS…, or 420…92…) directly with GET /v1/track/:number to inspect the local delivery scans.


Skip maintaining regexes and fighting carrier 403s in your own app

When you query UPS, FedEx, USPS, DHL, OnTrac, Veho, Canada Post, Purolator, or Sendle directly from a serverless or edge backend (Cloudflare Workers, Vercel, AWS Lambda, Next.js), datacenter requests run straight into Akamai Bot Manager 403/428 blocks, Cloudflare Turnstile challenges, Veho Firebase App Check token gates, Sendle SHA-256 proof-of-work challenges, or enterprise OAuth / shipper contract portals. Instead of maintaining carrier regex tables, check-digit validators, per-carrier OAuth credentials, and a separate response parser per carrier in your own codebase, send the raw tracking number to GET /v1/track/:number in one fetch():

const res = await fetch(`https://api.containerfeed.com/v1/track/${encodeURIComponent(number)}`, {
  headers: { Authorization: `Bearer ${process.env.LASTSCANNED_KEY}` },
});
const data = await res.json();
// data.carrier is normalized ("ups" | "usps" | "fedex" | ...), and data.status is one of 7 standard states.

On this page