# Mainfreight Tracking API & MCP

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

Query live **Mainfreight** (`mainfreight`) package status and scan history in a single synchronous `GET` request or MCP tool call. Mainfreight numbers are not auto-detected: consignment references have no unique format, so pass `?carrier=mainfreight`.

## Overview & Quick Facts

| Property | Value |
|---|---|
| **Carrier slug (`?carrier=`)** | `mainfreight` |
| **Brand & service aliases** | Mainfreight, Mainfreight Transport (`mainfreight.com`) |
| **Category** | Freight and logistics carrier (New Zealand, Australia, Europe, USA) |
| **Single-package REST endpoint** | `GET https://api.lastscanned.com/v1/track/{trackingNumber}?carrier=mainfreight` |
| **Batch REST endpoint** | `GET https://api.lastscanned.com/v1/track?numbers=ABC1234567,...&carrier=mainfreight` |
| **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 Mainfreight

- **Current status of a freight consignment** from Mainfreight's public tracker, without a Mainfreight login.
- **Journey and service**: the result carries the consignment's service type and the time its status was set.

## Tracking Number Formats & Auto-Detection

| Pass | Rule / Regex | Check Digit | Examples |
|---|---|---|---|
| **Pass 1 (`matches`)** | *None* | — | — |
| **Pass 2 (`mayMatch`)** | *None* | — | — |
| **Explicit (`?carrier=mainfreight`)** | A Mainfreight consignment or reference number | — | `ABC1234567` |

## Synchronous `GET` Request & Normalized JSON Response

### `curl`

```bash
curl -s "https://api.lastscanned.com/v1/track/ABC1234567?carrier=mainfreight" \
  -H "Authorization: Bearer $LASTSCANNED_API_KEY"
```

### JavaScript / TypeScript (`fetch`)

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

### MCP `track_package` tool call

```json
{
  "tool": "track_package",
  "arguments": {
    "tracking_number": "ABC1234567",
    "carrier": "mainfreight"
  }
}
```

### Normalized `TrackingResult` JSON response

```json
{
  "carrier": "mainfreight",
  "trackingNumber": "ABC1234567",
  "status": "in_transit",
  "statusDescription": "In Transit",
  "service": "AirAndOcean",
  "deliveredAt": null,
  "deliveredAtLocal": null,
  "signedBy": null,
  "destination": null,
  "events": [
    {
      "timestamp": "2026-10-25T21:30:00Z",
      "localTime": null,
      "status": "in_transit",
      "description": "In Transit",
      "location": "Auckland to Sydney",
      "code": null
    }
  ]
}
```

## Notes

- **One event**: the public tracker shows a status banner, not a list of scans, so `events` holds the current status.
- **Written from the page's own scripts**: the empty answer for an unknown number was checked live; the field names of a found consignment come from the page's code.

## Related Resources

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