# 4PX Express Tracking API & MCP

URL: https://docs.lastscanned.com/carriers/4px

Query live **4PX Worldwide Express** (`4px`, 递四方) cross-border package status, scan history, and **domestic last-mile handoff numbers** in a single synchronous `GET` request or MCP tool call. `lastscanned` auto-detects 18-character `4PX…CN` tracking numbers, repairs 4PX's cross-timezone chronological sorting bug, and returns a normalized `TrackingResult` JSON payload.

## Overview & Quick Facts

| Property | Value |
|---|---|
| **Carrier slug (`?carrier=`)** | `4px` |
| **Brand & service aliases** | 4PX Express, 4PX Worldwide Express (递四方), `4PX…CN` |
| **Category** | China cross-border e-commerce logistics consolidator (Detection precedence **#16 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=4PX...CN,4PX...CN` (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 4PX Express

- **Fixes 4PX's broken cross-timezone scan ordering**: 4PX's upstream API computes its `tkDate` epoch by interpreting every scan's local wall-clock time (`tkDateStr`) as Beijing time (`UTC+8`)—ignoring the scan's actual `tkTimezone` (`UTC-05:00`). Because US local wall-clock times are 12–13 hours behind Shenzhen, 4PX sorts Chinese export scans *above* US last-mile scans that occurred hours later in real UTC time. `lastscanned` ignores the broken `tkDate` epoch, computes true UTC from `tkDateStr` + `tkTimezone`, and re-sorts the timeline in true chronological order.
- **Surfaces last-mile carrier & exchange number in `message`**: When 4PX hands a parcel to USPS, UniUni, or another domestic carrier, `lastscanned` extracts both `channelContact` (the carrier name) and `serverCode` (the domestic tracking number) into `message`.

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

4PX is evaluated **sixteenth (#16)** in `lastscanned`'s two-pass detector:

| Pass | Rule / Regex | Check Digit | Examples |
|---|---|---|---|
| **Pass 1 (`matches`)** | `/^4PX\d{13}CN$/i` (`4PX` + 13 digits + `CN` = 18 chars) | — | `4PX3002491827361CN`, `4PX3000123456789CN` |
| **Pass 2 (`mayMatch`)** | *None* | — | — |

### When is `?carrier=4px` optional vs required?

- **Optional (auto-detected)**: All 18-character `4PX` + 13 digits + `CN` tracking numbers auto-detect in Pass 1.
- **Required (`?carrier=4px`)**: When querying 4PX's system using the domestic last-mile barcode (e.g. a USPS `92…` or Royal Mail S10 number that was inducted by 4PX) or a custom merchant order number.

## Synchronous `GET` Request & Normalized JSON Response

### `curl`

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

### JavaScript / TypeScript (`fetch`)

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

### MCP `track_package` tool call

```json
{
  "tool": "track_package",
  "arguments": {
    "tracking_number": "4PX3002491827361CN"
  }
}
```

### Normalized `TrackingResult` JSON response

```json
{
  "carrier": "4px",
  "trackingNumber": "4PX3002491827361CN",
  "status": "delivered",
  "statusDescription": "Delivered, In/At Mailbox",
  "service": null,
  "deliveredAt": "2026-10-24T19:22:00Z",
  "deliveredAtLocal": "2026-10-24T14:22:00",
  "signedBy": null,
  "destination": {
    "city": null,
    "state": null,
    "country": "US"
  },
  "estimatedDelivery": null,
  "message": "Handed to USPS as 9261290312839104827163",
  "events": [
    {
      "timestamp": "2026-10-24T19:22:00Z",
      "localTime": "2026-10-24T14:22:00",
      "status": "delivered",
      "description": "Delivered, In/At Mailbox",
      "location": "DALLAS, TX 75201",
      "code": "FPX_L_ok"
    },
    {
      "timestamp": "2026-10-24T11:15:00Z",
      "localTime": "2026-10-24T06:15:00",
      "status": "out_for_delivery",
      "description": "Out for Delivery",
      "location": "DALLAS, TX 75201",
      "code": "FPX_I_RC"
    },
    {
      "timestamp": "2026-10-20T16:40:00Z",
      "localTime": "2026-10-21T00:40:00",
      "status": "in_transit",
      "description": "Depart from facility to service provider.",
      "location": "Shenzhen, China",
      "code": "FPX_C_BTC"
    },
    {
      "timestamp": "2026-10-18T03:12:00Z",
      "localTime": "2026-10-18T11:12:00",
      "status": "label_created",
      "description": "Shipment information received",
      "location": null,
      "code": "FPX_O_CR"
    }
  ]
}
```

> **Raw status & scan codes**: `events[].code` preserves 4PX's `tkCode` (`"FPX_O_CR"` → `label_created`, `"FPX_C_..."` / `"FPX_M_..."` → `in_transit`, `"FPX_I_RC"` → `out_for_delivery` when out for delivery, `"FPX_L_ok"` → `delivered`, `"FPX_L_RPI"` → `returned`).

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

When 4PX assigns a secondary domestic tracking number (`serverCode`) different from the `4PX…CN` number, `lastscanned` populates `message` with:

- `"Handed to USPS as 9261290312839104827163"` (when `channelContact` identifies the last-mile carrier), or
- `"Handed to the destination carrier as <serverCode>"`

You can pass that secondary tracking number directly into a follow-up `GET /v1/track/{serverCode}` call to retrieve native last-mile scans from [USPS](/carriers/usps), [UniUni](/carriers/uniuni), [GOFO](/carriers/gofo), or [OnTrac](/carriers/ontrac).

## Related Resources

- **Live browser lookup tool**: [Track a 4PX Express package live on lastscanned.com/lookup/4px](https://lastscanned.com/lookup/4px)
- **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)
