Dev.to WebDev 🛠 Dev 👁 0 📖 4 min read

Carrier names are not identifiers. The tracking number is.

If you are building anything that touches shipments - an order dashboard, a WISMO page, a support tool - the first modelling mistake is usually the same one: treating the carrier name as the key. It is not. It is a displ


If you are building anything that touches shipments - an order dashboard, a WISMO page, a support tool - the first modelling mistake is usually the same one: treating the carrier name as the key. It is not. It is a display label that drifts, collides and gets typed by hand. The tracking number is the stable identifier, and designing around that fact removes a whole class of bugs before you write them.

Here is why the name is unreliable, and what to key on instead.

Four ways a carrier name goes wrong

1. The company renames itself. Logistics businesses merge, get bought, expand into new markets or outgrow a name that only made sense in one country. The sign changes; the warehouses, routes and number formats do not. Meanwhile the old name is still sitting in every seller's shipping software, so it keeps arriving on new shipments for months after the rebrand. If your system treats "OldName" and "NewName" as two carriers, you have just split one operator's shipments into two buckets.

2. One group, many operating companies. A single global brand can be several separate businesses with separate numbering and separate tracking tools. "Which one has my parcel" is a real question with a real answer, and the answer is in the number format rather than the brand.

3. The name on the shipment is not a carrier at all. On large marketplaces the entity that creates the label is often a reseller, a fulfilment provider or a freight forwarder that physically holds the stock. Its name lands on the record because it generated the record. Model it as a carrier and you will keep "discovering" new carriers that are actually sellers.

4. Humans type it. Free-text carrier fields produce OnTrac, on trac, On-Trac; Cainiao, cai niao; YTO, Yuantong. Normalising that list is endless work with no finish line.

What is actually stable

The number. Format is tied to the operation that issues it, not to the branding wrapped around it, so it survives the rebrand that breaks your name matching.

A few examples of shape carrying meaning:

  • UPS: 1Z + 16 alphanumeric characters.
  • USPS IMpb: 22 digits, commonly starting 92-95; labels printed with a routing prefix can carry a leading 420 plus a ZIP before the barcode proper.
  • UPU S10 (international post): two letters, nine digits, two letters, where the trailing pair is the origin country - RA123456789CN.
  • DHL Express: ten digits, no letters at all, which is exactly why people mistake it for an order number.

That is a design hint, not a lookup table: the practical rule is that a shape plus a length is usually enough to narrow a number to one operator or one small family, and that identification survives a rename.

A resolution order that holds up

1. Normalise the input
   - uppercase, strip spaces and dashes
   - reject anything with no digits at all

2. Try strong shape rules first
   - anchored patterns with a fixed length
   - a check digit where the format defines one

3. Fall back to weak shape rules
   - prefix + length only, as a guess
   - NEVER let a guess overwrite a label you already trust

4. Treat the stored carrier name as a hint, not a key
   - alias table maps many names to one operator
   - unknown name is fine; unknown number is the real failure

Step 3 is the one worth labouring. A bare-digit rule like "ten digits means carrier X" is a guess by shape alone, and if you let it overwrite an operator name you already received from a trustworthy source, you will silently relabel real shipments. Rank your rules by evidence strength and make the weak ones last-resort only.

Two more things that bite:

  • An order reference is not a tracking number. Shops hand out their own reference constantly, and it will never resolve anywhere. Worth detecting and saying so plainly, rather than returning an empty page.
  • Service codes are not tracking numbers either. Strings with no digits in them name a shipping product, not a parcel. The same string is on every parcel sent that way.

Does the name matter at all?

Yes - for display, and for routing a support query to the right place. Just do not make it a join key, a cache key or a uniqueness constraint. Resolve on the number, store the name as an attribute you are allowed to correct later, and keep an alias table so one operator does not fragment into five.

FAQ

My carrier field is already free text. What is the cheapest fix?
Leave the column, stop joining on it. Add a resolved-operator field derived from the number, backfill it, and move your reports onto that.

What if a number matches two formats?
Rank by evidence: fixed length plus a valid check digit beats prefix plus length, which beats length alone. If the best you have is a weak match, keep the existing label.

A number stopped resolving after the carrier rebranded. Why?
Almost certainly your name matching broke, not the format. Numbers issued before and after a rename usually look identical.

Do I need to build this?
Not necessarily. 24hTrack (24htrack.com) is a free package tracker for 3,200+ carriers - paste any tracking number, the carrier is detected automatically, no sign-up. There is a REST API and an MCP server (npm i 24htrack-mcp) if you want it inside your own tooling, and the open guide repo has the format notes in longer form.

Published by the team at 24hTrack. This post was written by our automated content agent — the format notes come from our own carrier-detection work.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.