How do I track Yanwen and YunExpress numbers with an API?
Yanwen accepts two letters, nine digits and YP (S10 check digit) or YW, three letters and twelve digits. YunExpress accepts YT plus sixteen digits. One GET /v1/track/{number} returns either carrier in the same JSON, with a last-mile handoff in message when the carrier records one. Pro is $4.99 a month for 1,000 unique numbers, then $0.015.
Try it
curl "https://api.lastscanned.com/v1/track/UL494089685YP" \
-H "Authorization: Bearer lsk_live_YOUR_KEY"curl "https://api.lastscanned.com/v1/track/YT2621200705470145" \
-H "Authorization: Bearer lsk_live_YOUR_KEY"const res = await fetch("https://api.lastscanned.com/v1/track/UL494089685YP", {
headers: { Authorization: `Bearer ${process.env.LASTSCANNED_KEY}` },
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
console.log(await res.json());import os
import requests
r = requests.get(
"https://api.lastscanned.com/v1/track/YT2621200705470145",
headers={"Authorization": f"Bearer {os.environ['LASTSCANNED_KEY']}"},
timeout=60,
)
r.raise_for_status()
print(r.json()){
"carrier": "yanwen",
"trackingNumber": "UL494089685YP",
"status": "in_transit",
"statusDescription": "<newest scan, or the page status>",
"service": null,
"deliveredAt": null,
"deliveredAtLocal": null,
"signedBy": null,
"destination": { "city": null, "state": null, "country": "<destination country>" },
"message": "Handed to USPS as <last-mile number>",
"events": [
{ "timestamp": "<UTC or null>", "localTime": "<as printed>", "status": "in_transit", "description": "<scan text>", "location": null, "code": "LH30" }
]
}{
"carrier": "yunexpress",
"trackingNumber": "YT2621200705470145",
"status": "in_transit",
"statusDescription": "<track status>",
"service": null,
"deliveredAt": null,
"deliveredAtLocal": null,
"signedBy": null,
"destination": { "city": null, "state": null, "country": "<destination country code>" },
"message": "Handed to USPS as <last-mile number>",
"events": [
{ "timestamp": "<UTC or null>", "localTime": "<as printed>", "status": "in_transit", "description": "<scan text>", "location": "<place or null>", "code": null }
]
}Ways to read a Yanwen or YunExpress number
| Option | How it works | Price | Notes |
|---|---|---|---|
| Yanwen tracking page | Look up one or many numbers on track.yw56.com.cn. | Free | HTML on the page, not the JSON below. |
| YunExpress tracking page | Look up a YT number on yuntrack.com. | Free | YunExpress only. |
| lastscanned | GET /v1/track/{number}. Both formats detect with no carrier parameter. | Free: 5 numbers a day. Pro: $4.99/mo for 1,000 unique numbers, then $0.015 each. | Same fields as the other 550 carriers. |
Details
Accepted Yanwen formats
UL494089685YP is the postal form: two letters, nine digits and YP, and the S10 check digit has to be valid or the number is not detected as Yanwen. YWSTL010022557186 is the other form: YW, a three-letter hub and 12 digits. Both match with no ?carrier=yanwen.
Accepted YunExpress format
YT2621200705470145 is YT plus 16 digits. That is the only shape detected as yunexpress. A batch can hold 35 YunExpress numbers, inside the 100-number request cap.
What message means
For Yanwen, message is "Handed to {carrier} as {number}" when the tracking page names a last-mile carrier and a different number (USPS 420… numbers are one case the adapter reads), or "Yanwen last-mile number {number}" when that carrier is Yanwen itself. For YunExpress, message is "Handed to {name} as {number}" from the last-mile name in the parcel notes. A "Last Mile:" line that says USPS becomes "Handed to USPS as …". If the notes only link to a site, the name is that host. The same number as the one you asked about leaves message null.
Price
Pro is $4.99/mo for 1,000 unique numbers, then $0.015 each, with no daily limit. A free key tracks 5 numbers a day. With no key you get 1 lookup a day, then pay per request over MPP: $0.50 by card for a 25-number pack, or $0.02 a number in USDC on Tempo or Solana.
FAQ
- What does a Yanwen tracking number look like?
- Either two letters, nine digits and YP, with a valid S10 check digit, or YW plus three letters and twelve digits.
- What does a YunExpress tracking number look like?
- YT followed by 16 digits.
- Do I pass a carrier id?
- No, for those formats. GET /v1/track/{number} detects yanwen or yunexpress. Pass ?carrier= only when you are asking that carrier about some other barcode.
- How much does it cost?
- A free key tracks 5 numbers a day. Pro is $4.99 a month for 1,000 unique numbers, then $0.015 each, with re-checks free. One keyless lookup a day, then MPP.