# Yanwen Express Tracking API & MCP

URL: https://docs.lastscanned.com/carriers/yanwen

Query live **Yanwen Logistics** (`yanwen`, 燕文物流) cross-border package status, scan history, and **domestic last-mile exchange tracking numbers** in a single synchronous `GET` request or MCP tool call. `lastscanned` validates 13-character `…YP` S10 barcodes and 17-character `YW…` waybills, returning a normalized `TrackingResult` JSON payload—with zero Yanwen merchant keys required.

## Overview & Quick Facts

| Property | Value |
|---|---|
| **Carrier slug (`?carrier=`)** | `yanwen` |
| **Brand & service aliases** | Yanwen Express, Yanwen Logistics (燕文物流), `…YP`, `YW…` |
| **Category** | China cross-border e-commerce logistics consolidator (Detection precedence **#15 of 31**) |
| **Single-package REST endpoint** | `GET https://api.lastscanned.com/v1/track/{trackingNumber}` |
| **Batch REST endpoint** | `GET https://api.lastscanned.com/v1/track?numbers=UL...YP,YW...` (up to 35 numbers per carrier in a 100-number call) |
| **MCP server (`https://mcp.lastscanned.com`)** | `track_package`, `track_packages`, `list_carriers` (`claude mcp add --transport http lastscanned https://mcp.lastscanned.com`) |
| **Authentication & pricing** | `Authorization: Bearer lsk_live_...` · **1 free keyless lookup/day per IP** · **Free tier** (5 unique numbers/day, $0) · **Pro** ($4.99/mo for 1,000 unique numbers, unlimited re-polls, $0.015/extra) · **HTTP 402 Stripe MPP** ($0.50 for 25-number `lsk_pack_` key or $0.02/number in USDC on Tempo) |

## Why developers use `lastscanned` for Yanwen

- **Skip MD5 signature hashes & bilingual HTML parsing**: Yanwen's tracking endpoint requires computing an MD5 payload signature (`cyp`) with a shared salt and returns HTML `<dl>` timelines with Chinese category headers (`制单完成`, `运输途中`, `到达待取`, `正在派送`, `投递成功`, `退件`, `运单异常`). `lastscanned` normalizes the entire timeline into English JSON in one `fetch()`.
- **Automatic domestic last-mile handoff extraction**: When Yanwen hands a parcel to a destination carrier like [USPS](/carriers/usps), [UniUni](/carriers/uniuni), or Royal Mail, `lastscanned` extracts the exchange tracking number and carrier name into the top-level `message` field (e.g. `"Handed to USPS as 420100019261290312839104827163"`), making two-step cross-border tracking effortless.

## Tracking Number Formats & Auto-Detection (`matches` vs `mayMatch`)

Yanwen is evaluated **fifteenth (#15)** in `lastscanned`'s two-pass detector:

| Pass | Rule / Regex | Check Digit | Examples |
|---|---|---|---|
| **Pass 1 (`matches`) — UPU S10 `…YP`** | `/^[A-Z]{2}\d{9}YP$/i` (2 letters + 9 digits + `YP`) | **Yes — `s10(n)` (Mod-11)** | `UL494089685YP`, `VR519204815YP` |
| **Pass 1 (`matches`) — `YW` waybill** | `/^YW[A-Z]{3}\d{12}$/i` (`YW` + 3 letters + 12 digits = 17 chars) | — | `YWSTL010022557186` |
| **Pass 2 (`mayMatch`)** | *None* | — | — |

### UPU `s10` check digit on `…YP` numbers

13-character Yanwen numbers ending in `YP` follow the UPU S10 Mod-11 standard (weights `[8, 6, 4, 2, 3, 5, 9, 7]` over the first 8 digits), which `lastscanned` verifies before making any network request.

### When is `?carrier=yanwen` optional vs required?

- **Optional (auto-detected)**: All valid 13-character `…YP` S10 numbers and 17-character `YW[A-Z]{3}\d{12}` numbers.
- **Required (`?carrier=yanwen`)**: Numeric-only Yanwen customer order numbers or destination-carrier tracking numbers that you want to look up inside Yanwen's system.

## Synchronous `GET` Request & Normalized JSON Response

### `curl`

```bash
curl -s "https://api.lastscanned.com/v1/track/UL494089685YP" \
  -H "Authorization: Bearer $LASTSCANNED_API_KEY"
```

### JavaScript / TypeScript (`fetch`)

```ts
const res = await fetch("https://api.lastscanned.com/v1/track/UL494089685YP", {
  headers: { Authorization: `Bearer ${process.env.LASTSCANNED_API_KEY}` },
});
const pkg = await res.json();
console.log(pkg.status, pkg.message, pkg.deliveredAt);
```

### MCP `track_package` tool call

```json
{
  "tool": "track_package",
  "arguments": {
    "tracking_number": "UL494089685YP"
  }
}
```

### Normalized `TrackingResult` JSON response

```json
{
  "carrier": "yanwen",
  "trackingNumber": "UL494089685YP",
  "status": "delivered",
  "statusDescription": "Delivered, In/At Mailbox",
  "service": null,
  "deliveredAt": "2026-10-23T18:45:00Z",
  "deliveredAtLocal": "2026-10-23T14:45:00",
  "signedBy": null,
  "destination": {
    "city": null,
    "state": null,
    "country": "United States"
  },
  "estimatedDelivery": null,
  "message": "Handed to USPS as 420100019261290312839104827163",
  "events": [
    {
      "timestamp": "2026-10-23T18:45:00Z",
      "localTime": "2026-10-23T14:45:00",
      "status": "delivered",
      "description": "Delivered, In/At Mailbox",
      "location": "NEW YORK, NY 10001",
      "code": null
    },
    {
      "timestamp": "2026-10-23T10:10:00Z",
      "localTime": "2026-10-23T06:10:00",
      "status": "out_for_delivery",
      "description": "Out for Delivery",
      "location": "NEW YORK, NY 10001",
      "code": null
    },
    {
      "timestamp": "2026-10-19T06:30:00Z",
      "localTime": "2026-10-19T14:30:00",
      "status": "in_transit",
      "description": "Departed from Yanwen Facility",
      "location": "SHENZHEN",
      "code": null
    },
    {
      "timestamp": "2026-10-18T02:15:00Z",
      "localTime": "2026-10-18T10:15:00",
      "status": "label_created",
      "description": "Order processed by shipper",
      "location": null,
      "code": null
    }
  ]
}
```

## Chaining Last-Mile Handoffs (`message`)

When Yanwen transfers a parcel to a domestic last-mile carrier, `lastscanned` populates `message` with:

- `"Handed to <Carrier> as <exchangeNumber>"` (when both the partner carrier name and exchange tracking number are present), or
- `"Handed to the destination carrier as <exchangeNumber>"`

Your application or AI agent can extract the trailing tracking number from `message` and call `GET /v1/track/{exchangeNumber}` to get live doorstep scans directly from [USPS](/carriers/usps), [UniUni](/carriers/uniuni), [GOFO](/carriers/gofo), or [FedEx](/carriers/fedex).

## Carrier-Specific Status & Integration Notes

- **Explicit `[GMT±XX]` timezone parsing**: Yanwen annotates each scan description with a `[GMT+08]` or `[GMT-04]` tag; `lastscanned` strips the tag from `description` and uses the offset to compute exact UTC `timestamp` alongside `localTime`.
- **Up to 35 numbers per batch**: Yanwen supports native multi-number lookups, and `GET /v1/track?numbers=...` accepts up to 35 Yanwen tracking numbers in one call.

## Related Resources

- **Live browser lookup tool**: [Track a Yanwen package live on lastscanned.com/lookup/yanwen](https://lastscanned.com/lookup/yanwen)
- **Carrier hub**: [All 31 supported carriers](/carriers)
- **Regex & check digits**: [Tracking number formats & auto-detection](/formats)
- **AI support workflows**: [WISMO AI agents & synchronous tracking](/wismo)
