Convert YunExpress (YT…) waybills to their final-mile USPS (92… / 420…) tracking number automatically.

When a YunExpress (YT + 16 digits) parcel is routed through USPS for final US residential delivery, a secondary 22-digit 92… or 30-digit 420+ZIP+92… USPS tracking number is generated for the domestic leg. Querying GET /v1/track/YT... on lastscanned returns the full international air timeline and extracts 'Handed to USPS as 92...' in the top-level message field.

Barcode transition: YunExpress to USPS

When YunExpress clears customs and hands off to USPS, lastscanned surfaces the secondary tracking number in the top-level message field.

Origin / middle-mile carrier
YunExpress (yunexpress)
YunExpress Waybill
YT + 16 digits (/^YT\d{16}$/)
Origin example
YT2601500703194270
Final-mile carrier
USPS (usps)
USPS Domestic IMpb
92… / 93… / 94… (22 digits) or 420+ZIP+92… (30 digits)
Final-mile example
9261290100130612345678
Extracted in .message
Handed to USPS as 9261290100130612345678

How the YunExpress → USPS handoff works

Follow the parcel across both networks without waiting on asynchronous webhooks or losing visibility at the handoff boundary.

1. Track the YT… number from Shenzhen/Hong Kong to US customs
Call GET /v1/track/YT... to inspect origin pickup, export linehaul, and JFK/LAX/ORD customs clearance.
2. Extract the USPS IMpb barcode from message
lastscanned populates message with 'Handed to USPS as 92...' (or 420+ZIP+92...) so your app doesn't have to parse carrier-specific nested metadata.
3. Track final USPS delivery (or middle-mile consolidator)
Call GET /v1/track/92... to get USPS processing and mailbox delivery scans—or add ?carrier=osm if the domestic leg moves through OSM Worldwide before local post office acceptance.
Origin format
18 characters starting YT (/^YT\d{16}$/), auto-detected as yunexpress.
Destination format
20–30 digit USPS IMpb (/^(420\d{5})?9[2345]\d{18,24}$/), auto-detected as usps.
Unified status lifecycle
Both YunExpress and USPS responses share the exact same 7-state status enum and scan event schema.

Chain YunExpress → USPS in code or MCP

Resolve both legs synchronously in TypeScript, curl, or your AI support agent via Streamable HTTP MCP.

REST (Synchronous GET)

# 1. Query YunExpress origin waybill (extracts final-mile barcode in .message):
curl "https://api.lastscanned.com/v1/track/YT2601500703194270" \
  -H "Authorization: Bearer lsk_live_YOUR_API_KEY"

# 2. Query the extracted USPS barcode:
curl "https://api.lastscanned.com/v1/track/9261290100130612345678" \
  -H "Authorization: Bearer lsk_live_YOUR_API_KEY"

TypeScript (Automatic Handoff Chaining)

const headers = { Authorization: `Bearer ${process.env.LASTSCANNED_API_KEY}` };
const originRes = await fetch(`https://api.lastscanned.com/v1/track/${encodeURIComponent(number)}`, { headers });
const originPkg = await originRes.json();

// Extract secondary barcode from top-level message ("Handed to USPS as 9261290100130612345678")
const handoff = originPkg.message?.match(/^Handed to (.+?) as ([A-Z0-9-]+)$/i);
if (handoff) {
  const [, , lastMileNumber] = handoff;
  const destRes = await fetch(`https://api.lastscanned.com/v1/track/${encodeURIComponent(lastMileNumber)}`, { headers });
  const destPkg = await destRes.json();
}

Remote MCP (Claude Code / Cursor / ChatGPT)

claude mcp add --transport http lastscanned https://mcp.lastscanned.com \
  --header "Authorization: Bearer lsk_live_YOUR_API_KEY"

YunExpress to USPS Last-Mile Handoff Tracking FAQ

Why does my YunExpress tracking stop updating after 'Delivered to local carrier'?
Once YunExpress hands the parcel to a US domestic carrier (such as USPS, UniUni, GOFO, or OnTrac), subsequent local sort and doorstep scans are recorded under the secondary domestic tracking number. lastscanned returns that secondary number in the top-level message field.
How do I get the USPS tracking number for a YT… parcel via API?
Call GET https://api.lastscanned.com/v1/track/YT... and inspect the message property (e.g. 'Handed to USPS as 926129...').
What if the extracted 92… USPS number still says 'Currently Awaiting Package'?
YunExpress often injects US parcels via domestic consolidators like OSM Worldwide or Pitney Bowes before local post office induction. Pass ?carrier=osm or ?carrier=pitneybowes on that 92… number to see the domestic middle-mile hub scans.

All 31 supported carriers