Track Cainiao (LP… / AP…) parcels handed off to SpeedX (SPX…) for US metro doorstep delivery.
Cainiao increasingly routes US metro e-commerce parcels (NYC, NJ, LA, Chicago, Dallas, Miami) to SpeedX (SPX + 15 or 21 chars) instead of USPS after airport customs clearance. Querying GET /v1/track/LP... on lastscanned surfaces the secondary SpeedX tracking number in message ('Handed to SpeedX as SPX...'), and querying GET /v1/track/SPX... decodes SpeedX's live last-mile scans.
Barcode transition: Cainiao to SpeedX
When Cainiao clears customs and hands off to SpeedX, lastscanned surfaces the secondary tracking number in the top-level message field.
- Origin / middle-mile carrier
- Cainiao (cainiao)
- Cainiao Waybill
- LP + 14–17 digits or AP + 14 digits (/^(LP\d{14,17}|AP\d{14})$/)
- Origin example
- LP00658129481029
- Final-mile carrier
- SpeedX (speedx)
- SpeedX Barcode
- SPX + 15 or 21 alphanumeric chars (/^SPX([0-9A-Z]{15}|[0-9A-Z]{21})$/)
- Final-mile example
- SPXUS0123456789123
- Extracted in .message
- Handed to SpeedX as SPXUS0123456789123
How the Cainiao → SpeedX handoff works
Follow the parcel across both networks without waiting on asynchronous webhooks or losing visibility at the handoff boundary.
- 1. Query the Cainiao LP… waybill
- Call GET /v1/track/LP... to retrieve China export sorting, linehaul flight, and US customs release scans.
- 2. Extract the SPX… barcode from message
- lastscanned populates message with 'Handed to SpeedX as SPX...' as soon as the final-mile SpeedX barcode is issued.
- 3. Track SpeedX final-mile delivery
- Call GET /v1/track/SPX... to get SpeedX sortation hub scans (Jamaica NY, Elk Grove Village IL, Compton CA), driver out_for_delivery events, and delivery confirmation.
- Cainiao regex
- /^(LP\d{14,17}|AP\d{14})$/ (Pass 1).
- SpeedX regex
- /^SPX([0-9A-Z]{15}|[0-9A-Z]{21})$/ (Pass 1, carrier code: speedx).
- Zero SpeedX decoding boilerplate
- lastscanned normalizes SpeedX's base64 proto-JSON responses and event codes (203 delivered, 200 out_for_delivery) automatically.
Chain Cainiao → SpeedX 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 Cainiao origin waybill (extracts final-mile barcode in .message):
curl "https://api.lastscanned.com/v1/track/LP00658129481029" \
-H "Authorization: Bearer lsk_live_YOUR_API_KEY"
# 2. Query the extracted SpeedX barcode:
curl "https://api.lastscanned.com/v1/track/SPXUS0123456789123" \
-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 SpeedX as SPXUS0123456789123")
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"Cainiao to SpeedX Last-Mile Handoff Tracking FAQ
- How do I find my SpeedX (SPX…) tracking number from a Cainiao LP… number?
- Look up the LP… number on lastscanned or call GET /v1/track/LP.... The top-level message field returns 'Handed to SpeedX as SPX...'.
- Does lastscanned support both 18-character and 24-character SpeedX SPX… numbers?
- Yes. lastscanned auto-detects both SPX + 15 alphanumeric characters (18 total, such as SPXUS...) and SPX + 21 alphanumeric characters (24 total, such as SPXCN...) in Pass 1.
Other carrier handoff guides
Explore cross-border last-mile barcode extraction and domestic USPS consolidator overrides across all 31 carriers.
- OSM Worldwide to USPS Handoff TrackingOSM Worldwide → USPS
- Pitney Bowes to USPS Handoff TrackingPitney Bowes → USPS
- YunExpress to UniUni Last-Mile Handoff TrackingYunExpress → UniUni
- YunExpress to USPS Last-Mile Handoff TrackingYunExpress → USPS
- Yanwen to USPS Last-Mile Handoff TrackingYanwen → USPS
- Yanwen to UniUni Last-Mile Handoff TrackingYanwen → UniUni
- Cainiao to USPS Last-Mile Handoff TrackingCainiao → USPS
- 4PX to USPS Last-Mile Handoff Tracking4PX → USPS
- CNE Express to USPS Last-Mile Handoff TrackingCNE Express → USPS
- Asendia USA to USPS / Postal Handoff TrackingAsendia → USPS / Postal
- UBI Smart Parcel to Australia Post / Local Last-Mile Handoff TrackingUBI Smart Parcel → Local Last-Mile